This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.

Query the current container: docker container ls-all

Delete the current container: docker container rm mycentos

View the Docker list

docker ps

Enter the docker

docker attach 234kadhf234adf

Failed to start docker. Service: Unit not found. This error, so uninstall reinstall, record the pit dad process

First, check the docker you have installed

yum list installed |grep docker
Copy the code

After input, you can clearly see the console output

[root @ xxwlog docker] # yum list installed | grep docker docker - client. X86_64 2:1. 13.1-162. Git64e9980 el7. Centos Docker - common. X86_64 2:1. 13.1-162. Git64e9980 el7. CentosCopy the code

2. Uninstall the docker that has been installed

yum -y remove docker-ce.x86_64
Copy the code

The client will uninstall automatically. If not, continue to uninstall using yum -y remove

Input again yum list installed | grep docker see if deleted successfully

3. Install Docker in the correct posture

It is recommended to install Docker using the Repository of Docker Engineshequ community. So the Docker repository needs to be set up before installation. After that, you can install and update Docker from the repository.

3.1 Installing a Repository:

Install the required packages. Yum-utils provides yum-config-manager utility, and DEVICe-mapper-persistent-data and LVM2 require devicemapper to store drivers.

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Copy the code

3.2 Setting stable repository YUM source as Ali Docker source

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

3.3 Installation of the latest version in the first Installation mode

sudo yum install -y docker-ce
Copy the code

After the installation, skip 3.4

3.4 Installation of a specific version

To install a specific version of Docker Engine-Community, list the versions available in the REPo, then select and install

3.4.1 List installable versions

yum list docker-ce --showduplicates | sort -r
Copy the code

3.4.2 Installing the specified version

Yum install docker-ce-17.09.0.ce-y yum install docker-ce-17.09.0.ce-yCopy the code

3.5 Starting and Joining Enable Startup

sudo systemctl start docker
sudo systemctl enable docker
Copy the code

3.6 Verify whether the installation is successful (client and Service indicate that the installation and startup of Docker are successful)

docker version
Copy the code

3.7 Verifying the Startup

docker ps -a
Copy the code

3.8 Common Management Commands

Docker sudo systemctl restart docker sudo systemctl restart docker sudo systemctl restart docker sudo systemctl restart docker sudo systemctl restart docker sudo systemctl restart docker sudo systemctl restart docker sudo systemctl restart docker Docker sudo systemctl stop dockerCopy the code