Disable Docker Upon Startup in Ubuntu 20.04

Viewed 13734

I thought this was pretty straightforward to make docker daemon not to start when I start my machine, but seems not to be the case. I installed docker manually and then used the following simple line post installation:

sudo systemctl disable docker

But to my surprise this did not do much and I could still see the daemon happily running around!

joesan@joesan-InfinityBook-S-14-v5:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
joesan@joesan-InfinityBook-S-14-v5:~$ 

Is there anything that I'm missing? Any clues?

3 Answers

This works for me (18.04):

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

You can run:

$ systemctl list-unit-files | grep -i docker

To check the docker services and disable them manually in the same way $sudo systemctl disable <service-name>.

disable will not stop the process by itself, it just won't start it the next time. You need to either restart your machine or type

sudo systemctl stop docker

to stop the process.

in ubuntu Ubuntu 20.04.1 LTS

after

$sudo systemctl disable docker.service
$sudo systemctl disable docker.socket
$ systemctl list-unit-files | grep -i 'state\|docker'
UNIT FILE                                  STATE           VENDOR PRESET
alsa-state.service                         static          enabled      
docker.service                             disabled        enabled      
docker.socket                              disabled        enabled 

As pointed out by others you need:

sudo systemctl restart docker

to have docker not working in the current session, check it with :

sudo systemctl docker
Related