docker / docker-install

Docker installation script
https://get.docker.com
Apache License 2.0
2.43k stars 781 forks source link

Rootless docker installation fails intermittently for Azure Ubuntu 18 #274

Open Priyanshu-xcde opened 2 years ago

Priyanshu-xcde commented 2 years ago

Hi,

I'm following these steps to add rootless docker support for Azure Ubuntu18. 50% of time it works and 50% of time the rootless docker script fails with an error:

Cannot connect to the Docker daemon at unix:///run/user/1066/docker.sock. Is the docker daemon running?

Steps being followed:

export USERNAME="rootlessTemp" export GROUPNAME="rootlessTemp"

sudo mkdir -p /home/$USERNAME/.local/share/docker sudo mkdir -p /home/$USERNAME/.config/systemd/user

sudo groupadd -g 1066 $GROUPNAME sudo adduser --system --home /home/$USERNAME --gid 1066 --uid 1066 --shell /bin/bash $USERNAME

sudo chown -R $GROUPNAME:$USERNAME /home/$USERNAME sudo loginctl enable-linger $USERNAME

export XDG_RUNTIME_DIR=/run/user/1066 export HOME=/home/$USERNAME

curl -fsSL https://get.docker.com/rootless | sudo -E -u $USERNAME sh

export PATH=/home/$USERNAME/bin:$PATH export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock

The same changes above works 100% of time for AWS and GCP Ubuntu 18. But fails some of the time on Azure.

Can someone please let me know what might be the issue?

Priyanshu-xcde commented 2 years ago

Detailed logs

1647423709,,ui,error,==> azure-arm: + curl -fsSL https://get.docker.com/rootless 1647423709,,ui,error,==> azure-arm: + sudo -E -u rootlessTemp sh 1647423709,,ui,message, azure-arm: The home directory/home/rootlessTemp' already exists. Not copying from /etc/skel'. 1647423709,,ui,message, azure-arm: # Installing stable version 20.10.12 1647423709,,ui,error,==> azure-arm: % Total % Received % Xferd Average Speed Time Time Time Current 1647423709,,ui,error,==> azure-arm: Dload Upload Total Spent Left Speed 1647423710,,ui,error,==> azure-arm: 100 60.4M 100 60.4M 0 0 56.2M 0 0:00:01 0:00:01 --:--:-- 56.2M 1647423710,,ui,error,==> azure-arm: % Total % Received % Xferd Average Speed Time Time Time Current 1647423710,,ui,error,==> azure-arm: Dload Upload Total Spent Left Speed 1647423710,,ui,error,==> azure-arm: 100 18.0M 100 18.0M 0 0 60.5M 0 --:--:-- --:--:-- --:--:-- 60.5M 1647423712,,ui,error,==> azure-arm: + PATH=/home/rootlessTemp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin /home/rootlessTemp/bin/dockerd-rootless-setuptool.sh install 1647423713,,ui,message, azure-arm: [INFO] Creating /home/rootlessTemp/.config/systemd/user/docker.service 1647423713,,ui,message, azure-arm: [INFO] starting systemd service docker.service 1647423713,,ui,error,==> azure-arm: + systemctl --user start docker.service 1647423713,,ui,error,==> azure-arm: + sleep 3 1647423716,,ui,error,==> azure-arm: + systemctl --user --no-pager --full status docker.service 1647423716,,ui,error,==> azure-arm: + DOCKER_HOST=unix:///run/user/1066/docker.sock /home/rootlessTemp/bin/docker version 1647423716,,ui,message, azure-arm: ● docker.service - Docker Application Container Engine (Rootless) 1647423716,,ui,message, azure-arm: Loaded: loaded (/home/rootlessTemp/.config/systemd/user/docker.service; disabled; vendor preset: enabled) 1647423716,,ui,message, azure-arm: Active: active (running) since Wed 2022-03-16 09:41:53 UTC; 3s ago 1647423716,,ui,message, azure-arm: Docs: https://docs.docker.com/go/rootless/ 1647423716,,ui,message, azure-arm: Main PID: 19982 (rootlesskit) 1647423716,,ui,message, azure-arm: CGroup: /user.slice/user-1066.slice/user@1066.service/docker.service 1647423716,,ui,message, azure-arm: ├─19982 rootlesskit --net=vpnkit --mtu=1500 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto --disable-host-loopback --port-driver=builtin --copy-up=/etc --copy-up=/run --propagation=rslave /home/rootlessTemp/bin/dockerd-rootless.sh 1647423716,,ui,message, azure-arm: ├─19987 /proc/self/exe --net=vpnkit --mtu=1500 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto --disable-host-loopback --port-driver=builtin --copy-up=/etc --copy-up=/run --propagation=rslave /home/rootlessTemp/bin/dockerd-rootless.sh 1647423716,,ui,message, azure-arm: └─19995 rootlesskit --net=vpnkit --mtu=1500 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto --disable-host-loopback --port-driver=builtin --copy-up=/etc --copy-up=/run --propagation=rslave /home/rootlessTemp/bin/dockerd-rootless.sh 1647423716,,ui,message, azure-arm: 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + net=vpnkit 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + [ -z ] 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + mtu=1500 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + [ -z ] 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + _DOCKERD_ROOTLESS_CHILD=1 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + export _DOCKERD_ROOTLESS_CHILD 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + id -u 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + [ 1066 = 0 ] 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + command -v selinuxenabled 1647423716,,ui,message, azure-arm: Mar 16 09:41:53 pkrvmtp631f95zl dockerd-rootless.sh[19982]: + exec rootlesskit --net=vpnkit --mtu=1500 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto --disable-host-loopback --port-driver=builtin --copy-up=/etc --copy-up=/run --propagation=rslave /home/rootlessTemp/bin/dockerd-rootless.sh 1647423716,,ui,message, azure-arm: Client: 1647423716,,ui,message, azure-arm: Version: 20.10.12 1647423716,,ui,error,==> azure-arm: Cannot connect to the Docker daemon at unix:///run/user/1066/docker.sock. Is the docker daemon running? 1647423716,,ui,message, azure-arm: API version: 1.41 1647423716,,ui,message, azure-arm: Go version: go1.16.12 1647423716,,ui,message, azure-arm: Git commit: e91ed57 1647423716,,ui,message, azure-arm: Built: Mon Dec 13 11:40:57 2021 1647423716,,ui,message, azure-arm: OS/Arch: linux/amd64 1647423716,,ui,message, azure-arm: Context: default 1647423716,,ui,message, azure-arm: Experimental: true

AkihiroSuda commented 2 years ago

Maybe you have to increase this sleep 3?

https://github.com/moby/moby/blob/87a90dc786bda134c9eb02adbae2c6a7342fb7f6/contrib/dockerd-rootless-setuptool.sh#L327

Priyanshu-xcde commented 2 years ago

@AkihiroSuda - Thanks for the response.

I will try increasing this, however after some updates that happened in rootless docker on 21st March, I'm seeing rootless installation issues on Ubuntu18. I will add details in separate post.

But, I will try this once my other issue is resolved