Error Starting Docker Daemon on CentOS 7 - docker

Seems like I can't start the Docker service for the first time using systemctl start docker. I keep running into this exact error below:
Error starting daemon: couldn't create plugin manager: error setting plugin manager root to private: permission denied
My docker installation steps on my CentOS 7(64x) machine:
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
systemctl start docker
Yes, the provided commands were run as root.

Related

docker nothing to do, and docker commnad not found

i followed below steps on centos 7 machine to install docker but it says nothing to do and when i run docker command it says that command not found.
i followed below steps on centos 7 machine to install docker but it says nothing to do and when i run docker command it says that command not found.
**sudo yum check-update
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker**
on some other machine same commands worked but its having some strange behaviour on this machine.
running following steps solved the issue:
some how firewall started creating problem , so i had to check
the internet connection as below:
curl --location-trusted --ntlm --user "xyz" www.google.com enter password
yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-3.el7.noarch.rpm
yum -y install docker-ce

Docker friendlyhello app exec: "docker-proxy" and port binding errors

I'm new to docker. I'm following the instructions on the friendlyhello tutorial. I'm running this on a CentOS 7.5 virtual machine, docker --version is 1.13.1. I get to the point where I run docker run -d -p 4000:80 friendlyhello and get :
$ docker run -p 4000:80 friendlyhello
/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint eager_dijkstra (f022a7a52040c54a54d94270e94a4149554be38514c88cb933d77440f43f6092): exec: "docker-proxy": executable file not found in $PATH.
If I run it again :
$ docker run -p 4000:80 friendlyhello
/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint amazing_wiles (cfb767520e0f130d93cb881917320555ea3eccd605dd845b978e062e1aca3b57): Bind for 0.0.0.0:4000 failed: port is already allocated.
I do not have a docker-proxy executable on my machine.
QUESTION :
How do I get friendlyhello to run? Where is docker-proxy?
Evidently I installed docker through just the default yum repos, e.g. yum install docker. This got me docker version 1.13.1. This is incorrect (and non-intuitive), I needed to install it following these instructions from the docker website. This got me docker-proxy and allowed me to run the friendlyhello example (docker version 18.06.1-ce). Reposting the instructions :
## Clean up my previous install
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
### This is the repo to get the correct docker distribution
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum install docker-ce
I also faced exact same issue.
Removing docker completely and installing from official website solved my issue.
Offical Link

"Can not connect to Docker Daemon"

I have a project in which I need to use CircleCi to build a docker application image, and then upload it to the Amazon container repository.
Given that CircleCI also runs on Docker, I created a Docker image for it, which containers a version of Ubuntu, together with AWS CLI, Node and Docker. See Dockerfile below:
FROM ubuntu:16.04
# update libraries
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates curl software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# install docker
RUN apt-get update
RUN apt-cache policy docker-ce
RUN apt-get install -y docker-ce
# <---
RUN systemctl status docker # <--- TROUBLE HERE
# <---
# install node
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt install -y nodejs
# install aws cli
RUN apt-get install -y python-pip python-dev build-essential
RUN pip install --upgrade pip
RUN pip install awscli --upgrade
I am currently having some problems working with this CircleCi docker image, because, if i keep the command RUN systemctl status docker I get the following error:
Failed to connect to bus: No such file or directory The command '/bin/sh -c systemctl status docker' returned a non-zero code: 1
If, on the other, I remove that command, the build is sucessful. However, when I go inside docker sudo docker run -it unad16 and run any docker command, as, f.e., docker images, I get the following error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I have been trying to debug this error since yesterday, but have been unsucessfull. Thus, any help would be truly appreciated.
Notes:
the "daemon" error occurs even when I run docker in priviled mode with sudo docker run -ti --privileged=true unad16
You don't need to run a docker daemon if you want to build a docker image in circleci. Instead you just need an image with docker client, and a circle config with - setup_remote_docker.
Read more in
https://circleci.com/docs/2.0/building-docker-images/
If for some other reason you still want to run a docker service in a docker image, please refer to DockerInDocker repo, especially the README.md part.

Error showing while trying to install Docker CE on Linux Ubuntu 18.04 Bionic?

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
docker-ce
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/33,8 MB of archives.
After this operation, 181 MB of additional disk space will be used.
(
Reading database ... 129600 files and directories currently installed.)
Preparing to unpack .../docker-ce_18.03.1~ce-0~ubuntu_amd64.deb ...
Unpacking docker-ce (18.03.1~ce-0~ubuntu) ...
dpkg: error processing archive /var/cache/apt/archives/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb (--unpack):
trying to overwrite '/usr/bin/docker-containerd', which is also in package docker-containerd 0.2.3+git+docker1.13.1~ds1-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I got this error when trying to install the latest Docker (v20.10.17) on Ubuntu Focal 20.04 (LTS) following the official documentation. I tried installing older versions and got the same error. When running sudo dockerd --debug it showed the real error:
failed to start daemon: Devices cgroup isn't mounted
Cgroupfs (Control Groups) are a kernel mechanism for tracking and imposing limits on resource usage on groups of tasks. So the solution is to mount it. Note that you need to stop the container daemon before mounting the cgroup and then start it again after that.
Stop daemon
sudo systemctl stop containerd
Unmount (just in case) and then mount the cgroup
sudo cgroupfs-umount
sudo cgroupfs-mount
Start the daemon again
sudo systemctl start containerd
sudo systemctl start docker.service
sudo systemctl start docker.socket
If there are errors still, re-install everything
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Test that Docker works
sudo docker run hello-world
I don't see 18.04 listed on the supported list so you may be encountering compatibility issues that the developers have not had time to resolve. To work around your immediate issue, I would uninstall "docker-containerd" and any other dependent packages since that appears to be based on a very old version of docker (1.13).
apt remove docker-containerd
Step 01 - Uninstall old version of Docker
$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ sudo rm -rf /var/lib/docker
$ sudo apt-get autoclean
$ sudo apt-get update
Step 02 - Install Docker-ce:
Install a few prerequisite packages which let APT use packages over HTTPS:
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add the GPG key for the official Docker repository to system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to APT source:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
Update the package database
$ sudo apt update
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo
$ apt-cache policy docker-ce
Finally, install Docker:
$ sudo apt install docker-ce
Verify docker is running
$ sudo systemctl status docker

Centos 7 docker-machine "invalid argument: could not find capabilities for domaintype=kvm"

With a centos 7 minimal machine, I've run the following commands:
yum update -y
yum install -y vim docker wget git net-tools bind-utils iptables-services bridge-utils bash-completion libvirt libvirt-daemon qemu-kvm libvirt-daemon-kvm qemu-img libvirt-python libvirt-client virt-install virt-viewer virt-manager
yum install -y vim docker wget git net-tools bind-utils iptables-services bridge-utils bash-completion libvirt libvirt-daemon qemu-kvm libvirt-daemon-kvm qemu-img libvirt-python libvirt-client virt-install virt-viewer virt-manager
wget https://github.com/openshift/origin/releases/download/v3.6.0/openshift-origin-server-v3.6.0-c4dd4cf-linux-64bit.tar.gz
curl -L https://github.com/docker/machine/releases/download/v0.12.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.10.0/docker-machine-driver-kvm-centos7 > /usr/local/bin/docker-machine-driver-kvm
chmod +x /usr/local/bin/docker-machine-driver-kvm
usermod -a -G libvirt root
systemctl start docker
systemctl enable docker
systemctl start libvirtd
systemctl enable libvirtd
systemctl restart libvirtd
docker-machine create -d "kvm" \
--kvm-boot2docker-url https://github.com/minishift/minishift-b2d-iso/releases/download/v1.1.0/minishift-b2d.iso \
--kvm-cpu-count 4 --kvm-memory 4096 \
--engine-insecure-registry 172.30.0.0/16 openshift
...and get:
[root#localhost ~]# docker-machine create -d "kvm" \
> --kvm-boot2docker-url https://github.com/minishift/minishift-b2d-iso/releases/download/v1.1.0/minishift-b2d.iso \
> --kvm-cpu-count 4 --kvm-memory 4096 \
> --engine-insecure-registry 172.30.0.0/16 openshift
Creating CA: /root/.docker/machine/certs/ca.pem
Creating client certificate: /root/.docker/machine/certs/cert.pem
Running pre-create checks...
Creating machine...
(openshift) Image cache directory does not exist, creating it at /root/.docker/machine/cache...
(openshift) Downloading /root/.docker/machine/cache/boot2docker.iso from https://github.com/minishift/minishift-b2d-iso/releases/download/v1.1.0/minishift-b2d.iso...
(openshift) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
(openshift) Creating SSH key...
(openshift) Failed to create the VM: virError(Code=8, Domain=44, Message='invalid argument: could not find capabilities for domaintype=kvm ')
Error creating machine: Error in driver during machine creation: virError(Code=8, Domain=44, Message='invalid argument: could not find capabilities for domaintype=kvm ')
From googling, all I can find are recommendations to add my user to the libvirtd group, and install additional packages, and I think I've already incorporated all of those steps into my above script.
What am I missing?

Resources