Skip to content
Advertisement

What starts this docker process on my laptop?

Every time I boot up my Lubuntu 16.04 laptop I can see I have a running docker container:

$ 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

It serves a Jenkins application on the port 80 and requesting localhost/ in the browser redirects to http://localhost/login?from=%2F and shows a Jenkins warning page:

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:

A wget request shows:

$ 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.

How can I know which service is firing up this docker process ?

I looked in the /etc/init.d/ directory:

$ 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*

The /etc/init.d/docker is mine and removing it from the directory, a reboot still comes up with a running docker process.

I removed the /etc/init.d/docker file, rebooted, and there is a docker process:

$ 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

So I looked up for anything docker in all these files, but found nothing named docker:

$ cd /etc/init.d/
[stephane@stephane-ThinkPad-X301 init.d]
$ grep.sh docker
[stephane@stephane-ThinkPad-X301 init.d]

This docker process is there every time I start my laptop, even when off line.

What starts this docker process ?

Advertisement

Answer

Docker is being started by systemd in your environment. You can disable the entire engine by running:

sudo systemctl disable docker
sudo systemctl stop docker

You can also stop only the container that is running (the shim and Jenkins application):

sudo docker ps # lists the running containers along with their container id
sudo docker update --restart=no $container_id
sudo docker stop $container_id

If you know that you do not need this container and want to permanently delete it, you can run this instead of the above two last commands:

sudo docker rm -f $container_id

The -f switch also stops the container if it’s currently running.


Edit: from your comment, your container is running under swarm mode which is redeploying it. To stop that first find the stack or service that is running it.

sudo docker stack ls
sudo docker service ls

If you see a stack listed, you can remove that with:

sudo docker stack rm $stack_name

If there are no stacks listed, or they don’t apply to this container, you can delete the service with:

sudo docker service rm $service_name
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement