- 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.
-
cdinto/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 lsThe 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 -aOutput 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 8a203ca5aa3ddocker rm <container_id> -
After than you can delete the image with
docker rmi 5c8a423dfed9docker 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