Docker CE install, uninstall and start stop

Docker CE install, uninstall and start stop

Outline

Docker Docker CE is released open source version Docker engine, this paper a simple record on CentOS Docker CE installation, and start-stop unloading

Prerequisites

  • System version: CentOS 7 maintenance releases, archived versions do not support
  • Must be turned on centos-extras additional software library (default: ON)
  • Recommended overlay2 file storage drive

ps: overlay2 storage drive configuration, see: Docker storage drive configuration overlayfs

Uninstall the old version Docker CE

If you have installed the old version of the Docker, it may affect the current version to install, so we need to first uninstall the old version of the Docker and its dependencies

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

A mounting Docker CE

Official offers three installation methods:

  1. Yum source is disposed Docker, installed through yum
  2. Download the RPM package, installation manual
  3. Test and development environment, you can use some script installation

Here we use a relatively simple first way to install with yum

1. Set the repository (during the initial installation)

Before installing Docker CE for the first time on the new host, you need to set Docker repository. After that, you can install and update Docker from the repository.

```
# 安装相关依赖
sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

# 设置稳定存储库
sudo yum-config-manager \
         --add-repo \
         https://download.docker.com/linux/centos/docker-ce.repo
```

2. Install Docker CE

sudo yum install docker-ce docker-ce-cli containerd.io

Second, uninstall Docker CE

# 卸载 Docker 包
sudo yum remove -y docker-ce

# 删除所有镜像、容器、数据卷或定制配置文件
sudo rm -rf /var/lib/docker

Third, start, restart, stop

1. Start Docker

systemctl start docker 或 service docker start

2. Restart Docker

systemctl restart docker 或 service docker restart

3. Close Docker

systemctl stop docker 或 service docker stop

4. boot from Kai

systemctl enable docker

5. Re-load configuration file

systemctl daemon-reload

Reference: Docker Product Manual / CentOS installation

Guess you like

Origin www.cnblogs.com/dukelu/p/12381157.html
Recommended