Docker service fails to start due to dependency - docker

I have docker 20.10.6 & CentOS 7.5
-bash-4.2$ docker version
Client: Docker Engine - Community
Version: 20.10.6
API version: 1.41
Go version: go1.13.15
Git commit: 370c289
Built: Fri Apr 9 22:45:33 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
when I try to run the service with
sudo systemctl start docker
I get an error of
A dependency job for docker.service failed. See 'journalctl -xe' for details.
systemctl returns this
systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/etc/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
I am following the guide from https://docs.docker.com/engine/install/centos/
I have tried reinstalling docker & dependencies, tried creating a /etc/docker/daemon.json file with the contents
{
"storage-driver": "overlay2"
}
but no success
The command
export VERSION_STRING=20.10.6
sudo yum install docker-ce-${VERSION_STRING} docker-ce-cli-${VERSION_STRING} containerd.io
indicates no missing dependency
The logs in journalctl are not very informative:
sudo journalctl -fu docker
-- Logs begin at .... --
Dependency failed for Docker Application Container Engine.
systemd[1]: Job docker.service/start failed with result 'dependency'.
systemd[1]: Dependency failed for Docker Application Container Engine.
systemd[1]: Job docker.service/start failed with result 'dependency'.
systemd[1]: Dependency failed for Docker Application Container Engine.
systemd[1]: Job docker.service/start failed with result 'dependency'.
systemd[1]: Dependency failed for Docker Application Container Engine.
systemd[1]: Job docker.service/start failed with result 'dependency'.

The following made the trick
sudo /usr/bin/dockerd -H unix://
So I start the docker engine that way, and I can start running containers, etc.

Related

How to install Docker Engine on Microsoft's CBL-Mariner 2.0 Linux?

I am trying to use the CBL-Mariner 2.0 Linux as the OS for my Azure virtual machines (Azure VMSS). I want to use it to run Docker containers. Hence, I need to install docker engine on the Mariner 2 VM. Are there anyone who already figured the installation out?
I am following the Fedora installation instructions. However, I did not succeed.
weng5e#5e-mariner2-dev-2302 [ ~/lt ]$ sudo dnf -y install dnf-plugins-core
Last metadata expiration check: 0:01:27 ago on Fri Feb 10 18:22:00 2023.
Package dnf-plugins-core-4.0.24-2.cm2.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
weng5e#5e-mariner2-dev-2302 [ ~/lt ]$ sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Last metadata expiration check: 0:01:38 ago on Fri Feb 10 18:22:00 2023.
No match for argument: docker-ce
No match for argument: docker-ce-cli
No match for argument: containerd.io
No match for argument: docker-compose-plugin
Error: Unable to find a match: docker-ce docker-ce-cli containerd.io docker-compose-plugin
The moby engine is already added to the official Mariner package feed. So, installing moby engine instead of docker ce would work.
sudo tdnf install moby-engine moby-cli ca-certificates -y
sudo systemctl enable docker.service
sudo systemctl daemon-reload
sudo systemctl start docker.service
I followed these steps, but docker commands are not working:
root#cbl-mariner-toc8N3PL8JTy [ /home/abc ]# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Looks like the services are not running for some reason. Any suggestions to fix this?
root#cbl-mariner-toc8N3PL8JTy [ /home/abc ]# systemctl status docker.service
* docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead)
TriggeredBy: * docker.socket
Docs: https://docs.docker.com
Feb 16 02:32:38 cbl-mariner-toc8N3PL8JTy systemd[1]: Dependency failed for Docker Application Container Engine.
Feb 16 02:32:38 cbl-mariner-toc8N3PL8JTy systemd[1]: docker.service: Job docker.service/start failed with result 'dependency'.
Feb 16 02:33:15 cbl-mariner-toc8N3PL8JTy systemd[1]: Dependency failed for Docker Application Container Engine.
Feb 16 02:33:15 cbl-mariner-toc8N3PL8JTy systemd[1]: docker.service: Job docker.service/start failed with result 'dependency'.
root#cbl-mariner-toc8N3PL8JTy [ /home/abc ]# systemctl status containerd.service
x containerd.service - containerd container runtime
Loaded: loaded (/usr/lib/systemd/system/containerd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-02-16 02:39:59 UTC; 4min 7s ago
Docs: https://containerd.io
Process: 4893 ExecStartPre=/sbin/modprobe overlay (code=exited, status=1/FAILURE)
Feb 16 02:39:59 cbl-mariner-toc8N3PL8JTy systemd[1]: containerd.service: Scheduled restart job, restart counter is at 5.
Feb 16 02:39:59 cbl-mariner-toc8N3PL8JTy systemd[1]: Stopped containerd container runtime.
Feb 16 02:39:59 cbl-mariner-toc8N3PL8JTy systemd[1]: containerd.service: Start request repeated too quickly.
Feb 16 02:39:59 cbl-mariner-toc8N3PL8JTy systemd[1]: containerd.service: Failed with result 'exit-code'.
Feb 16 02:39:59 cbl-mariner-toc8N3PL8JTy systemd[1]: Failed to start containerd container runtime.

how to "active: running" docker in ubuntu when the status result is "Active: failed (Result: exit-code)"

after the migration of the cloud server between two data-center, my docker doesn't work correctly. I can't see my containers and images. and i receive error below:
ubuntu#ubuntu-servername-server:~$ sudo docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
and when i checked the status of the docker by "systemctl status docker" I received "active: failed" error.
ubuntu#ubuntu-gardooon-server:~$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2022-09-10 16:29:10 UTC; 2 days ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 35714 (code=exited, status=1/FAILURE)
Sep 10 16:29:08 ubuntu-gardooon-server systemd[1]: docker.service: Main process exited, code=exited, statu>
Sep 10 16:29:08 ubuntu-gardooon-server systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 10 16:29:08 ubuntu-gardooon-server systemd[1]: Failed to start Docker Application Container Engine.
Sep 10 16:29:10 ubuntu-gardooon-server systemd[1]: docker.service: Scheduled restart job, restart counter >
Sep 10 16:29:10 ubuntu-gardooon-server systemd[1]: Stopped Docker Application Container Engine.
Sep 10 16:29:10 ubuntu-gardooon-server systemd[1]: docker.service: Start request repeated too quickly.
Sep 10 16:29:10 ubuntu-gardooon-server systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 10 16:29:10 ubuntu-gardooon-server systemd[1]: Failed to start Docker Application Container Engine.
docker and docker-compose are installed on my server and the versions of them are:
ubuntu#ubuntu-gardooon-server:~$ docker --version
Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2
ubuntu#ubuntu-gardooon-server:~$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
after i saw these errors i trying to check the docker folder in /var/lib/ on ubuntu 20.04 and i couldn't open it. so after some tries i deleted the folder by mistake.
now please help me to find out how i can run my docker and if possible recover my containers and images? and if not, please let me know how i can rebuild my docker?
Thank you
.........................
I tried to reinstall the docker. with command (apt --reinstall install docke) but i received message below:
ubuntu#ubuntu-gardooon-server:~$ sudo apt install docker
Reading package lists... Done
Building dependency tree
Reading state information... Done
docker is already the newest version (1.5-2).
The following packages were automatically installed and are no longer required:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
libjpeg-turbo8 libjpeg8 libtiff5 libwebp6 libxpm4
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 122 not upgraded.
after that i tried to check docker activation but it's status active failed yet.
ubuntu#ubuntu-gardooon-server:~$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset>
Active: failed (Result: exit-code) since Sat 2022-09-10 16:29:10 UTC; 4 da>
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 35714 (code=exited, status=1/FAILURE)
I install the docker again completely and then the problem was solved.
but all images and containers are removed.

CentOS 7 - Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I tried to install the docker in CentOS 7 and got daemon error. I tried all the methods available on the internet for installation and for debugging but none really worked! I even tried to install older versions of docker that didn't work either.
SELinux is Disabled.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
docker version
Client:
Version: 1.13.1
API version: 1.26
Package version:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
systemctl status docker.service -l
Redirecting to /bin/systemctl status -l docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-04-10 18:00:02 CEST; 49min ago
Docs: http://docs.docker.com
Process: 4510 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
Main PID: 4510 (code=exited, status=1/FAILURE)
Apr 10 18:00:01 ns3138286 systemd[1]: Starting Docker Application Container Engine...
Apr 10 18:00:01 ns3138286 dockerd-current[4510]: time="2020-04-10T18:00:01.506877169+02:00" level=info msg="libcontainerd: new containerd process, pid: 4522"
Apr 10 18:00:02 ns3138286 dockerd-current[4510]: time="2020-04-10T18:00:02.514107274+02:00" level=error msg="'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded."
Apr 10 18:00:02 ns3138286 dockerd-current[4510]: Error starting daemon: error initializing graphdriver: driver not supported
Apr 10 18:00:02 ns3138286 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Apr 10 18:00:02 ns3138286 systemd[1]: Failed to start Docker Application Container Engine.
Apr 10 18:00:02 ns3138286 systemd[1]: Unit docker.service entered failed state.
Apr 10 18:00:02 ns3138286 systemd[1]: docker.service failed.
Difficult to provide an exact solution to this question without more details, however, the error message is clear:
'overlay' not found as a supported filesystem on this host
Please note:
To configure Docker to use the overlay storage driver your Docker host must be running version 3.18 of the Linux kernel (preferably
newer) with the overlay kernel module loaded.
Check the kernel version with uname -r
If you have installed a new kernel since installing docker, try rebooting your machine.
If you do not explicitly need overlay, you can also specify storage drivers in the /etc/docker/daemon.json file - 'devicemapper' was the preferred storage driver for kernels that do not support overlay.

Start Docker daemon as another user?

Installed Docker 17.x version in RHEL and we are getting below excetption.
-bash-4.2$ docker version
Client:
Version: 17.09.1-ce
API version: 1.32
Go version: go1.8.3
Git commit: 19e2cf6
Built: Thu Dec 7 22:23:40 2017
OS/Arch: linux/amd64
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.32/version: dial unix /var/run/docker.sock: connect: permission denied
-bash-4.2$
to solve this , we introduce another user group (docker-user) and we added all the users in this group. after that we ran this command and able to ran docker .
sudo systemctl stop docker
sudo systemctl start docker
cd /var/run
sudo chown :docker-user docker.sock
But we are facing another issue that whenever VM is getting restarted ,DOCKER is not running. So we decided to setup run docker as daemon process and we followed
below steps.
1. create docker.conf file under /etc/systemd/system/docker.service.d folder.
2. added this entry in docker.conf file
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
ExecStartPost=/bin/chown :docker-user /var/run/docker.sock
After adding this entry and we ran
1. sudo systemctl daemon-reload
2. sudo systemctl stop docker
3. sudo systemctl start docker
We are getting below exception
-bash-4.2$ sudo systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─docker.conf
Active: failed (Result: start-limit) since Wed 2018-03-28 09:10:50 PDT; 12s ago
Docs: https://docs.docker.com
Process: 23395 ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock (code=exited, status=1/FAILURE)
Main PID: 23395 (code=exited, status=1/FAILURE)
Mar 28 09:10:50 hostname systemd[1]: Failed to start Docker Application Container Engine.
Mar 28 09:10:50 hostname systemd[1]: Unit docker.service entered failed state.
Mar 28 09:10:50 hostname systemd[1]: docker.service failed.
Mar 28 09:10:50 hostname systemd[1]: docker.service holdoff time over, scheduling restart.
Mar 28 09:10:50 hostname systemd[1]: start request repeated too quickly for docker.service
Mar 28 09:10:50 hostname systemd[1]: Failed to start Docker Application Container Engine.
Mar 28 09:10:50 hostname systemd[1]: Unit docker.service entered failed state.
Mar 28 09:10:50 hostname systemd[1]: docker.service failed.
Guide me how to setup docker as daemon process
So, you have already dug in pretty good.
However, this behavior is built into Docker. For user groups, the docker daemon will allow users with the docker group to access the server (important to remember, this is exactly the same as giving root access to any users in that group!). If you wanted to specify a different group, you can start the daemon with the -g option.
Installing docker also installs a systemd service unit to run the daemon. The correct way to enable that (so that it restarts automatically) is
sudo systemctl enable docker
At this point, you didn't include enough of the journalctl logs to actually say why the daemon is not starting for you- if it is an option, I would try starting over since I don't know everything you have messed with, but if that is not an option the journalctl logs will likely explain the problem (probably that the user 'docker' no longer has access to the socket after you chowned it, but that is just a guess)

docker fails to start

I am running docker on CentOS 7. (docker from centos repo. not that of docker-engine). docker was running perfectly but for some reasons i tried to reinstall it. Unfortunately docker.service refused to start and shows me the next couple of errors:
Jan 24 15:19:28 fms-provisioner-4.novalocal systemd[1]: Job docker.service/start failed with result 'dependency'.
Jan 24 15:21:30 fms-provisioner-4.novalocal systemd[1]: Dependency failed for Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit docker.service has failed.
-- The result is dependency.
Jan 24 15:21:30 fms-provisioner-4.novalocal systemd[1]: Job docker.service/start failed with result 'dependency'.
Jan 24 15:28:49 fms_k8s_minion2 systemd[1]: [/usr/lib/systemd/system/docker.service:17] Unknown lvalue '--add-runtime docker-runc' in section 'Service'
Jan 24 15:43:09 fms_k8s_minion2 systemd[1]: Dependency failed for Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit docker.service has failed.
-- The result is dependency.
Please may someone tell me what's going on ?
Try to restart docker daemon and service by using
sudo systemctl daemon-reload
and
sudo systemctl restart docker
if this do not help than Remove docker and try
curl -sSL http://get.docker.com | sh
sudo systemctl restart docker
Looks like your Docker build is configured to use `runc:
[/usr/lib/systemd/system/docker.service:17] Unknown lvalue '--add-runtime docker-runc' in section 'Service'
You could install runc, but that probably won't fix the issue:
sudo yum install runc
runC is lightweight, portable implementation of the the Open Container Format (OCF), you can find more about it in documentation.
Anyway the --add-runtime flag was added in Docker 1.12, unless there's at least docker-engine 1.12.0 in your repository remove the flag in /usr/lib/systemd/system/docker.service and reload the service:
sudo systemctl daemon-reload
sudo systemctl restart docker
Thanks all for your answers but i forgot to mention that i am using flannel with docker. it such case, flannel was down do docker won't to start.
that's mainly what was causing my issue.
sorry for disturbing.

Resources