- Hands-on repository to learn about Docker
- No installation need, just use the sandbox!
- Before you can setup Docker on your local machine, you need to setup Windows Subsystem for Linux (WSL) in order to install Docker. See WSL installation guide
- Install Docker See Docker installation guide
-
Git clone this repository in Docker Sandbox.
-
cd
into/learn_docker
. -
Build Docker image with the following command
docker build -t hello-docker .
Don't forget to put the period at the end of the command! Wait a couple of seconds before the image is completely build.
-
Check whether the image has been build with
docker image ls
The following output should shown
REPOSITORY TAG IMAGE ID CREATED SIZE hello_docker latest 5c8a423dfed9 16 minutes ago 222MB
-
Spin the new container from the image with
docker run hello_docker
-
The following output should shown
hello wei hello wei hello wei
-
Show all container with command
docker ps -a
Output will show the existing container
CONTAINER ID IMAGE COMMAND CREATED 8a203ca5aa3d hello_docker "/bin/sh -c 'python …" 5 seconds
-
To delete the container, run command
docker rm 8a203ca5aa3d
docker rm <container_id>
-
After than you can delete the image with
docker rmi 5c8a423dfed9
docker rmi <image_id>
NOTE: To delete image, you need to delete the container first (due to container is the runnable instance of image)
- Congratulation you has successfully build with Docker! 🐳🎉
- Deploying REST API with FastAPI, wrapped with Docker to ECR with Fargate on ECS see tutorial