Tag: python

PermissionError: [Errno 13] Permission denied: '/code/manage.py'

I was trying to run django app on docker container. Followed steps mentioned at https://docs.docker.com/compose/django/ But after running the command docker-compose run web django-admin.py startproject composeexample . I facing error PermissionError: [Errno 13] Permission denied: ‘/code/manage.py’ I’m using centos 7. please help [root@localhost docker-django]# docker-compose run web django-admin.py startproject composeexample . Traceback (most recent call […]

How to run a Python web App for Raspberry Pi locally on Mac OSX

This is a pretty specific question, but perhaps there are ideas in here which are more generally useful. Here goes: There’s an open source media presentation program for Raspberry Pi – allows you to hook up a Pi to a TV and upload images to display on the TV. Repo here: https://github.com/wireload/screenly-ose Now, I want […]

Opening a port from a docker container on AWS to the rest of the world

I’m trying to host a python HTTPS server on Amazon Web Services using Docker. The application “application.py” works well when executed on my local computer on the arbitrary port 8012. The problem is that the required port is not open when I try to run the same application remotely. Here are the configuration files: Dockerfile […]

disk I/O error when using Sqlite3 and SqlAlchemy in docker

I have a flask app that creates a sqlite db to load fixtures for tests. When I run pytest within osx, there are no issues. However, when I set ‘PRAGMA journal_mode=WAL’ within a ubuntu 14.04 docker container, I get this: disk I/O error Traceback (most recent call last): File “/tmp/my_app/util/sqlalchemy_helpers.py”, line 23, in pragma_journalmode_wal cursor.execute(‘PRAGMA […]

Writing to Kafka running in Docker from Python fails

I have Zookeeper and Kafka running in Docker on OS X using Docker Toolbox and Docker Compose. My docker-compose.yml file is: zk: image: patrickmay/zookeeper:3.4.6-jessie ports: – “2181:2181” command: /usr/local/zookeeper/bin/zkServer.sh start-foreground kafka0: image: patrickmay/kafka: ports: – “9092:9092” command: /usr/local/bin/start-kafka.sh 0 docker-machine 9092 links: – zk kafka1: image: patrickmay/kafka: ports: – “9093:9092” command: /usr/local/bin/start-kafka.sh 1 docker-machine 9093 […]

Docker fails to start container occasionally with error “lstat /dev/dm-1: no such file or directory”

I have a Jenkins data pipeline and will invoke start 40 docker containers every day. Every now and then (about every 5 days) one of these 40 containers failed to start itself and had some weird messages as below: time=”2015-04-29T03:09:31-07:00″ level=”fatal” msg=”Error response from daemon: Cannot start container 9d9b2b12654731aceb69279e18f083e337456a13ffbb2ffc8426932fdf22c323: lstat /dev/dm-1: no such file or […]

Python subprocess — close Django server and Docker container with Ctrl-C, return to terminal

I’m trying to figure out how to properly close out my script that’s supposed to start up a Django server running in a docker container (boot2docker, on Mac OS X). Here’s the pertinent code block: try: init_code = subprocess.check_output(‘./initdocker.sh’, shell=True) subprocess.call(‘./startdockerdjango.sh’, shell=True) except subprocess.CalledProcessError: try: subprocess.call(‘./startdockerdjango.sh’, shell=True) except KeyboardInterrupt: return Where startdockerdjango.sh takes care of […]

Create base docker centos image with python 2.7.8

I’ve found this which walks you through creating a base bare-metal centos image. I want to however install some additional yum packages, download Python 2.7.8 and build it. I had this in a dockerfile and already working like: # Set the base image to Ubuntu FROM centos:7 # File Author / Maintainer MAINTAINER Sam Mohamed […]

How to access a remote django app that's running on docker

I’m currently trying to run a django website through a docker container on an AWS server using Tutum. I’ve looked at countless ways to access it through my web browser to no avail. I got my public IP like so- curl -s checkip.dyndns.org | sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//’ and set the […]

Should I dockerize different servers running on a single machine?

I want to make simple service that each user will have his own (simple and light) webserver. I want to use an AWS instance to do this. I understand that I can do that by starting Python’s SimpleHTTPserver (Proof of concept) multiple times on different ports, and that the number of servers I can have […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.