Docker Community Forums

Share and learn in the Docker community.

Error: docker: 'daemon' is not a docker command

In Ubuntu studio 20.04.1 Docker installation - installed just fresh on October 2020…, I give commands:
// according to page 23 [TECHNIQUE 1 Open your Docker daemon to the world] of the book “Docker in Practice
SECOND EDITION”, ©2019 by Manning Publications Co. :

========================================
sudo service docker stop sudo docker daemon -H tcp://0.0.0.0:2375

======================================== getting >>>
leonidas@ubuntu:~ sudo docker daemon -H tcp://0.0.0.0:2375 docker: 'daemon' is not a docker command. See 'docker --help' leonidas@ubuntu:~

Do you have any idea/hint on what to do??? I search online but Not found a solution…

The binary is called dockerd and is located in /usr/bin/dockerd.
Why would they want to stop docker as a service and then run it with a command? Strange exercise…

I would strongly suggest to do any daemon configuration to the file /etc/docker/daemon.json. If it does not exist, create it.The equivalent of what you try to do with the command is:

{
   "hosts" : [ "tcp://0.0.0.0:2375" ]
}

If the file exists, do not replace it with the example I pasted! Modify the hosts line if existing, add the hosts line , if missing. Keep in mind: this is a json file!

Though, you might want to keep the binding to the docker.sock as well:

{
   "hosts" : [ "tcp://0.0.0.0:2375", "unix:///var/run/docker.sock" ]
}

Then restart the daemon with sudo service docker restart and you are done.

WARNING: everyone who can access your docker machine, will be able to connect to it with a remote docker client or application that implements the docker sdk without authentification. You will not want to enable this, unless you enable certificate auth (see: https://docs.docker.com/engine/security/https/). Even better don’t enable the http socket at all, and leverage docker context, which allows to controll remote docker engines over ssh (see: Docker context problem).

Thanks for your reply

So daemon was the old name… ?
I must use dockerd for the new version of docker?

I use in Ubuntu VM the docker practicing commands of this book
This VM is for testing, so is Not any danger to impacted or attack me, some hacker to the Windows 10 host OS, correct?

my book says run:

$ docker -H tcp://<your host’s ip>:2375

to connect to my Docker from the network, how to find Ubuntu VM IP…?

leonidas@ubuntu:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:cd:03:30 brd ff:ff:ff:ff:ff:ff
    inet 192.168.217.129/24 brd 192.168.217.255 scope global dynamic noprefixroute ens33
       valid_lft 1311sec preferred_lft 1311sec
    inet6 fe80::fc78:9998:759f:a6f8/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:01:23:5a:50 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
leonidas@ubuntu:~$

You likely have an old version of docker installed; the docker daemon subcommand was added in docker 1.8. Before that, the daemon was started using the -d / --daemon option (docker -d).

The version of the upstart-configuration you downloaded is intended for the current docker release; for older versions of docker, be sure to download the version that matches the version you’ve installed, for example; https://raw.githubusercontent.com/docker/docker/v1.7.1/contrib/init/upstart/docker.conf

I would suggest to upgrade to a more recent version of docker, because versions older than 1.8 are now getting quite old (in Docker terms)

I mean how to learn my VM/Ubuntu IP address?

my book says run: // I connected and started dockerd server with: sudo dockerd -H tcp://0.0.0.0:2375

$ docker -H tcp://<your host’s ip>:2375

to connect to my Dockerd from the network, how to find Ubuntu VM IP[<your host’s ip>]…?