Tag: python

How to avoid reinstalling packages when building Docker image for Python projects?

My Dockerfile is something like FROM my/base ADD . /srv RUN pip install -r requirements.txt RUN python setup.py install ENTRYPOINT [“run_server”] Every time I build a new image, dependencies have to be reinstalled, which could be very slow in my region. One way I think of to cache packages that have been installed is to […]

Docker timeout for container?

For my dissertation at University, I’m working on a coding leaderboard system where users can compile / run untrusted code through temporary docker containers. The system seems to be working well so far, but one problem I’m facing is that when code for an infinite loop is submitted, E.g: while True: print “infinite loop” the […]

Can't install pip packages inside a docker container with Ubuntu

I’m following the fig guide to using docker with a python application, but when docker gets up to the command RUN pip install -r requirements.txt I get the following error message: Step 3 : RUN pip install -r requirements.txt —> Running in fe0b84217ad1 Collecting blinker==1.3 (from -r requirements.txt (line 1)) Retrying (Retry(total=4, connect=None, read=None, redirect=None)) […]

Python app does not print anything when running detached in docker

I have a Python (2.7) app which is started in my dockerfile: CMD [“python”,”main.py”] main.py prints some strings when it is started and goes into a loop afterwards: print “App started” while True: time.sleep(1) As long as I start the container with the -it flag, everything works as expected: $ docker run –name=myapp -it myappimage […]

How to update code from git to a Docker container

I have a Dockerfile trying to deploy a Django code to a container FROM ubuntu:latest MAINTAINER { myname } #RUN echo “deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) main universe” >> /etc/apt/sou$ RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tar git curl dialog wget net-tools nano buil$ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python python-dev python-distribute python-p$ RUN […]

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