Tag: python

Do I always need to rebuild docker in order to install new pip packages?

I noticed when I try to use docker ( Fig mainly ) to install a new pip package, it does not actually maintain on the system. I must rebuild and install the pip package from requirements.txt I tried running fig run web pip install django and I see the package install, but every time I […]

no route to host between 2 docker containers in same host

I have two docker containers which runs on the same host(centos 6 server). container 1 >> my web application (Ports mapped to some random port of host) container 2 >> python selenium testscripts ( Runs headless Firefox) My Test cases fails saying problem loading page Basically the issue is that the second container or any […]

“python setup.py install” does not work from Dockerfile but i can go in the container and do the same..any pointers?

I am getting this error while doing “sudo docker build .” > (3:58:02 PM) njain: tep 28 : RUN python /tmp/setup.py install && > python /tmp/buzz/scripts/setuprabbit.py —> Running in e7afcbda3c75 > Traceback (most recent call last): File “/tmp/setup.py”, line 7, in > <module> > long_description=open(‘README.md’, ‘r’).read(), IOError: [Errno 2] No such file or directory: ‘README.md’ […]

PyCharm add remote Python interpreter inside the Docker

So I have set up a docker on my laptop. I’m using Boot2Docker so I have one level of indirection to access the docker. In PyCharm, I can set a remote python interpreter via SSH but I’m not sure how to do it for dockers that can only be accessed via Boot2Docker?

How does one detect if one is running within a docker container within Python?

I was trying to find out if my script was running inside a docker container or not within the python script. Something like: if inside_docker(): do_stuff() else: do_some_other_stuff() to do this the only hacky way I found out how to do it is that I can inspect the hostname (with platform.node()) and if the hostname […]

Custom mesos executor for docker in chronos

I am trying to configure Chronos to use custom mesos–docker executor present at https://github.com/mesosphere/mesos-docker/ . Everytime I try to run the command it fails. I created the task using below command echo ‘{“schedule”:”R/2014-02-14T00:52:00Z/PT90M”, “name”:”testing_docker_executor”, “command”:”docker_ubuntu_test /root/docker_test.sh”, “epsilon”:”PT15M”, “executor”:”/var/lib/mesos/executors/docker” }’ | http POST localhost:8080/scheduler/iso8601 I also configured logging in executor and below are the logs I […]

Why isn't pyenv finding openssl shared libraries under Alpine Linux?

I’m trying to build a docker image from gliderlabs/alpine:latest containing only pyenv and it’s dependencies. I would like for this container to be able to install and execute an arbitrary interpreter through pyenv. Initial Attempt I began with the following Dockerfile: FROM gliderlabs/alpine:latest RUN apk-install curl \ ca-certificates \ bash \ git \ openssl-dev \ […]

How to use a python library that is constantly changing in a docker image or new container?

I organize my code in a python package (usually in a virtual environment like virtualenv and/or conda) and then usually call: python <path_to/my_project/setup.py> develop so that I can use the most recent version of my code. Since I develop mostly statistical or machine learning algorithms, I prototype a lot and change my code daily. However, […]

How to copy a file from container to host using copy in docker-py

I am using docker-py. I want to copy a file from docker container to host machine. From docker-py documentation: copy Identical to the docker cp command. Get files/folders from the container. Params: container (str): The container to copy from resource (str): The path within the container Returns (str): The contents of the file as a […]

How to bind volumes in docker-py?

I think this used to work up to a few months ago. The regular commandline docker: >> docker run –name ‘mycontainer’ -d -v ‘/new’ ubuntu /bin/bash -c ‘touch /new/hello.txt’ >> docker run –volumes-from mycontainer ubuntu /bin/bash -c ‘ls new’ >> hello.txt works as expected but I cannot get this to work in docker-py: from docker […]

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