Search code examples
dockerunixservicecentossystemctl

Centos Service started but remains disabled


I downloaded Docker for my Centos server. After installing via yum and started the service with systemctl start docker I noticed an incoherent situation.

The service is running:

$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-01-16 11:19:57 UTC; 1min 16s ago
     Docs: https://docs.docker.com
 Main PID: 1691 (dockerd)
    Tasks: 39
   Memory: 37.4M
   CGroup: /system.slice/docker.service
           └─1691 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

but remains in disabled state:

$ systemctl list-unit-files | grep docker
docker.service                                disabled
docker.socket                                 disabled

Why does it happen? Can a disabled service be running?


Solution

  • According to this, systemctl enable makes the service to be active as long as the server is running and systemctl start makes it run now.

    If we run the service while it is in disabled state, it means when the server reboots the service will not run automatically. But being in disabled state does not prevent it to run!