Disable Docker autostart at boot?

42,148

Solution 1

Ok, I think I managed to get it working, following How to enable or disable services?:

sudo bash -c 'echo manual | sudo tee /etc/init/docker.override'

Hope that was it...

Solution 2

On the systems since Ubuntu 16.04+ (where OS uses systemd), according to the doc, autostart on boot can be turned off by:

$ sudo systemctl disable docker.service
$ sudo systemctl disable docker.socket

or as @Burak said in the comment, here is the one liner command:

sudo systemctl disable docker.service docker.socket

Note that if you do not disable the socket as well as the service then the service will get started anyways as the socket depends on it.

Share:
42,148

Related videos on Youtube

sdbbs
Author by

sdbbs

Updated on September 18, 2022

Comments

  • sdbbs
    sdbbs almost 2 years

    I was trying to experiment with docker, Ubuntu 14.04, 64-bit. I managed to run an image, and I gave it the path on one of my removable drives, /media/Drive1.

    Now, whenever I reboot, I see there is a /media/Drive1 with only a docker directory inside it, and the actual drive which should be Drive1 ends up mounted on /media/Drive11, and this happens every reboot - even when I unmount these drives, and do a sudo rm -rfv /media/Drive1 before rebooting!

    So something probably creates /media/Drive1 before it is fully mounted, and I guess that something is docker, because when I boot, I have:

    $ ps axf | grep docker
     2085 ?        Ssl    0:00 /usr/bin/docker -d
    

    So, how can I disable the docker autostart, so it doesn't interfere with the mounting of external USB drives at boot?

  • chefarov
    chefarov over 6 years
    In my case, I had to disable docker-volume-local-persist.service and docker.socket as well. To list any docker service in systemd, type: systemctl list-unit-files | grep -i docker
  • Taylor
    Taylor over 3 years
    I had to reinstall docker after this because docker-compose up wouldn't work anymore
  • Burak
    Burak almost 3 years
    You can use one-liner sudo systemctl disable docker.service docker.socket
  • John Mee
    John Mee almost 3 years
    Which will disable the docker service completely, until you manually "unmask" it.
  • Enrico
    Enrico over 2 years
    @Taylor FYI you just had to re-enable the service: sudo systemctl enable docker.service docker.socket