This is a post for myself to take notes on Udemy's course "Complete Docker and Kubernetes Course - learn all core Docker features including Dockerfiles and Docker Compose"
Table of Contents
- Download Docker
- Run hello-world image in Docker
- Run ubuntu image in Docker
Download Docker
- I have a mac, so I installed it from this link: https://docs.docker.com/desktop/setup/install/mac-install/
- A docker.dmg file is downloaded. After it's done downloading, double click it and move it in the Applications folder.
- Run:
docker --help. If it shows the following then you installed docker successfully.
Note: if it returns:
zsh: command not found: docker
then it may not be pointed correctly in the path. Run:
echo $PATH to see if docker is present. If not, run:
export PATH="/Applications/Docker.app/Contents/Resources/bin:$PATH" and try docker --help again.
Run hello-world image in Docker
When learning a new programming language, people often start with a Hello World program. In Docker, we do something similar using the hello-world container.
Running this container helps verify that Docker is installed correctly and introduces the basic components of Docker.
Step 1: The Command
We start with the following command in the terminal:
docker run hello-world
Step 2: Actors
Before we walk through the steps, it helps to understand the actors involved in the process.
1. Docker Client (CLI)
The Docker client is the program you interact with in the terminal.
Example:
docker run
docker ps
docker build
The client’s job is to:
- receive commands from the user
- send requests to the Docker daemon
- display the results back to the terminal
Think of it like a remote control for Docker.
2. Docker Daemon (Docker Engine)
The Docker daemon is the background service that does the real work. It:
- downloads images
- builds containers
- starts containers
- manages networks and storage
The daemon is always running in the background once Docker is installed.
3. Docker Registry (Docker Hub)
Docker images are stored in a registry. The default public registry is Docker Hub. Docker Hub contains thousands of images such as:
- nginx
- redis
- postgres
- hello-world
If Docker can't find an image locally, it will download it from Docker Hub.
4. Docker Image
An image is a template used to create containers. You can think of it as a blueprint for an application. Images are read-only and contain:
- application code
- runtime
- dependencies
5. Docker Container
A container is a running instance of an image.
Relationship:
- Image → Blueprint
- Container → Running program
Multiple containers can be created from the same image.
Step 3 — What Happens When You Run the Command
- You type the command in the terminal.
docker run hello-world. - The Docker client sends this request to the Docker daemon.
- The Docker daemon checks whether the hello-world image already exists on your computer.
- If the image exists locally, it'll use local image. If not, the daemon will pull image from Docker Hub.
- The Docker daemon pulls (downloads) the image from Docker Hub. Once downloaded, the image is stored locally. You might see output like:
Pulling from library/hello-world
Digest: sha256:...
Status: Downloaded newer image
- After the image is available locally, Docker creates a new container from that image. Think of it like:
Image = blueprint
Container = running machine
- The hello-world container runs a very small program. Its only job is to print the following message:
Hello from Docker!
This message shows that your installation appears to be working correctly.
Once the message is printed, the container finishes execution.
- The container exits automatically. You can confirm there are no running containers with:
docker ps
Output will be empty.
Run ubuntu image in Docker
Step 1: The Command
Run the command in the terminal:
docker run ubuntu
Notice that nothing is done and the container is stopped after running /bin/bash. Why?

This is because there was no command that was executed inside of this ubuntu container. We can check that the ubuntu container is exited by running either of the following to see docker container run history (both yields the same results):
docker ps -a
docker container ls -a
Then how do we start ubuntu and let it keep running? The following command does the trick:
docker run -it ubuntu // "i" - interactive mode (user can key in input)
// "t" - pseudo-TTY (terminal)
Now you're inside the ubuntu container! You can treat it as a Linux shell and can run any Linux command.

To exit the ubuntu container, run exit. As soon as you exit, the process bash of ubuntu gets terminated, and the container will stop running.
Additional Information:
- busybox is smallest Linux image with minimal Linux utilities
- alpine is based on top of busybox



Top comments (0)