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

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.

Related

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.

Docker service fails to start due to dependency

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.

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.

Docker start fails with "listen tcp 172.18.0.1:9323: bind: cannot assign requested address"

My docker demon has fail. And stack in failed state
:~$ sudo systemctl start docker.service
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
in logs i have next errors
sudo journalctl -f -u docker
-- Logs begin at Thu 2019-12-05 10:38:54 MSK. --
Dec 24 23:45:16 dockerd[11268]: listen tcp 172.18.0.1:9323: bind: cannot assign requested address
Dec 24 23:45:16 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Dec 24 23:45:16 systemd[1]: docker.service: Failed with result 'exit-code'.
Dec 24 23:45:16 systemd[1]: Failed to start Docker Application Container Engine.
Dec 24 23:45:18 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Dec 24 23:45:18 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Dec 24 23:45:18 systemd[1]: Stopped Docker Application Container Engine.
Dec 24 23:45:18 systemd[1]: docker.service: Start request repeated too quickly.
Dec 24 23:45:18 systemd[1]: docker.service: Failed with result 'exit-code'.
Dec 24 23:45:18 systemd[1]: Failed to start Docker Application Container Engine.
no process run locally on the port
:~$ lsof -i tcp:9323
:~$ fuser -n tcp -k 9323
:~$
uninstall and then install docker didn't help, still same problem
:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
containerd.io is already the newest version (1.2.10-3).
docker-ce-cli is already the newest version (5:19.03.5~3-0~ubuntu-bionic).
docker-ce is already the newest version (5:19.03.5~3-0~ubuntu-bionic).
0 upgraded, 0 newly installed, 0 to remove and 212 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up docker-ce (5:19.03.5~3-0~ubuntu-bionic) ...
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─override.conf
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-12-25 00:09:41 MSK; 12ms ago
Docs: https://docs.docker.com
Process: 3577 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --experimental=true --metrics-addr 172.18.0.1:9323 (code=exited, status=1/FAILURE)
Main PID: 3577 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
installed docker-ce package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
One of previous admins have create override.conf
:~$ cat /etc/systemd/system/docker.service.d/override.conf
[Service]
LimitMEMLOCK=infinity
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --experimental=true --metrics-addr 172.18.0.1:9323
Seems that there should be some servis at 172.18.0.1:9323 that have fail

docker service does not start after creating daemon.json

Following error message appears when doing the steps below
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2017-08-30 09:21:52 CEST; 13s ago
Docs: https://docs.docker.com
Process: 11581 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 11581 (code=exited, status=1/FAILURE)
CPU: 28ms
Aug 30 09:21:52 debian systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 30 09:21:52 debian systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Aug 30 09:21:52 debian systemd[1]: Stopped Docker Application Container Engine.
Aug 30 09:21:52 debian systemd[1]: docker.service: Start request repeated too quickly.
Aug 30 09:21:52 debian systemd[1]: Failed to start Docker Application Container Engine.
Aug 30 09:21:52 debian systemd[1]: docker.service: Unit entered failed state.
Aug 30 09:21:52 debian systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 30 09:22:00 debian systemd[1]: docker.service: Start request repeated too quickly.
Aug 30 09:22:00 debian systemd[1]: Failed to start Docker Application Container Engine.
Aug 30 09:22:00 debian systemd[1]: docker.service: Failed with result 'exit-code'.
I created a fresh Ubuntu 64bit VM on VirtualBox.
Then I used the install script to install docker: https://get.docker.com/
After the installation went successful I tried to configure the daemon to 10.0.2.15:2375 so I can forward it to my Host OS
I ran nano /etc/docker/daemon.json to create the file
I pasted following example into it
{
"debug": true,
"tls": false,
"tlscert": "/var/docker/server.pem",
"tlskey": "/var/docker/serverkey.pem",
"hosts": ["tcp://10.0.2.15:2375"]
}
then I ran service docker restart
running service docker status shows me the message above
Check the docker version of your machine by
docker --version
I was facing the same issue, and it got solved after upgrading the docker to latest version which is available.
Even the documentation available on docker's official website have not mentioned anything like that.
Once you upgrade docker , Restart the docker by
systemctl restart docker
The error will be gone, and new changes will start reflecting

Resources