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

What to do if the docker service cannot be restarted

王林
王林Original
2020-05-20 11:13:293832browse

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

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

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

Add the following content:

export DOCKER_HOST=tcp://localhost:2375

Make the configuration file effective

source /etc/profile
source /etc/bashrc

Configure startup file

sudo vim /lib/systemd/system/docker.service

Modify the following statement

ExecStart=/usr/bin/dockerd -H unix://

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

Reload configuration and restart

sudo systemctl daemon-reload
sudo systemctl restart docker.service

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!

Statement:
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