Skip to content

Instantly share code, notes, and snippets.

@khvn26
Last active August 29, 2024 06:20
Show Gist options
  • Save khvn26/9de497852c9934ded840d53a95434942 to your computer and use it in GitHub Desktop.
Save khvn26/9de497852c9934ded840d53a95434942 to your computer and use it in GitHub Desktop.
SteamOS VSCode + Docker guide

SteamOS VSCode + Docker guide

  1. Install Docker:

    sudo pacman -S docker
  2. Enable Docker systemctl unit:

    sudo systemctl enable docker.service
    sudo systemctl enable containerd.service
  3. Allow X access to containers:

    xhost +si:localuser:$USER
  4. Install distrobox:

    curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh
  5. Create an ubuntu distrobox image with mounted docker.sock:

    distrobox create --name ubuntu-22-04 --image ubuntu:22.04 --volume /var/run/docker.sock:/var/run/docker.sock
  6. The following steps should be executed in the distrobox container. Enter the distrobox container shell:

    distrobox enter ubuntu-22-04
  7. Install Docker CLI and common plugins (Docker installation taken from official docs):

    sudo chmod 666 /var/run/docker.sock
    sudo apt-get update
    sudo apt-get install ca-certificates curl gnupg lsb-release
    sudo mkdir -m 0755 -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt-get update
    sudo apt-get install docker-ce-cli docker-buildx-plugin docker-compose-plugin
    sudo usermod -aG docker $USER
    docker info
  8. Install VSCode (download x64 .deb package here):

    sudo dpkg -i ~/Downloads/code_1.76.2-1678817801_amd64.deb
    sudo apt-get -f install
  9. Allow host xdg-open to process requests from inside the distrobox container:

    sudo ln -s /usr/bin/distrobox-host-exec /usr/local/bin/xdg-open
  10. Export VSCode shortcut:

    distrobox-export --app code

Everything else should work as usual.

@leagrr
Copy link

leagrr commented Jul 1, 2024

Fails on step 5:

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

Someone will roast me for this, but I ended up installing Homebrew to get Docker on here so I could bypass using sudo, using pacman, adding an Ubuntu distrobox, and/or constantly toggling steamos readonly filesystem on and off.

The Homebrew docker from what I understand is essentially the correct docker-ce edition that we want, but it doesn't have Docker Engine, which is where Colima comes in.

So I did

brew install colima docker
colima start

Although something hinky happened and I did a brew uninstall qemu colima and brew install qemu colima once again and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment