docker / docker/docker-install

Rootless docker, auto start problem.

Open
#208 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
3.2k
Forks
863
Avg merge
3h 15m
Merged PRs (30d)
2

Description

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

Here's what I've done and wanting a solution:

  1. Created a user 'docker' on my CentOS 7.9.
  2. Ran the curl -fsSL https://get.docker.com/rootless | sh
  3. Created /etc/systemd/system/docker-rootless.service as root with below contents:
    `[Unit]
    Description=Docker Rootless Startup
    After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/su -c /home/docker/bin/dockerd-rootless.sh - docker
TimeoutStartSec=0

[Install]
WantedBy=default.target`

  1. Ran systemctl daemon-reload
  2. Last but not least, systemctl enable docker-rootless.service which created the symlink.
  3. Reboot.

However, the dockerd-rootless.sh runs, gets a PID but when running docker ps it returns:
Cannot connect to the Docker daemon at unix:///docker.sock. Is the docker daemon running?

I've tried adding:
export DOCKER_HOST=unix:///run/user/1001/docker.sock export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock

to the .bashrc of the docker user.

Any help would be greatly appreciated.
Cheers.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing /etc/systemd/system/docker-rootless.service and the docker user's .bashrc, then reproduce the reboot and run the reported docker ps command. Check whether dockerd-rootless.sh is using the same runtime socket and environment as the client; done means the rootless daemon starts automatically and docker ps connects successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, shell
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.