Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker] Should we start the daemon as part of the install? #20

Open
dhirschfeld opened this issue Jul 19, 2022 · 3 comments
Open

[docker] Should we start the daemon as part of the install? #20

dhirschfeld opened this issue Jul 19, 2022 · 3 comments

Comments

@dhirschfeld
Copy link
Member

Probably?

Currently, testing the version blows up:

+ docker version
Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:02:46 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
@dhirschfeld
Copy link
Member Author

https://dev.to/bowmanjd/install-docker-on-windows-wsl-without-docker-desktop-34m9

@dhirschfeld
Copy link
Member Author

sudo usermod -aG docker $USER

Need to do magic to find correct $USER

@dhirschfeld
Copy link
Member Author

dhirschfeld commented Jul 19, 2022

DOCKER_DIR=/mnt/wsl/shared-docker
mkdir -pm o=,ug=rwx "$DOCKER_DIR"
chgrp docker "$DOCKER_DIR"
sudo mkdir /etc/docker/
sudo tee /etc/docker/daemon.json << EOF
{
  "hosts": ["unix:///mnt/wsl/shared-docker/docker.sock"]
}
EOF

Necessary startup script:

❯ cat /etc/profile.d/07-docker-daemon.sh
DOCKER_DISTRO="Ubuntu-22.04"
DOCKER_DIR=/mnt/wsl/shared-docker
DOCKER_SOCK="$DOCKER_DIR/docker.sock"
export DOCKER_HOST="unix://$DOCKER_SOCK"
if [ ! -S "$DOCKER_SOCK" ]; then
    mkdir -pm o=,ug=rwx "$DOCKER_DIR"
    chgrp docker "$DOCKER_DIR"
    /mnt/c/Windows/System32/wsl.exe -u root -d $DOCKER_DISTRO sh -c "nohup sudo -b dockerd < /dev/null > $DOCKER_DIR/dockerd.log 2>&1"
fi

Necessary env-var:

export DOCKER_HOST="unix:///mnt/wsl/shared-docker/docker.sock"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant