Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

How to Restart the Docker Daemon on Linux (Safely)

On a typical Linux server running Docker Engine as a systemd service, restart the Docker daemon with: sudo systemctl restart docker Then verify that it came back: sudo systemctl status docker docker info

On a typical Linux server running Docker Engine as a systemd service, restart the Docker daemon with:

sudo systemctl restart docker

Then verify that it came back:

sudo systemctl status docker
docker info

Restarting the Docker daemon is different from restarting a container. The daemon is the host-level dockerd process that manages containers, images, networks, and volumes.

How to restart the Docker daemon

On systemd-based Linux installations such as current Ubuntu and Debian systems, use:

sudo systemctl restart docker

The command normally prints nothing on success. Check the service and make sure the Docker client can reach the daemon:

sudo systemctl is-active docker
sudo systemctl --no-pager --full status docker
docker info

For older or non-systemd environments that expose a traditional service manager, you may instead encounter:

sudo service docker restart

Use the service manager your host actually uses; there is no reason to run both.

Docker daemon restart vs container restart

Command What it restarts
sudo systemctl restart docker The Docker Engine daemon on the host
docker restart web One container named web
docker compose restart Services in the current Compose project

If one application container is stuck, restarting the whole daemon is usually broader than necessary. Use docker restart CONTAINER for an individual container. Restart the daemon when the Docker service itself needs it or when a daemon-level configuration change requires it.

Does restarting the Docker daemon stop containers?

By default, yes. Docker documents that when the daemon terminates, it shuts down running containers. A daemon restart can therefore interrupt workloads.

Docker's live-restore feature can keep standalone containers running while the daemon is unavailable. On a normal rootful Linux installation, enable it in /etc/docker/daemon.json:

{
  "live-restore": true
}

Docker documents that systemd users can apply supported reloadable settings with:

sudo systemctl reload docker

Live restore has limitations. It applies to standalone containers, and changes to some daemon-level options can prevent Docker from restoring its connection to containers. On production hosts, check the impact before restarting.

Restart Docker after changing daemon.json

Many Docker Engine settings live in /etc/docker/daemon.json. Some changes require a daemon restart. Docker's daemon proxy documentation, for example, instructs systemd users to restart Docker after changing proxy configuration:

sudo systemctl restart docker

Afterward, verify the service and containers:

sudo systemctl status docker
docker info
docker ps

If you manage the server through SSHFlow, you can restart Docker, inspect service logs, and return to your Docker commands in the same server workspace.

When to run systemctl daemon-reload

systemctl daemon-reload reloads systemd unit configuration; it does not restart Docker by itself. If you changed a Docker systemd unit or drop-in, use:

sudo systemctl daemon-reload
sudo systemctl restart docker

Editing daemon.json alone does not mean systemd's unit files changed.

Restart rootless Docker

Rootless Docker uses a per-user systemd service. Restart it without sudo:

systemctl --user restart docker

Check it with:

systemctl --user status docker
docker info

If you changed a rootless systemd user unit or drop-in:

systemctl --user daemon-reload
systemctl --user restart docker

Docker does not start after restart

Start with service status, then inspect the Docker service logs:

sudo systemctl --no-pager --full status docker
sudo journalctl -u docker.service -n 100 --no-pager

To follow new messages while troubleshooting:

sudo journalctl -u docker.service -f

Common causes include invalid daemon configuration, conflicting daemon options, missing files referenced by configuration, storage problems, or systemd unit changes that were not reloaded.

Check daemon.json syntax

If the problem started after editing /etc/docker/daemon.json and jq is installed:

sudo jq empty /etc/docker/daemon.json

No output means jq parsed the JSON. It does not prove every Docker option is valid, so service logs still matter.

Cannot connect to the Docker daemon

First check whether the service is actually running:

sudo systemctl is-active docker
sudo systemctl status docker

If it is failed or inactive, fix daemon startup first. If active, investigate the Docker context or socket used by your client.

Quick reference

Task Command
Restart daemon sudo systemctl restart docker
Check service sudo systemctl status docker
Check daemon via CLI docker info
Recent logs sudo journalctl -u docker.service -n 100
Follow logs sudo journalctl -u docker.service -f
Reload systemd units sudo systemctl daemon-reload
Reload supported Docker settings sudo systemctl reload docker
Restart rootless Docker systemctl --user restart docker
Restart one container docker restart CONTAINER

Related Docker workflows

For Compose projects, see docker compose up -d: what it actually does. If you need an interactive shell in a new container, see docker run -it: what -i and -t mean.

Conclusion

On a normal systemd-based Linux Docker Engine host, sudo systemctl restart docker is the direct way to restart the Docker daemon. Verify it with systemctl status docker and docker info, and remember that a daemon restart is broader than restarting one container.

On production hosts, check the impact on running containers first. Docker shuts them down when the daemon terminates by default; live-restore exists for standalone containers that need to remain running while the daemon is unavailable.

Originally published on SSHFlow.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.