"Warning: Stopping docker.service, but it can still be activated by: docker.socket"


You may encounter the following warning message: Stopping docker.service, but it can still be activated by: docker.socket

This warning indicates that although the docker service has been stopped, it can still be activated by the docker socket.

To address this warning, you can take the following steps:

  1. Check if any Docker containers are still running by running the command docker ps. If there are any running containers, consider stopping them using docker stop <container_id>.
  2. If you've stopped all running containers and the warning persists, you can try restarting the Docker service entirely by running sudo systemctl restart docker.service.
  3. Alternatively, if you no longer require Docker to be active, you can disable the docker.socket to prevent it from activating the Docker service. You can do this by running sudo systemctl disable docker.socket.
  4. After taking these steps, the warning should no longer appear, and the Docker service should be fully stopped.

The output of ps aux suggests that you didn't initiate Docker through systemd/systemctl.

It seems you started it using:

sudo dockerd -H gridsim1103:2376

When attempting to stop it with systemctl, nothing would occur since the resulting dockerd process isn't managed by systemd. Thus, the observed behavior is expected.

The proper method to start Docker is via systemd/systemctl:

systemctl enable docker
systemctl start docker

Following this, Docker should commence on system startup.

In my situation, it wasn't systemd or a cron job, but rather snap. Thus, I had to execute:

sudo snap stop docker
sudo snap remove docker

Interestingly, the last command never seemed to complete, for reasons I couldn't ascertain. Dealing with snap can indeed be quite troublesome. Consequently, I also performed:

sudo apt purge snap