Understanding Docker container commands
Before we dive into the more complex Docker commands, let's review and go into a little more detail on the commands we have used in previous chapters.
The basics
In Chapter 1, Docker Overview, we launched the most basic container of all, the hello-world
container, using the following command:
$ docker container run hello-world
As you may recall, this command pulls a 1.84
KB image from the Docker Hub. You can find the Docker Hub page for the image at https://hub.docker.com/images/hello-world/, and, as per the following Dockerfile
, it runs an executable called hello:
FROM scratch COPY hello / CMD ["/hello"]
The hello
executable prints the Hello from Docker!
text to the Terminal, and then the process exits. As you can see from the full message text in the following Terminal output, the hello
binary also lets you know exactly what steps have just occurred: