01. Docker basic environment construction

Table of contents

1 Introduction

2. About Docker

2.1, a few terms

2.2. The value of Docker containerization

3. Build the basic environment

3.1. Install VMware

3.2. Install Docker

3.3. Start

3.4. Verify the Docker environment

4. Summary


1 Introduction

Here we will learn some skills and knowledge about Docker, so first of all we should have a basic understanding of Docker and build a basic environment by hand.

2. About Docker

Docker is an open source virtualization container engine. We can package their applications and dependencies into a portable container, and then publish them to the Linux environment for virtualization management. Docker's virtualized containers completely use the "sandbox" mechanism and are logically isolated from each other.

2.1, a few terms

There are several important terms about Docker:

  • Docker client. Usually refers to the command line tool provided by Docker, which is the most basic user interface of Docker. Users submit Docker instructions through the Docker client, and the Docker daemon receives and executes the instructions. Docker also has graphical client tools.
  • Docker daemon (Daemon). Running Docker on the Docker host is actually running the Docker daemon. Users do not interact directly with the Docker daemon, but rather through commands from the Docker client.
  • Docker image (Image). A Docker image is a read-only template. For example, a Docker image can contain a CentOS operating system, a MySQL database, and a Tomcat application server. Docker images are used to create Docker containers. Docker provides an easy way to build a new image or update an existing image. Users can also download Docker images created by others from the mirror repository.
  • Docker container (Container). Docker containers can be created through Docker images. Docker can store anything, and the container can keep these things necessary to run an application. Think of a Docker container as a virtual machine. Docker containers can be run, started, stopped, moved and deleted. Each container is a separate, secure application platform. Docker containers are the running components of Docker.
  • Mirror warehouse (Repository). Docker's mirror warehouse is used to save Docker images, which can be public storage places or private storage places.
    • The public registry is provided by Docker Hub, which provides a collection of existing images that users can use. Images in these collections can be created by you or created by others.
    • A private mirror warehouse needs to be built in a private environment, for example, in an enterprise intranet. Harbor is a typical private mirror warehouse.

The mutual architecture is shown in the figure:

2.2. The value of Docker containerization

Docker virtualized containers have the following two aspects of value.

  1. From the perspective of the system architecture: Docker can easily support and implement the microservice architecture, so that it is more convenient and flexible to realize the change of the architecture and the expansion of the system. At the same time, Docker virtualized containers are helpful to the implementation of DevOps, which can greatly improve development efficiency and accelerate iteration.
  2. From the perspective of the underlying foundation: the use of Docker virtualization container technology can easily realize the transplantation of the system, help realize the migration of enterprise applications to the cloud, and enable the dynamic migration of applications between the self-owned data center and the cloud.

3. Build the basic environment

To install the basic environment, the following things are used here. Since I use a windows system and have limited funds, I cannot purchase a linux server (please feel free to local tyrants). So I installed a virtual machine on my local computer to run my docker environment. Although windows can also support the docker environment, it is not friendly enough so far.

Required software:

  1. VMware-workstation-full-17.0.0-20800274.exe. A virtual machine manager for installing the Centos operating system environment.
  2. CentOS-7-x86_64-Everything-2009.iso. CentOS7 operating system image. From now on it will be the host machine where Docker will run.

Add the software download address:

Download VMware Workstation Pro

Index of /centos/7.9.2009/isos/x86_64/

3.1. Install VMware

The detailed installation process is omitted. Basically, you can find a tutorial anywhere on the Internet. Start the virtual machine after installation:

A few points to pay attention to are:

In order to facilitate our docker operation, we turn off the firewall and Selinux.

systemctl stop firewalld.service

systemctl disable firewalld.service

At the same time, it is necessary to install the image in the external network environment, and select the NAT mode for the virtual machine.

3.2. Install Docker

Install docker using yum. Note here that you need to use the root account. There is no specified version of docker here, and the latest version is installed by default.

yum install -y docker

Specify the docker version, the following command will install docker 1.13.1 version:

yum install -y docker-1.13.1

After the installation is complete:

Check the docker version:

docker version

3.3. Start

Start the docker service.

systemctl start docker.service
systemctl enable docker.service

After execution, check the docker version:

We can see the specific Client and Server versions.

3.4. Verify the Docker environment

Run the command to view detailed information about the running status of Docker.

docker info

Among them, Registry is the mirror address of the warehouse, and the official Docker Hub address is used here.

We can also view the running status of Docker through the system service command.

systemctl status docker

4. Summary

At this point, the basic environment of the entire docker has been built, and most of them are in the next step. In the next article, we will deploy our first application in Docker to try it out.

Guess you like

Origin blog.csdn.net/p793049488/article/details/131746847