Resources

Why stop and start it

Start Docker daemon or “dockerd”. And only then run docker commands. Otherwise you’ll get an error that the process is not running.

You may decide to not start docker on system start or to stop when it you don’t need it, in order to reduce load on the machine. Stopping it especially useful if Docker takes up a lot of memory (it takes up a few gigs of RAM on my Mac, even with zero containers running), or if you have a few containers that auto-start when Docker starts.

How to manage

Docker Desktop app

If you use Docker Desktop, then you should start and stop that as a desktop application and that will take care of the daemon.

You don’t have to worry about the commands below.

Dockerd CLI

You may need root access with sudo for this.

Start the daemon.

$ dockerd
INFO[2021-04-05T21:35:09.363593571+02:00] Starting up                                  
...

You’ll see the log in the CLI.

If you press CTRL+C then you’ll stop it.

Then, in another tab, you can run docker commands.

Or start in the background and keep using the same tab, if you don’t care about the logs or stopping it easily.

$ dockerd &

Use system manager

On Linux, you can use Systemctl / Systemd to manage Docker as a background process. Note the service here is docker, while internally dockerd will be used.

$ sudo systemctl start docker
$ sudo systemctl stop docker

Then check on it.

$ ps aux | grep docker
root      225149  0.7  1.0 1304212 83640 ?       Ssl  22:29   0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Then you can run docker commands.

If you want Docker to start on system boot:

$ sudo systemctl enable docker