How to run docker daemon?

If you stopped the service, you would need the following command to start it again:

$ sudo service docker start   # for work with SysVinit
$ sudo systemctl start docker # for work with Systemd

Also to stopped again, you might use:

$ sudo service docker stop   # for work with SysVinit
$ sudo systemctl stop docker # for work with Systemd

I spent several hours trying to figure out why I wasn't able to run Docker containers in my ArchLinux environment. The solutions listed above didn't work for me.

Turns out, I had to run the dockerd daemon which is a "persistent process which manages containers". You can read more about this here.

These commands worked for me:

  1. $ sudo dockerd

  2. $ sudo dockerd &

    • This runs dockerd deamon as a background process (more useful)

These commands didn't work for me:

  1. $ sudo service docker start or $ sudo service docker restart

  2. $ sudo systemctl start docker

I hope this helps others who are stuck at a similar problem.


I believe the question is how to run the docker in detached mode and connect back, suppose one has Ubuntu image one can try this

sudo docker run -it -d --name myubdocker ubuntu:latest bash

It will detach the docker and one can see it running when one tries this

sudo docker ps

Now how will one attach back to the same docker, thru the following command (CONTAINERID will be listed when one does (docker ps)

sudo docker exec -it <CONTAINERID> bash

This will give a root command prompt ( can one type exit and again connect back )


The -d flag is used with docker run command to run a container in detached mode.

What you're looking for might be docker-machine start :

docker-machine start [arg...]

This command starts a machine with one or more machine names as arguments. For example:

$ docker-machine start dev

Tags:

Docker