Docker

What is the Command Line Procedure to Restart Docker?

Docker is a software forum that permits developers to build, run, and share applications by utilizing containers. It offers tools and services to create and manage containers, as well as to store and share container images. Restarting Docker means stopping the Docker Daemon and then starting it again. The Docker daemon manages images, containers, volumes, and networks and it runs as a separate process on the host operating system.

This article will demonstrate the command line procedure to restart Docker on different operating systems.

What is the Command-Line Procedure to Restart Docker?

The procedure to restart Docker relies on the operating system. It can be done on various operating systems, such as:

How to Restart Docker Using Command Line on Windows?

To restart Docker using the command line on Windows, first, launch Windows PowerShell as an administrator. Then, stop the Docker Daemon using the “net stop docker” command and start it again via the “net start docker” command.

Follow the given-provided steps for a better understanding.

Step 1: Stop Docker Daemon
First, execute the provided command to stop the Docker Daemon:

net stop docker

In the above, Docker has been stopped.

Step 2: Restart Docker Daemon
Then, start the Docker Daemon again with the help of the below-listed command:

net start docker

The above output indicates that Docker has been successfully restarted.

How to Restart Docker Using Command Line on Linux?

To restart Docker using the command line on Linux, first, launch the Ubuntu terminal as an administrator. Then, restart the Docker Daemon using the “sudo systemctl restart docker” command. Next, verify whether the Docker is running via the “sudo systemctl status docker” command.

Step 1: Restart Docker Daemon
Run the given-provided command to restart the Docker Daemon on Linux OS:

sudo systemctl restart docker

In this way, Docker has been restarted successfully.

Step 2: Verification
Then, ensure that the Docker is running by using the below-listed command:

sudo systemctl status docker

As you can see Docker has been restarted successfully.

How to Restart Docker Using Command Line on Mac?

To restart Docker using the command line on Mac, first, open the terminal window. Then, execute the “killall Docker && open /Applications/Docker.app” command:

killall Docker && open /Applications/Docker.app

This command first stops the Docker daemon and then starts the Docker application.

Conclusion

To restart Docker using the command line on Windows, first, stop the Docker Daemon using the “net stop docker” command and start it again via the “net start docker” command. For Linux OS, utilize the “sudo systemctl restart docker” command. Moreover, use the “killall Docker && open /Applications/Docker.app” command on Mac OS. This article has demonstrated the command line procedure to restart Docker on different operating systems.

About the author

Laiba Younas

I have done bachelors in Computer Science. Being passionate about learning new technologies, I am interested in exploring different programming languages and sharing my experience with the world.