As with other services, the systemctl can also be used to manage the dockerd service. The systemctl is a command line utility used to manage the systemd services in Linux distributions that come with systemd init system.
In this guide, I will demonstrate the process of managing the Docker service on Linux by utilizing the systemctl tool.
How to Start Docker Service Using systemctl Command
By default, on Linux, the docker service initiates upon boot. However, in many cases, you may want to manage it manually, such as troubleshooting it, or in case of abnormality. Docker service and socket files can easily be managed with the systemctl. The command to start the docker service is given below:
The above command will not produce any indication that the service has begun functioning. To determine if the Docker service is active and running, use the status option with the systemctl command and the service name.
Note that, in the above commands, the .service extension is optional and can be skipped.
How to Manage Docker Boot Settings using systemctl Command
As mentioned earlier, in all modern Linux distributions, the docker service starts automatically on boot. But in order to manage it manually, the systemctl command can be employed.
For example, if you want to reduce boot time and save resources by not starting the docker service on boot, simply disable it.
Disabling the docker service will not immediately stop it; the service will remain active until explicitly stopped. The service will remain active, however, the target file that keeps the service enabled on boot will be removed and on the next boot the service will be disabled.
To start the docker, simply use the systemctl start with the service name, and to stop it, use the systemctl stop commands.
And to start it on boot, enable the service.
Enabling the service will again create a symbolic link in the /wants directory.
How to Start Docker Service Manually
If you do not want to use the systemctl command line utility to start the docker service, then it can be manually triggered using the dockerd command with sudo privileges.
To stop the service, press ctrl+c keys.
Conclusion
The system administration tool is also capable of handling the Docker service on Linux. By default, the docker service is enabled on boot, however, it can also be managed manually using the systemctl command. To start an inactive docker service the systemctl start docker command is used and to disable it to load on boot the systemctl disable docker command is used.