service docker start fails (daemon is not a docker command) - docker

I have a problem after I have tried to restart docker. Since then,
service docker start returns "start: Job failed to start".
This may have started once I have changed docker.conf. I have tried to reupload it using the command
wget -O /etc/init/docker.conf https://raw.githubusercontent.com/docker/docker/master/contrib/init/upstart/docker.conf
however, I was not lucky to fix this.
cat /var/log/upstart/docker.log returns:
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Any help would be really appreciated.

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)

In my case, after upgrade to docker 19.03.5, I got this error.
When starting manually the /usr/bin/dockerd all works but via systemctl start docker it fails.
Looking at journalctl -xe I found the log:
docker: 'daemon' is not a docker command.
But the docker.service file was right, starting /usr/bin/dockerd.
I spent a time to figure out that the previous installation had a configuration file in: /etc/systemd/system/docker.service.d/override.conf that replace the docker daemon start command(/usr/bin/dockerd) with other deprecated syntax.
In this case you can remove the override.conf file to allow docker start:
rm /etc/systemd/system/docker.service.d/override.conf
systemctl daemon-reload
systemctl start docker
Hope it helps

Related

Run docker without sudo in ubuntu

Yes I have followed steps provided here https://docs.docker.com/engine/install/ubuntu/ and https://docs.docker.com/engine/install/linux-postinstall/ and also checked this thread docker.sock permission denied
But still getting the below problem when docker is run without sudo in Ubuntu 18.04
docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
It is rather frustrating as I tried multiple times.
It worked fine after deleting the below entry in .bashrc
export DOCKER_HOST=unix:///run/user/1000/docker.sock
I'm not sure how that line made it into .bashrc
Feel so stupid now. Anyway thanks!

Open docker daemon to outside users command error

I want to open my Docker server up for others to access, before the attempt to do so, I shut the current daemon down.
$ sudo service docker stop
Once the Docker daemon has been stopped, I tried to restart it manually and open it
up to outside users with the following command.
$ sudo docker daemon -H tcp://0.0.0.0:2375
What I get is
I tried with -d instead of daemon, still the same.
My current docker version is Docker version 18.09.2, build 6247962

docker: Cannot connect to the Docker daemon on Mac OS X

I got the following error when I run docker. Does anybody know how to fix the problem. The OS is Mac OS X.
$ docker --version
Docker version 17.12.0-ce, build c97c6d6
$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
You can restart Docker with the following
Stop Docker for Mac gracefully
Stop all Docker containers without confirmation (make sure nothing is running in Docker)
docker ps -q | xargs -L1 docker stop
Requires all Docker containers are stopped
test -z "$(docker ps -q 2>/dev/null)" && osascript -e 'quit app "Docker"'
Start Docker gracefully
open --background -a Docker
I just found out that I have to restart my docker desktop as well. I had no idea that docker desktop and terminal's docker command are related. But now, apparently, they are related. If anyone encounters similar problems, remember to try restart your docker desktop and wait for it to get running!

docker ps shows empty list

I built a docker image from a docker file. Build said it succeeded. But when I try to show docker containers through docker ps (also tried docker ps -a), it shows an empty list. What is weird is that I'm still able to somehow push my docker image to dockerhub by calling docker push "container name".
I wonder what's going on? I'm on Windows 7, and just installed the newest version of dockertoolbox.
docker ps shows (running) containers. docker images shows images.
A successfully build docker image should appear in the list which docker images generates. But only a running container (which is an instance of an image) will appear in the list from docker ps (use docker ps -a to also see stopped containers). To start a container from your image, use docker run.
For me, docker ps -a and docker images both returned an empty list even tho I had many docker containers running. I tried rebooting system with no luck. A quick sudo systemctl restart docker fixed this "bug".
try restarting
sudo systemctl restart docker.socket
sudo systemctl restart docker
You can run the command without the -d option.
So you have the output displayed.
It may be that the application failed to start.
For me, the only thing resolving the issue is to reinstall docker. Also, one must be sure that the disk is not full.
This is the command that I use, but it may vary depending on the version of docker already installed:
apt-get install --reinstall docker.io
If prompted, choose "yes" to automatically restart docker daemon
for Linux,
at first, see all the running container
sudo docker ps
try restarting
sudo systemctl restart docker
remove previous docker image with the same name if there is any
sudo docker rm docker_container_id
once again run
sudo docker run -d --name container_name image_name
This should work
or uninstall docker and install it again
In the Dockerfile instructions, make sure the CMD commands are in between double-quotes not single-qoute
for example:
CMD [ "node" , 'index.js'] Here there is a mistake !!
Correct one is :
CMD [ "node" , "index.js"]
This mistake will make the container run and exit immediately.

Docker not working after installation

I tried installing the docker using the linux method.
However when the command $docker run hello-world is executed, it outputs:
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.
What can be done about this?
First of all make sure the daemon is running:
$ps aux|grep "docker daemon"|grep -v "grep"
A) The daemon is not launched (no lines are returned by the ps)
Start the daemon that is not working:
$sudo /usr/bin/docker daemon -H unix:///var/run/docker.sock
Or start it as a service with:
$sudo /usr/sbin/service docker start
At this point the daemon is launched.
B) The daemon is launched
As shown by the ps with something like:
[..] /usr/bin/docker daemon -H unix:///var/run/docker.sock
You're good to go with your first container with a:
$sudo docker run hello-world.
sudo and docker
If you want to use docker without being sudo (this you should, though you must be aware of the security warning!) a good read of this will help you.
You have to run this command as sudo.
sudo docker run hello-world
This will give you enough privileges to perform that action.
If you want to enable your user to rung docker without sudo, then check out this answer.

Resources