Docker installation and visual graphical interface installation

The main function of Dockerd is to play the role of a "container" (code + environment), which solves the problem of version incompatibility caused by cross-environment migration of software. Using the sandbox mechanism, there is no interface between them, and the performance overhead is extremely low.

Docker's architecture:

  • Image (image): Docker image, which is equivalent to a root file system. A mirror is equivalent to a class in java, which is a template, and one mirror can generate multiple containers.
    (Mirror is a lightweight, executable independent software package used to package the software operating environment and software developed based on the environment. It contains everything needed to run a certain software, including code, runtime, library , environment variables and configuration files.)

  • Container: The relationship between mirror and container is like the relationship between class and object. Mirror is a static definition, and container is an entity when mirroring is running. Containers can be created, started, stopped, deleted, suspended, etc.
    (Docker uses containers to run one or a group of applications independently. A container is a running instance created by a mirror. You can think of a container as a simple version of the Linux operating environment, including the applications running in it. Docker starts in seconds. The container only retains the kernel, and removes all irrelevant hardware, networks, printers, etc., so it runs fast.)

  • Warehouse (repository): The warehouse can be regarded as a code control center for storing images.

Docker installation

Uninstall the old version that comes with the system

sudo apt-get remove docker docker-engine docker.io containerd runc

Get the latest software source

sudo apt-get update

Install apt dependencies

sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common

Install several tools

apt-get install ca-certificates curl gnupg lsb-release

Install the GPG certificate and use the mirror source of Alibaba Cloud

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

Download repository files

sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

Install the docker software

sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo apt-get install docker-compose-plugin

GUI Portainer

$ docker volume create portainer_data
$ docker run --name portainer
 -d -p 8000:8000 -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock
-v portainer_data:/data portainer/portainer

打开localhost:9000

Register for the first time use.

Related resources of visual management docker:Please add a picture description

Set up the graphical interface Portainer can be started after booting and can directly access docker through the browser localhost:9000/:

1、设置docker开机自启动
systemctl disable docker.service

2、设置Portainer对应的容器开机自启动
docker update --restart=always <CONTAINER ID>

After setting the self-startup, you can access the relevant resources in localhost:9000/management Dcoker through the browser after booting up.

Guess you like

Origin blog.csdn.net/qq_45104014/article/details/127866898