Docker is a powerful platform for developing, shipping, and running applications inside containers. However, there are times when you might need to restart Docker or its components for various reasons, such as applying updates, resolving issues, or simply refreshing the environment. This guide will walk you through multiple ways to restart Docker on a Linux system, ensuring your containers and services continue to run smoothly.
In this tutorial you will learn:
- How to restart the Docker daemon
- How to restart Docker containers
- How to restart Docker services
- How to restart Docker on various Linux distributions

| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Any Linux distribution with Docker installed |
| Software | Docker version 19.03 or higher |
| Other | Basic knowledge of Linux command line |
| Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Restarting Docker on Linux
Below are various methods to restart Docker on a Linux system. These examples cover different scenarios and requirements, providing a comprehensive overview of the available options.
- Restart Docker Daemon: Restarting the Docker daemon is often required after configuration changes or updates.
# systemctl restart docker
This command will stop and then start the Docker service, refreshing all configurations and updates.
- Restart a Docker Container: Restarting a specific Docker container can be useful for troubleshooting or applying changes.
$ docker restart <container_id>
Replace
<container_id>with the actual ID or name of your container. - Restart All Docker Containers: Sometimes, you may need to restart all running containers at once.
$ docker restart $(docker ps -q)
This command will restart every running container by using the output of
docker ps -q. - Restart Docker Compose Services: When using Docker Compose, restarting services is often necessary.
$ docker-compose restart
This will restart all services defined in your
docker-compose.ymlfile. - Restart Docker on Ubuntu: Ubuntu users can restart Docker using the following command.
# service docker restart
This command is an alternative to
systemctlon Ubuntu systems. - Restart Docker on CentOS: For CentOS, the command is similar to Ubuntu.
# systemctl restart docker
Ensure you have root privileges or use
sudofor this command. - Restart Docker on WSL: For Windows Subsystem for Linux (WSL), you can restart Docker using:
$ sudo /etc/init.d/docker restart
This command restarts Docker in the WSL environment.
- Restart Docker Service in Linux: Restarting the Docker service is essential for various Linux distributions.
# systemctl restart docker.service
This is a more explicit way to restart the Docker service.
- Restart Docker Engine: To restart the Docker engine, use:
# systemctl restart docker-engine
This command is used in some specific Linux distributions where the service is named differently.
- Restart Docker Network: Sometimes, network issues require restarting Docker’s network bridge.
# systemctl restart docker && ifconfig docker0 down && ifconfig docker0 up
This will restart Docker and reset the network bridge.
- Restart Docker Compose File: To restart containers defined in a Docker Compose file.
$ docker-compose -f docker-compose.yml restart
This command ensures that all services defined in the specified Docker Compose file are restarted.
Conclusion
Restarting Docker and its components can be done in various ways depending on your needs and the specific scenario. Whether you are restarting the Docker daemon, individual containers, or services managed by Docker Compose, the commands and methods provided in this guide will help ensure that your Docker environment remains stable and responsive.