Consider the following setup.

Precondition: have a healthy image i.e. service starts up.


docker run -d IMAGE

Then, with the Python plugin docker-py, consider the following code which should be equivalent, only with added port mapping.

ingreedy = client.containers.create("openfoodbroker/ingreedy.service", 
                                     ports={'5000': 5000})

This code prints out the container ID and I can remove the container using docker rm -f, but:

  • port 5000 is not open;
  • the container does not show up on docker ps

Any ideas?


docker.containers.create() is documented to:

Create a container without starting it. Similar to docker create.

Either call docker.containers.run() instead, or given the container object returned from create(), call ingreedy.start().

(docker ps by default only shows running containers; docker ps -a should show the container in a "created" state.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.