As a lightweight container technology, Docker makes the process of software development, testing and deployment more efficient and convenient. For novices, the concept and commands of Docker may be a bit complicated, so this article will help you quickly understand and get started with the basic operations of Docker through a quick guide.
- Basic Introduction to Docker
- Docker Quick Start Guide (this article)
- Docker installation of common development environment
Basic Concepts of Docker
- Image: The application template in Docker that includes all the environments and configurations needed to run the application.
- Container: A running instance of an image; it is where the application actually runs.
- Dockerfile: A file that describes how to build an image, containing the necessary commands and instructions.
Installing Docker
There are some differences in installing Docker on macOS, Windows, and Linux, but you can download the installation package directly from the Docker official website. After installation, you can check the Docker version and verify the installation by running the following command:
1 | docker --version |
Quick Overview of Basic Commands
Download a Docker image.
1 | docker pull [Image] |
View currently running containers
1 | docker ps |
Stop the specified container
1 | docker stop [ContainerID] |
Delete a stopped container
1 | docker rm [ContainerID] |
Delete the specified image
1 | docker rmi [ImageName] |
The basic structure of a Dockerfile
1 | # Using a base image |
Building and running a custom image
Create an image
1 | docker build -t myapp . |
After the image is built, run
1 | docker run myapp |
If you have any questions, feel free to leave a comment so we can discuss and learn together
If you found this article helpful, please respond with an emoji, leave a comment, or share it with more friends Thank you