Consider the following setup.
Precondition: have a healthy image i.e. service starts up.
E.g.
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",
name="ingreedy_service",
detach=True,
ports={'5000': 5000})
print(ingreedy.id)
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?