2023-12-05 17:45:59 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-12-08 14:52:26 +01:00
|
|
|
sudo apt install -y uidmap slirp4netns rootlesskit
|
2023-12-05 17:45:59 +01:00
|
|
|
|
|
|
|
if ! grep -q '/usr/share/docker.io/contrib' "$HOME/.profile" > /dev/null; then
|
|
|
|
echo 'export PATH="/usr/share/docker.io/contrib:$PATH"' >> "$HOME/.profile"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! grep -q 'DOCKER_HOST' "$HOME/.profile" > /dev/null; then
|
|
|
|
echo "export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock" >> "$HOME/.profile"
|
|
|
|
fi
|
|
|
|
|
|
|
|
sudo loginctl enable-linger "$USER"
|
|
|
|
|
|
|
|
PATH="/usr/share/docker.io/contrib:$PATH" dockerd-rootless-setuptool.sh install
|
|
|
|
|
2024-02-15 15:58:23 +01:00
|
|
|
mkdir -p "$HOME/.config/systemd/user/docker.service.d"
|
|
|
|
|
|
|
|
cat << EOF > "$HOME/.config/systemd/user/docker.service.d/override.conf"
|
|
|
|
[Service]
|
|
|
|
Environment="DOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns"
|
|
|
|
Environment="DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
systemctl --user enable docker
|
|
|
|
systemctl --user restart docker
|