I find when using docker run
I sometimes don't need to add a "command", while sometimes a "command" is a must. E.g. when running the ubuntu
image a command isn't required:
# docker run ubuntu
#
While when running mstormo/suse
:
# docker run mstormo/suse
Error response from daemon: No command specified
# docker run mstormo/suse bash
#
So is this related to the specified image?
The docker run command creates a container from a given image and starts the container using a given command. It is one of the first commands you should become familiar with when starting to work with Docker.
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 docker push command takes the name of the image. It will know where to push our Docker image by looking at the image name because the name contains the registry location.
To run an image inside of a container, we use the docker run command. The docker run command requires one parameter and that is the image name.
The Docker image can optionally include a default command to run when none is given on the command-line.
If no default command is given, then it has to be provided by the caller.
If you look at the Dockerfile for ubuntu, they have
CMD ["/bin/bash"]
So if you don't say otherwise, it will run bash
for you.
No such setting in mstormo/suse.
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