[Cloud Native] Docker environment installation


Docker is an open source application container engine that allows developers to package their applications and dependencies into a portable container and then publish it to any popular Linux machine. It can also be virtualized. The container is completely sandboxed. Mechanisms will not have any interfaces with each other.

1. Installation preparation

1. Prerequisites

  • Docker can run on Windows, Mac, CentOS, Ubuntu and other operating systems

  • Docker supports the following CentOS versions:

    • CentOS 7 (64-bit)
    • CentOS 6.5 (64-bit) or higher
  • Currently, only the kernel in the CentOS distribution supports Docker

    • Docker runs on CentOS 7, which requires the system to be 64-bit and the system kernel version to be 3.10 or above.
    • Docker runs on CentOS-6.5 or higher version of CentOS, which requires the system to be 64-bit and the system kernel version to be 2.6.32-431 or higher.

2. Check the system kernel

The uname command is used to print current system-related information (kernel version number, hardware architecture, host name, operating system type, etc.).

uname -r

3. View the installed CentOS version information

cat /etc/redhat-release

2. Install docker on CentOS7

Official website: http://www.docker.com

Installation manual: https://docs.docker.com/install/linux/docker-ce/centos (CE-Community Edition)

1. Install the required software packages

yy-utils provides yy-config-manager related functions, device-mapper-persistent-data and lvm2 are required by the device mapper driver.

yum install -y yum-utils \
               device-mapper-persistent-data \
               lvm2

2. Set up docker to download the image

Recommended Alibaba Cloud download address

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

3. Update yum package index

After we update or configure the yum source, we usually use yum makecache to generate a cache. This command caches the software package information locally in advance to improve the speed of searching and installing software.

yum makecache fast

4. Install docker ce

yum install -y docker-ce

5. Start docker

systemctl start docker

6. Version verification

docker version

7. Set up startup

#查看服务是否自动启动(是:enabled | 否:disabled)
systemctl list-unit-files|grep docker.service 

#设置开机启动:如不是enabled可以运行如下命令设置自启动
systemctl enable docker
#重新加载服务配置
systemctl daemon-reload 

#如果希望不进行自启动,运行如下命令设置
systemctl disable docker
#重新加载服务配置
systemctl daemon-reload 

3. Uninstall

systemctl stop docker 
yum remove -y docker-ce
rm -rf /var/lib/docker

Supongo que te gusta

Origin blog.csdn.net/weixin_44816664/article/details/132773599
Recomendado
Clasificación