How to stop docker under Linux
if you have no systemctl and started the docker daemon by:
sudo service docker start
you can stop it by:
sudo service docker stop
First I stop the docker by the following command:
sudo systemctl stop docker
Then I get the message :Warning: Stopping docker.service, but it can still be activated by: docker.socket
.
So, I stop the socket as well :
sudo systemctl stop docker.socket
Note: you can start and stop only the docker.socket
when it triggers by it.
The output of ps aux
looks like you did not start docker through systemd/systemctl.
It looks like you started it with:
sudo dockerd -H gridsim1103:2376
When you try to stop it with systemctl, nothing should happen as the resulting dockerd process is not controlled by systemd. So the behavior you see is expected.
The correct way to start docker is to use systemd/systemctl:
systemctl enable docker
systemctl start docker
After this, docker should start on system start.
EDIT: As you already have the docker process running, simply kill it by pressing CTRL+C on the terminal you started it. Or send a kill signal to the process.
In my case, it was neither systemd nor a cron job, but it was snap. So I had to run:
sudo snap stop docker
sudo snap remove docker
... and the last command actually never ended, I don't know why: this snap thing is really a pain. So I also ran:
sudo apt purge snap
:-)