vscode-dev-containers icon indicating copy to clipboard operation
vscode-dev-containers copied to clipboard

Ubuntu common feature breaks on rootless podman on WSL

Open Clockwork-Muse opened this issue 3 years ago • 1 comments

(reporting here because this is where features are hosted) This was working until last week, I believe.

  • VSCode Version: 1.68.1 (user setup)
  • Local OS Version: Windows_NT x64 10.0.22000
  • Local chip architecture: x86_64
  • Reproduces in: Remote Containers
  • Name of Dev Container Definition with Issue: Ubuntu common feature

Steps to Reproduce:

  1. Install WSL
  2. Set podman as the executable path instead of docker.
  3. Install Ubuntu (installed 22.04 from the Windows store GUI) and update it (sudo apt-get update && sudo apt-get -y upgrade)
  4. Mount root as shared (ignore the error/warning from tee):
$ sudo tee -a /etc/wsl.conf >&- <<EOF
#Necessary to quiet a podman warning
[boot]
command="mount --make-rshared /"
EOF
  1. Add necessary entries for XDG runtime directories:
$ cat << 'EOF' >> ~/.bashrc

if [[ -z "$XDG_RUNTIME_DIR" ]]; then
  export XDG_RUNTIME_DIR=/run/user/$UID
  if [[ ! -d "$XDG_RUNTIME_DIR" ]]; then
    export XDG_RUNTIME_DIR=/tmp/$USER-runtime
    if [[ ! -d "$XDG_RUNTIME_DIR" ]]; then
      mkdir -m 0700 "$XDG_RUNTIME_DIR"
    fi
  fi
fi
EOF
  1. Restart WSL; From a Windows command prompt: wsl --shutdown

  2. Install podman: sudo apt-get -y install podman

  3. Create user-specific config to allow podman to run as rootless;

    • mkdir -p ~/.config/containers
    • cp /usr/share/containers/containers.conf ~/.config/containers/
    • sed -i 's|#cgroup_manager = "systemd"|cgroup_manager = "cgroupfs"|g' ~/.config/containers/containers.conf
    • sed -i 's|#events_logger = "journald"|events_logger = "file"|g' ~/.config/containers/containers.conf
    • sed -i 's|#\(log_driver = "k8s-file"\)|\1|g' ~/.config/containers/containers.conf
  4. Create a temp repro and open in VSCode: mkdir -p ~/repositories/repro && code ~/repositories/repro/

  5. Add dev container config files as appropriate (see attached - there are some podman-specific settings for rootless/inside-container users required) repro.zip

  6. Attempt to open in dev container, see logs. remoteContainers-2022-06-16T23-12-06.157Z.log

Note that it's just the use of it as a feature - downloading the script manually during dockerfile build works just fine. working.zip

Clockwork-Muse avatar Jun 16 '22 23:06 Clockwork-Muse

cc @joshspicer for any thoughts as this seems to be feature related.

bamurtaugh avatar Jun 27 '22 16:06 bamurtaugh