A Simple Method to Build Docker Environment

  • 2021-09-25 00:03:14
  • OfStack

First understand what Docker is under 1.

Docker is a container engine that can be used to deploy applications. With Docker, code can be delivered, tested, and deployed quickly, with strong portability.

Docker mainly includes three basic concepts: mirror, container and warehouse

Mirroring: A template for creating an Docker container, similar to the windows or linux system image that we downloaded when we installed the virtual machine.

Container: It is one or one group of applications running independently, and it is an entity at mirror runtime. Similar to installing an windows system on virtual machine software, the running system is a container. Containers can be created, started, stopped, deleted, paused, and so on.

Warehouse: It is used to store mirrors

How to install Docker?

Take centos system as an example:

{If you don't have an linux server, you can install a virtual machine and an linux system on this machine, or buy a server from Alibaba Cloud or Tencent Cloud. If you are beginners, it will only cost 10 yuan a year for new users to buy a low configuration}

Use the following command to set up a stable warehouse.


$ sudo yum-config-manager \
 --add-repo \
 https://download.docker.com/linux/centos/docker-ce.repo

Install the latest versions of Docker Engine-Community and containerd using the command:


sudo yum install docker-ce docker-ce-cli containerd.io

Start Docker:


sudo systemctl start docker

Verify that Docker Engine-Community is installed correctly by running the hello-world image.


sudo docker run hello-world

At this point, the environment installation of Docker is in paragraph 1. If other linux systems want to install Docker, you can refer to the steps on the rookie tutorial.

Next, you can use Docker to build MySQL, Tomcat, Nginx and other environments, and be proficient in some common commands and operations of docker. Docker is also used in the environmental deployment of some enterprises. It is still beneficial to do tests and understand some knowledge in this respect. If Docker is upgraded and advanced, it can be learned in combination with Docker + Kubernetes (k8s for short).


Related articles: