每次我启动我的 Lubuntu 16.04 笔记本电脑时,我都可以看到我有一个正在运行的 docker 容器:
$ ps -ef | grep docker
root 1724 1 3 21:17 ? 00:01:30 /usr/bin/dockerd -H fd://
root 1774 1724 0 21:17 ? 00:00:04 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
root 4750 1774 0 21:17 ? 00:00:00 docker-containerd-shim 72541a4648b890132985daf2357d1130b8b5208cf12ede607b93ab2987629719 /var/run/docker/libcontainerd/72541a4648b890132985daf2357d1130b8b5208cf12ede607b93ab2987629719 docker-runc
stephane 10755 1793 0 22:07 pts/0 00:00:00 grep docker
它在端口 80 上为 Jenkins 应用程序提供服务,并在浏览器中请求 localhost/
重定向到 http://localhost/login?from=%2F
并显示 Jenkins 警告页面:
Unlock Jenkins
To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:
wget 请求显示:
$ wget localhost/
--2017-05-23 22:09:55-- http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-05-23 22:09:55 ERROR 403: Forbidden.
我怎么知道哪个服务正在启动这个 docker 进程?
我查看了/etc/init.d/
目录:
$ l /etc/init.d/
alsa-utils* checkroot-bootclean.sh* halt* mattermostd* nginxd* rc* single* uuidd*
anacron* checkroot.sh* hostname.sh* mountall-bootclean.sh* ntp* rc.local* skeleton whoopsie*
apachedsd* console-setup* httpd* mountall.sh* ondemand* rcS* ssh* x11-common*
apparmor* cron* hwclock.sh* mountdevsubfs.sh* openvpn* README tomcatd*
apport* cups* irqbalance* mountkernfs.sh* php-fpm* reboot* udev*
avahi-daemon* cups-browsed* keyboardd* mountnfs-bootclean.sh* plymouth* redis* ufw*
bluetooth* dbus* killprocs* mountnfs.sh* plymouth-log* resolvconf* umountfs*
bootmisc.sh* docker* kmod* mysqld* postfix* rsync* umountnfs.sh*
cgroupfs-mount* dropboxd* lightdm* networking* pppd-dns* rsyslog* umountroot*
checkfs.sh* grub-common* mariadbd* network-manager* procps* sendsigs* urandom*
/etc/init.d/docker
是我的并将其从目录中删除,重新启动仍然会出现正在运行的 docker 进程。
我删除了/etc/init.d/docker
文件,重启,有一个docker进程:
$ ps -ef | grep docker
root 1560 1 5 22:15 ? 00:00:06 /usr/bin/dockerd -H fd://
root 1645 1560 0 22:15 ? 00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
root 4644 1645 0 22:15 ? 00:00:00 docker-containerd-shim 069db46cca05d43c35f05ff50aaa836507cbf69e4e3d9443b6b859d0edb5b076 /var/run/docker/libcontainerd/069db46cca05d43c35f05ff50aaa836507cbf69e4e3d9443b6b859d0edb5b076 docker-runc
stephane 5520 1741 0 22:17 pts/0 00:00:00 grep docker
所以我在所有这些文件中查找任何 docker,但没有找到名为 docker 的内容:
$ cd /etc/init.d/
[stephane@stephane-ThinkPad-X301 init.d]
$ grep.sh docker
[stephane@stephane-ThinkPad-X301 init.d]
每次我启动我的笔记本电脑时,这个 docker 进程都会出现,即使是在离线时。
什么启动了这个 docker 进程?
最佳答案
Lubuntu 16.04 随附 systemd by default .在某些时候,您一定已经在 docker 中启动了一个 jenkins 实例 - 很难说出最初是什么启动这个过程的。但是,systemd
将是当前导致它启动的原因。为了阻止它运行,请运行以下命令:
systemctl status docker
<- 找出 systemctl
认为 docker 正在运行。
它可能会显示如下内容:
● docker.service - Docker 应用程序容器引擎
已加载:已加载(/usr/lib/systemd/system/docker.service;已启用;供应商预设:已禁用)
事件:事件(运行)自 Sun 2017-05-21 22:59:46 EDT; 1 天 17 小时前
文档:http://docs.docker.com
主 PID:1314(dockerd-current)
任务:14(限制:8192)
C组:/system.slice/docker.service
└─1314/usr/bin/dockerd-current --add-runtime oci=/usr/libexec/docker/docker-runc-current --default-runtime=oci --containerd/run/containerd.sock --exec-选择 native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --selinux-enabled --log-driver=journald
要停止它,请运行 systemctl stop docker
,然后运行 systemctl disable docker
。如果这不起作用,作为最后的手段,您可以运行 systemctl mask docker
。
关于linux - 是什么在我的笔记本电脑上启动这个 docker 进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44144422/