Docker and portainer configuration methods under Linux

Docker and portainer configuration methods under Linux

1. Install and use Docer CE

This article takes CentOS 7 as an example to install the Docker CE version. There are two versions of Docker, the community version CE and the enterprise version EE. The study here takes the CE version as an example.

Two installation methods are available: 1. Install using yum, 2. Automatically install using a script

System requirements

Docker CE supports the 64-bit version of CentOS 7 and requires a kernel version no less than 3.10. CentOS 7 meets the minimum kernel requirements, but due to the relatively low kernel version, some functions (such as the overlay2 storage layer driver) cannot be used, and some functions may be unstable.

Uninstall old versions

The old version of Docker is called docker or docker-engine . Use the following command to uninstall the old version:

$ sudo yum remove docker \
     docker-client \
     docker-client-latest \
     docker-common \
     docker-latest \
     docker-latest-logrotate \
     docker-logrotate \
     docker-selinux \
     docker-engine-selinux \
     docker-engine

1. Install using yum

Install some necessary system tools:

$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2

Add software source information:

$ sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Update the yum cache:

$ sudo yum makecache fast

Install Docker-ce:

$ sudo yum -y install docker-ce

2. Use scripts to install automatically

Make sure the yum package is updated to the latest version.

$ sudo yum update

In order to simplify the installation process in a test or development environment, Docker officially provides a set of convenient installation scripts, which can be used to install on CentOS systems:

$ curl -fsSL get.docker.com -o get-docker.sh 
$ sudo sh get-docker.sh --mirror Aliyun

After executing this command, the script will automatically prepare everything and install the Edge version of Docker CE on the system.

3. Start Docker

$ sudo systemctl start docker

4. Verify whether the Docker service is started successfully

$ sudo docker run hello-world

The following figure appears to indicate successful startup

2. Use portainer graphical interface tool to manage docker

Portainer is a lightweight Docker environment management UI that can manage docker host and docker swarm. The reason why it is lightweight is that there is only one container for deployment, and it can also be deployed directly using binary programs. Moreover, portainer is cross-platform and can be deployed on both Windows and Linux.

1. Start the portainer container

There are two startup modes to choose from

1. Single-node operation mode

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

-d parameter runs in detach mode
-p maps the container working port to the physical machine port HOST port: container port
-v mounts (maps) the container directory to the corresponding location of the physical machine. Here, the communication method is specified as sock
portainer/portainer is the image name

2. Multi-node: portainner also supports TCP communication

docker run -d -p 9000:9000 portainer/portainer -H tcp://<REMOTE_HOST>:<REMOTE_PORT>

Where REMOTE_HOST is the slave ip, REMOTE_PORT is the slave port

2. Visit

http://host ip:9000

After entering the page, set your username and password

Then select local or remote. Here we use single node local.

After logging in, the following figure is shown

Summarize

The above is the configuration method of Docker and portainer under Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Deployment and Chinese translation of the docker visualization tool Portainer
  • Tutorial on using portainer to connect to remote docker
  • The latest super detailed graphic tutorial of installing Kali Linux on virtual machine VMware
  • Kali Linux installation VMware tools installation process and VM installation vmtools button gray
  • How to check the version of Kali Linux system
  • How to switch Python versions in Kali
  • How to install docker and portainer in kali

<<:  How to configure MySQL master-slave synchronization in Ubuntu 16.04

>>:  JS 9 Promise Interview Questions

Recommend

vue+tp5 realizes simple login function

This article example shares the specific code of ...

vue cli3 implements the steps of packaging by environment

The vue project built with cli3 is known as a zer...

Google Translate Tool: Quickly implement multilingual websites

Google China has released a translation tool that ...

How to set up FTP server in CentOS7

FTP is mainly used for file transfer, and is gene...

Use vertical-align to align input and img

Putting input and img on the same line, the img ta...

SQL implementation of LeetCode (175. Joining two tables)

[LeetCode] 175.Combine Two Tables Table: Person +...

Native JS object-oriented typing game

This article shares the specific code of JS objec...

JavaScript singleton mode to implement custom pop-up box

This article shares the specific code of JavaScri...

Complete step record of Vue encapsulation of general table components

Table of contents Preface Why do we need to encap...

The most complete 50 Mysql database query exercises

This database query statement is one of 50 databa...

In-depth explanation of MySQL stored procedures (in, out, inout)

1. Introduction It has been supported since versi...

How to install rabbitmq-server using yum on centos

Socat needs to be installed before installing rab...

Docker container custom hosts network access operation

Adding the extra_hosts keyword in docker-compose....