I have a Docker container running, and I want to create another one similar to it. How can I find out what command was used to start the container? There's docker inspect, but I'd have to go through and look at each of the config options one by one.
Edit: I want to get the full command used to start the container, including environment variables, links, volumes, etc. For example:
docker run -d --name foo -v /bar:/bar --link baz:baz -e DEBUG=True image bash
You can then use the docker container start (or shorthand: docker start ) command to start the container at any point. This is useful when you want to set up a container configuration ahead of time so that it is ready to start when you need it. The initial status of the new container is created .
The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command. That is, docker run is equivalent to the API /containers/create then /containers/(id)/start .
The following will show the environment variables, the ENTRYPOINT of the Dockerfile, the CMDLINE, the volumes from, the volumes, the links.
docker inspect -f '{{ .Config.Env}} {{ .Config.Entrypoint}} {{ .Config.Cmd}} {{ .VolumesFrom}} {{.Volumes}} {{ .HostConfig.links}}' container_id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With