0

I tried to run docker image but have this problem. All the files are saved in the directory "my_new_docker_build". This is the Dockerfile:

FROM python:2.7.14
RUN mkdir /my_new_docker_build
WORKDIR /my_new_docker_build
ADD . /my_new_docker_build/
EXPOSE 5984
CMD ["python", "/my_new_docker_build/py_couchdb.py"]

And this is is my Python code cadded "py_couchdb.py":

from os import system

# Launch volume docker couchdb from command line
system("docker run --name my-couchdb -v /my/custom-config-dir:/opt/couchdb/etc/local.d -d couchdb")

# Coudchdb visible in open world
system("docker run -p 5984:5984 -d couchdb")
  • 1
    It looks like the script is expected to run on the host, not inside the container. – Florian Weimer Jan 05 '19 at 16:05
  • could you run manually inside container instead of `python` file and check logs? – PPShein Jan 05 '19 at 16:07
  • Hi Florian, thank you for your answer. Actually the scrips runs on the host, but I tried to lunch with docker... and it doesn't work... – enchantment Jan 05 '19 at 16:10
  • Hi PPShein, I'd like to use this script because I would like to extend it in a python project. – enchantment Jan 05 '19 at 16:24
  • 1
    That script needs to run on the host; it doesn't usually make sense to create a Docker image that will just launch other containers (it is much more difficult to run than just running `docker` commands on the host). It might be better run as a shell script than a Python script. – David Maze Jan 05 '19 at 16:38

0 Answers0