Hello Docker 1
Docker has been the technology that has changed the way of how software can be developed and deployed.
This article tries to provide a simple example of how to get Docker running in your machine (Mac / Linux / Windows).
1. Download and install Docker
- Go to https://www.docker.com/get-started
- Choose the Docker Desktop for your machine type
- Download and install Docker Desktop in your machine by following the instructions
2. Run a Hello World container
To test if Docker is working in you machine, the best way is to simply run a “Hello World” container.
On your command line, do this.
$ docker run busybox echo “Hello World”
If you have installed Docker properly, you should see an output like this
$ docker run busybox echo “hello world”
Unable to find image ‘busybox:latest’ locally
latest: Pulling from library/busybox
ea97eb0eb3ec: Pull complete
Digest: sha256:bde48e1751173b709090c2539fdf12d6ba64e88ec7a4301591227ce925f3c678
Status: Downloaded newer image for busybox:latest
hello world
Congratulations, you not only have Docker installed but also run your first container successfully!
In Depth: What is happening behind the scene?
Here is what has happened behind the scene when you run the “Hello World” program.
- You used the Docker client command line to issue a run command to the Docker Daemon. In the command, you specified the image (busybox) to run and the command to execute in the container.
- Docker Daemon received the command from the Docker Client and tried to look for the busybox image in the local machine, but it didn’t find it.
Unable to find image ‘busybox:latest’ locally
3. Docker Daemon tried to download the busybox image from the Docker Hub to your local machine
latest: Pulling from library/busybox
ea97eb0eb3ec: Pull complete
Digest: sha256:bde48e1751173b709090c2539fdf12d6ba64e88ec7a4301591227ce925f3c678
Status: Downloaded newer image for busybox:latest
4. Docker Daemon ran a container based on the downloaded busybox image
5. The Docker container executed your command successfully
hello world