Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Docker and portainer in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How do I configure Docker and portainer in Linux? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

System requirements

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

Uninstall the old version

The old version of Docker is called docker or docker-engine, and 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 script to install automatically

Make sure the yum package is up to date.

$sudo yum update

Docker officially provides a convenient set of installation scripts in a test or development environment to simplify the installation process, which can be used 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 automatically prepares everything and installs the Edge version of Docker CE on the system.

3. Start docker

$sudo systemctl start docker

4. Verify whether the docker service starts successfully

$sudo docker run hello-world

The following figure shows that the startup is successful

Second, use portainer graphical interface tools 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 you can also deploy directly using binaries, and portainer is cross-platform, and both windows and linux can be deployed.

First, start the portainer container

There are two boot 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

The-d parameter runs in detach mode

-p Mapping container working port to physical machine port HOST port: container port

-v Mount (map) 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 portainer/portainer-H tcp://:

Where REMOTE_HOST is slave ip,REMOTE_PORT and slave port

II. Visit

Http:// host ip:9000

Set the user name and password after entering the page

Then select local or remote, where a single node local is used

After logging in, the following figure

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

After reading the above, have you mastered how to configure Docker and portainer in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report