Skip to content

Docker Outside Docker: /run/docker.sock sometimes not linked to /run/docker-host.sock #78

@PseudoResonance

Description

@PseudoResonance

When I first start VS Code, it loads into a devcontainer with alpine docker outside docker. When I run docker container ls, it says Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Upon checking /run, I see that docker.sock and docker-host.sock both exist, however using readlink -f /run/docker.sock indicates that docker.sock isn't linked.

total 12
drwxr-xr-x    1 root     root          4096 Feb 12 10:44 .
drwxr-xr-x    1 root     root          4096 Feb 12 10:44 ..
srw-rw----    1 root     ping             0 Feb 13 04:34 docker-host.sock
srw-rw----    1 user     root             0 Feb 12 10:44 docker.sock
drwx--x--x    2 root     root          4096 Jan 30 07:31 sudo

If I then run sudo rm /run/docker.sock and sudo ln -s /run/docker-host.sock /run/docker.sock and fix permissions, I can correctly run docker commands.

Interestingly, if I run the VS Code task, "Dev Containers: Rebuild Container", Docker will be working correctly on the second boot, just not the first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions