Running your first container
You can create Docker containers out of Docker container images. While we will discuss container images and their architecture in the following chapters, an excellent way to visualize them is as a copy of all files, application libraries, and dependencies comprising your application environment, similar to a virtual machine image.
To run a Docker container, we can use the docker run
command, which has the following structure:
$ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
Let’s look at the docker run
command and its variations using working examples.
In its simplest form, you can use docker run
by simply typing the following:
$ docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 0e03bdcc26d7: Pull complete Digest: sha256:e7c70bb24b462baa86c102610182e3efcb12a04854e8c582 838d92970a09f323 Status: Downloaded newer image for hello-world:latest Hello from...