如何杀死 docker 主进程?为什么总是崩溃?
我在 Ubuntu(在 AWS 上)上安装了 docker。
前几天我启动了一个集群,并让它运行了一夜。 (一开始似乎没有任何问题。)
第二天回来,我做了一个docker ps
:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
所以我tail -f /var/log/syslog
:
Jul 14 11:25:20 server01 kernel: [8107974.094867] init: docker main process (23915) terminated with status 1
Jul 14 11:25:20 server01 kernel: [8107974.094876] init: docker main process ended, respawning
Jul 14 11:25:21 server01 kernel: [8107975.451554] init: docker main process (23961) terminated with status 1
Jul 14 11:25:21 server01 kernel: [8107975.451564] init: docker main process ended, respawning
系统日志看起来像这样,持续了几个小时。
所以我尝试me@server01:~$ sudo sysctl docker stop
:
sysctl: cannot stat /proc/sys/docker: No such file or directory
sysctl: cannot stat /proc/sys/stop: No such file or directory
然后我尝试me@server01:~$ sudo service docker stop
:
docker stop/waiting
然后sudo service docker start
:
docker start/running, process 11150
和tail -f /var/log/syslog
:
Jul 14 11:35:13 server01 kernel: [8108567.403154] init: docker main process (11082) terminated with status 1
Jul 14 11:36:46 server01 kernel: [8108660.693572] init: docker main process (11150) terminated with status 1
Jul 14 11:36:46 server01 kernel: [8108660.693581] init: docker main process ended, respawning
Jul 14 11:36:48 server01 kernel: [8108662.068454] init: docker main process (11200) terminated with status 1
Jul 14 11:36:48 server01 kernel: [8108662.068463] init: docker main process ended, respawning
我自以为聪明,sudo kill -SIGUSR1 $(cat /var/run/docker.pid)
然后……
sudo kill -SIGUSR1 $(cat /var/run/docker.pid)
sudo kill -SIGUSR1 $(cat /var/run/docker.pid)
sudo kill -SIGUSR1 $(cat /var/run/docker.pid)
只是为了更好的衡量......但是:
me@server01:~$ tail -f /var/log/syslog
Jul 14 11:56:07 server01 kernel: [8109821.948151] init: docker main process (17416) terminated with status 1
Jul 14 11:56:07 server01 kernel: [8109821.948160] init: docker main process ended, respawning
Jul 14 11:56:09 server01 kernel: [8109823.340658] init: docker main process (17469) terminated with status 1
Jul 14 11:56:09 server01 kernel: [8109823.340666] init: docker main process ended, respawning
等等...所以我又回到了开始的地方。
很遗憾,systemctl: command not found
docker run hello-world
:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
答案1
你想要的是systemctl
命令,而不是sysctl
。
systemctl stop docker
如果你想阻止它在启动时启动:
systemctl disable docker