Hello Docker

Here a basic example that write "Hello docker" on your shell.

$ docker run alpine echo "Hello docker"
Unable to find image 'alpine:latest' locally
latest: Pulling from alpine
f58d61a874be: Pull complete 
Digest: sha256:41eb14107cd1c1a5b50c2cedc534d53e8c1904c5f9e81070426feb23b424b28e
Status: Downloaded newer image for alpine:latest
Hello docker

Let's understand what's happens!

We have asked docker to run Alpine1 and display "Hello docker" in the output.

So docker has pulled the latest Alpine image from the Docker registry, create a new container from this image, start the container run echo "Hello docker" inside this container and stop the containter.

Wow wow, wait, I don't understand what you are saying...

Let's have an overview of the architecture then

Architecture

Docker architecture

The Docker daemon

As shown in the diagram above, the Docker daemon runs on a host machine. The user does not directly interact with the daemon, but instead through the Docker client.

The Docker client

The Docker client, in the form of the docker binary, is the primary user interface to Docker. It accepts commands from the user and communicates back and forth with a Docker daemon.

To understand Docker’s internals let's go in deep with images, containers, registries

1. Alpine is a tiny Linux distribution