Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Docker Upon Startup in Ubuntu 20.04

Tags:

docker

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?

like image 941
joesan Avatar asked Jul 17 '20 20:07

joesan


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

like image 82
Parth Shah Avatar answered Oct 25 '22 08:10

Parth Shah


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.

like image 21
Matus Dubrava Avatar answered Oct 25 '22 07:10

Matus Dubrava


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
like image 6
pippo1980 Avatar answered Oct 25 '22 07:10

pippo1980