Home > Operation and Maintenance > Docker > What to do if the docker service cannot be restarted

What to do if the docker service cannot be restarted

王林
Release: 2020-05-20 11:13:29
Original
3886 people have browsed it

What to do if the docker service cannot be restarted

The specific solutions are as follows:

Delete the docker installation package

(Note: When doing the following operations, be sure to do so in advance Back up, otherwise all the data in your docker container will be lost)

rm -rf /var/lib/docker
Copy after login

Then reinstall docker

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce
Copy after login

To avoid that the docker service still cannot be restarted, we make the following configuration:

Configure DOCKER_HOST

sudo vim /etc/profile.d/docker.sh
Copy after login

Add the following content:

export DOCKER_HOST=tcp://localhost:2375
Copy after login

Make the configuration file effective

source /etc/profile
source /etc/bashrc
Copy after login

Configure startup file

sudo vim /lib/systemd/system/docker.service
Copy after login

Modify the following statement

ExecStart=/usr/bin/dockerd -H unix://
Copy after login

Modify it to:

ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:7654
Copy after login

Reload configuration and restart

sudo systemctl daemon-reload
sudo systemctl restart docker.service
Copy after login

Recommended tutorial:docker tutorial

The above is the detailed content of What to do if the docker service cannot be restarted. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template