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

[CI:DOCS] Add documentation for podman with VS Code [WIP] #15254

Closed
wants to merge 4 commits into from

Conversation

fulldecent
Copy link
Contributor

Does this PR introduce a user-facing change?

Add documentation for setting up Podman inside VS Code

@fulldecent fulldecent marked this pull request as draft August 9, 2022 14:54
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2022
@rhatdan
Copy link
Member

rhatdan commented Aug 9, 2022

First you need to sign your commits.

git commit -a --amend -s
git push --force

@rhatdan
Copy link
Member

rhatdan commented Aug 9, 2022

@TomSweeneyRedHat @vrothberg PTAL

@fulldecent fulldecent force-pushed the vs-code-documentation branch from 04ae612 to d0bb2cc Compare August 9, 2022 18:17
@fulldecent
Copy link
Contributor Author

@rhatdan Thank you, pushed. Hmm I need to reconfigure VS Code...

docs/tutorials/vs_code.md Outdated Show resolved Hide resolved
@TomSweeneyRedHat
Copy link
Member

Changes LGTM, thx @fulldecent

@fulldecent
Copy link
Contributor Author

Just got a lot more progress in here.

The instructions are currently work if you are using Docker, but I am missing a few steps here to make it work with podman. Need a little help testing these instructions and fixing that.

@github-actions
Copy link

A friendly reminder that this PR had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Oct 12, 2022

@fulldecent Any update on this
/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 12, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fulldecent, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2022
@fulldecent
Copy link
Contributor Author

@rhatdan The article is good and almost nearly correct.

The problem is that I don't know how to make podman work and so I can't finish the documentation.

@rhatdan
Copy link
Member

rhatdan commented Oct 13, 2022

@fulldecent what issue are you seeing?

@fulldecent
Copy link
Contributor Author

@rhatdan When I am attempting the process as per this new documentation, I get this error:

Screen Shot 2022-10-13 at 10 03 23

Using the same process with Docker installed works.

@rhatdan
Copy link
Member

rhatdan commented Oct 13, 2022

The retry button is hiding the error. Is it complaining about a source directory not existing on the host? That is something Podman requires to be created, while docker creates it for you.

@fulldecent
Copy link
Contributor Author

VS Code has a dumb UI where you can't actually see the error. So I managed to screenshot it before it disappeared.

Screen Shot 2022-10-13 at 15 52 21

So retyped that command and ran it myself in terminal and got the same error. But I can confirm that this directory does indeed exist.

Screen Shot 2022-10-13 at 15 56 33

@rhatdan
Copy link
Member

rhatdan commented Oct 15, 2022

What version of Podman are you using?

Newer versions of Podman mount $HOME at $HOME inside of the VM, so things like this work.

You could destroy the VM and Recreate it with

$ podman machine init -v $HOME:$HOME

And then try the command again. I think the problem is your homedir is not mounted within the Machine.

@fulldecent
Copy link
Contributor Author

Cool, here is what I just tried:

First I uninstalled, using these instructions from: #11319 (comment)

podman list
podman machine list
podman machine stop podman-machine-default
podman machine rm podman-machine-default
ps aux|grep podman
 brew uninstall podman

Then I installed using these instructions from https://podman.io/getting-started/installation#macos

brew install podman
podman machine init
podman machine start
podman info

Here is info:

```toml host: arch: arm64 buildahVersion: 1.27.0 cgroupControllers: - cpu - io - memory - pids cgroupManager: systemd cgroupVersion: v2 conmon: package: conmon-2.1.4-2.fc36.aarch64 path: /usr/bin/conmon version: 'conmon version 2.1.4, commit: ' cpuUtilization: idlePercent: 59.49 systemPercent: 28.82 userPercent: 11.68 cpus: 1 distribution: distribution: fedora variant: coreos version: "36" eventLogger: journald hostname: localhost.localdomain idMappings: gidmap: - container_id: 0 host_id: 1000 size: 1 - container_id: 1 host_id: 100000 size: 1000000 uidmap: - container_id: 0 host_id: 501 size: 1 - container_id: 1 host_id: 100000 size: 1000000 kernel: 5.19.12-200.fc36.aarch64 linkmode: dynamic logDriver: journald memFree: 1292558336 memTotal: 2051575808 networkBackend: netavark ociRuntime: name: crun package: crun-1.6-2.fc36.aarch64 path: /usr/bin/crun version: |- crun version 1.6 commit: 18cf2efbb8feb2b2f20e316520e0fd0b6c41ef4d spec: 1.0.0 +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL os: linux remoteSocket: exists: true path: /run/user/501/podman/podman.sock security: apparmorEnabled: false capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT rootless: true seccompEnabled: true seccompProfilePath: /usr/share/containers/seccomp.json selinuxEnabled: true serviceIsRemote: true slirp4netns: executable: /usr/bin/slirp4netns package: slirp4netns-1.2.0-0.2.beta.0.fc36.aarch64 version: |- slirp4netns version 1.2.0-beta.0 commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64 libslirp: 4.6.1 SLIRP_CONFIG_VERSION_MAX: 3 libseccomp: 2.5.3 swapFree: 0 swapTotal: 0 uptime: 0h 1m 48.00s plugins: authorization: null log: - k8s-file - none - passthrough - journald network: - bridge - macvlan volume: - local registries: search: - docker.io store: configFile: /var/home/core/.config/containers/storage.conf containerStore: number: 0 paused: 0 running: 0 stopped: 0 graphDriverName: overlay graphOptions: {} graphRoot: /var/home/core/.local/share/containers/storage graphRootAllocated: 106825756672 graphRootUsed: 2305404928 graphStatus: Backing Filesystem: xfs Native Overlay Diff: "true" Supports d_type: "true" Using metacopy: "false" imageCopyTmpDir: /var/tmp imageStore: number: 0 runRoot: /run/user/501/containers volumePath: /var/home/core/.local/share/containers/storage/volumes version: APIVersion: 4.2.1 Built: 1662580765 BuiltTime: Wed Sep 7 15:59:25 2022 GitCommit: "" GoVersion: go1.18.5 Os: linux OsArch: linux/arm64 Version: 4.2.1 ```

Next I started over in VS Code and now here are the errors I get:

``` [2022-10-15T13:36:58.548Z] Remote-Containers 0.245.2 in VS Code 1.70.2 (e4503b30fc78200f846c62cf8091b76ff5547662). [2022-10-15T13:36:58.548Z] Start: Resolving Remote [2022-10-15T13:36:58.558Z] Setting up container for folder or workspace: /Users/williamentriken/Desktop/tmp [2022-10-15T13:36:58.560Z] Start: Check Docker is running [2022-10-15T13:36:58.561Z] Start: Run: podman version --format {{.Server.APIVersion}} [2022-10-15T13:36:58.701Z] Stop (140 ms): Run: podman version --format {{.Server.APIVersion}} [2022-10-15T13:36:58.702Z] Server API version: 4.2.1 [2022-10-15T13:36:58.702Z] Stop (142 ms): Check Docker is running [2022-10-15T13:36:58.702Z] Start: Run: podman volume ls -q [2022-10-15T13:36:58.787Z] Stop (85 ms): Run: podman volume ls -q [2022-10-15T13:36:58.792Z] Start: Run: podman ps -q -a --filter label=vsch.local.folder=/Users/williamentriken/Desktop/tmp --filter label=vsch.quality=stable [2022-10-15T13:36:58.882Z] Stop (90 ms): Run: podman ps -q -a --filter label=vsch.local.folder=/Users/williamentriken/Desktop/tmp --filter label=vsch.quality=stable [2022-10-15T13:36:58.882Z] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/Users/williamentriken/Desktop/tmp [2022-10-15T13:36:58.964Z] Stop (82 ms): Run: podman ps -q -a --filter label=devcontainer.local_folder=/Users/williamentriken/Desktop/tmp [2022-10-15T13:36:58.964Z] Start: Run: podman inspect --type container 1009969da0b3 [2022-10-15T13:36:59.046Z] Stop (82 ms): Run: podman inspect --type container 1009969da0b3 [2022-10-15T13:36:59.047Z] Start: Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/williamentriken/.vscode/extensions/ms-vscode-remote.remote-containers-0.245.2/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/williamentriken/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --docker-path podman --docker-compose-path podman-compose --workspace-folder /Users/williamentriken/Desktop/tmp --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/williamentriken/Desktop/tmp --log-level debug --log-format json --config /Users/williamentriken/Desktop/tmp/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true [2022-10-15T13:36:59.147Z] remote-containers 0.245.2. [2022-10-15T13:36:59.147Z] Start: Run: podman buildx version [2022-10-15T13:36:59.163Z] Stop (16 ms): Run: podman buildx version [2022-10-15T13:36:59.163Z] Start: Resolving Remote [2022-10-15T13:36:59.164Z] Start: Run: git rev-parse --show-cdup [2022-10-15T13:36:59.168Z] Stop (4 ms): Run: git rev-parse --show-cdup [2022-10-15T13:36:59.168Z] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/Users/williamentriken/Desktop/tmp [2022-10-15T13:36:59.254Z] Stop (86 ms): Run: podman ps -q -a --filter label=devcontainer.local_folder=/Users/williamentriken/Desktop/tmp [2022-10-15T13:36:59.254Z] Start: Run: podman inspect --type container 1009969da0b3 [2022-10-15T13:36:59.344Z] Stop (90 ms): Run: podman inspect --type container 1009969da0b3 [2022-10-15T13:36:59.344Z] Start: Starting container [2022-10-15T13:36:59.344Z] Start: Run: podman start 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:36:59.537Z] Stop (193 ms): Run: podman start 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:36:59.537Z] Stop (193 ms): Starting container [2022-10-15T13:36:59.537Z] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/Users/williamentriken/Desktop/tmp [2022-10-15T13:36:59.617Z] Stop (80 ms): Run: podman ps -q -a --filter label=devcontainer.local_folder=/Users/williamentriken/Desktop/tmp [2022-10-15T13:36:59.617Z] Start: Run: podman inspect --type container 1009969da0b3 [2022-10-15T13:36:59.701Z] Stop (84 ms): Run: podman inspect --type container 1009969da0b3 [2022-10-15T13:36:59.701Z] Start: Inspecting container [2022-10-15T13:36:59.701Z] Start: Run: podman inspect --type container 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:36:59.784Z] Stop (83 ms): Run: podman inspect --type container 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:36:59.784Z] Stop (83 ms): Inspecting container [2022-10-15T13:36:59.785Z] Start: Run in container: /bin/sh [2022-10-15T13:36:59.786Z] Start: Run in container: uname -m [2022-10-15T13:36:59.884Z] aarch64 [2022-10-15T13:36:59.884Z] [2022-10-15T13:36:59.884Z] Stop (98 ms): Run in container: uname -m [2022-10-15T13:36:59.884Z] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null [2022-10-15T13:36:59.885Z] PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" [2022-10-15T13:36:59.885Z] [2022-10-15T13:36:59.885Z] Stop (1 ms): Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null [2022-10-15T13:36:59.885Z] Start: Run in container: cat /etc/passwd [2022-10-15T13:36:59.887Z] Stop (2 ms): Run in container: cat /etc/passwd [2022-10-15T13:36:59.887Z] Start: Run in container: test -f '/var/devcontainer/.patchEtcEnvironmentMarker' [2022-10-15T13:36:59.888Z] [2022-10-15T13:36:59.888Z] [2022-10-15T13:36:59.888Z] Stop (1 ms): Run in container: test -f '/var/devcontainer/.patchEtcEnvironmentMarker' [2022-10-15T13:36:59.888Z] Start: Run in container: test -f '/var/devcontainer/.patchEtcProfileMarker' [2022-10-15T13:36:59.888Z] [2022-10-15T13:36:59.888Z] [2022-10-15T13:36:59.888Z] Stop (0 ms): Run in container: test -f '/var/devcontainer/.patchEtcProfileMarker' [2022-10-15T13:36:59.888Z] Stop (725 ms): Resolving Remote [2022-10-15T13:36:59.890Z] Stop (843 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/williamentriken/.vscode/extensions/ms-vscode-remote.remote-containers-0.245.2/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/williamentriken/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --docker-path podman --docker-compose-path podman-compose --workspace-folder /Users/williamentriken/Desktop/tmp --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/williamentriken/Desktop/tmp --log-level debug --log-format json --config /Users/williamentriken/Desktop/tmp/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true [2022-10-15T13:36:59.890Z] Start: Run: podman inspect --type container 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:36:59.981Z] Stop (91 ms): Run: podman inspect --type container 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:36:59.981Z] Start: Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/williamentriken/.vscode/extensions/ms-vscode-remote.remote-containers-0.245.2/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /Users/williamentriken/Desktop/tmp --log-level debug --log-format json --config /Users/williamentriken/Desktop/tmp/.devcontainer/devcontainer.json --mount-workspace-git-root true [2022-10-15T13:37:00.084Z] remote-containers 0.245.2. [2022-10-15T13:37:00.084Z] Start: Run: git rev-parse --show-cdup [2022-10-15T13:37:00.089Z] Stop (5 ms): Run: git rev-parse --show-cdup [2022-10-15T13:37:00.091Z] Stop (110 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/williamentriken/.vscode/extensions/ms-vscode-remote.remote-containers-0.245.2/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /Users/williamentriken/Desktop/tmp --log-level debug --log-format json --config /Users/williamentriken/Desktop/tmp/.devcontainer/devcontainer.json --mount-workspace-git-root true [2022-10-15T13:37:00.091Z] Start: Inspecting container [2022-10-15T13:37:00.091Z] Start: Run: podman inspect --type container 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:37:00.183Z] Stop (92 ms): Run: podman inspect --type container 1009969da0b36d47030fa22b3434434dfd4fab4697a49928ec7db1ad67be44a9 [2022-10-15T13:37:00.183Z] Stop (92 ms): Inspecting container [2022-10-15T13:37:00.184Z] Start: Run in container: /bin/sh [2022-10-15T13:37:00.185Z] Start: Run in container: uname -m [2022-10-15T13:37:00.282Z] aarch64 [2022-10-15T13:37:00.282Z] [2022-10-15T13:37:00.282Z] Stop (97 ms): Run in container: uname -m [2022-10-15T13:37:00.282Z] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null [2022-10-15T13:37:00.284Z] PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" [2022-10-15T13:37:00.284Z] [2022-10-15T13:37:00.284Z] Stop (2 ms): Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null [2022-10-15T13:37:00.284Z] Start: Run in container: cat /etc/passwd [2022-10-15T13:37:00.285Z] Stop (1 ms): Run in container: cat /etc/passwd [2022-10-15T13:37:00.285Z] Start: Setup shutdown monitor [2022-10-15T13:37:00.286Z] Forking shutdown monitor: /Users/williamentriken/.vscode/extensions/ms-vscode-remote.remote-containers-0.245.2/dist/shutdown/shutdownMonitorProcess /var/folders/02/1n_qs97x3f17c9csq1rppqqw0000gn/T/vscode-remote-containers-ebbb2e4bb85d2501ddabaf4ce7fd6742a8085080.sock singleContainer Debug /Users/williamentriken/Library/Application Support/Code/logs/20221015T093652/exthost1/ms-vscode-remote.remote-containers 1665841018483 [2022-10-15T13:37:00.287Z] Stop (2 ms): Setup shutdown monitor [2022-10-15T13:37:00.287Z] Start: Run in container: test -d /root/.vscode-server [2022-10-15T13:37:00.288Z] [2022-10-15T13:37:00.288Z] [2022-10-15T13:37:00.288Z] Exit code 1 [2022-10-15T13:37:00.289Z] Stop (2 ms): Run in container: test -d /root/.vscode-server [2022-10-15T13:37:00.289Z] Start: Run in container: test -d /root/.vscode-remote [2022-10-15T13:37:00.289Z] [2022-10-15T13:37:00.289Z] [2022-10-15T13:37:00.290Z] Exit code 1 [2022-10-15T13:37:00.290Z] Stop (1 ms): Run in container: test -d /root/.vscode-remote [2022-10-15T13:37:00.290Z] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null [2022-10-15T13:37:00.292Z] [2022-10-15T13:37:00.292Z] mkdir: cannot create directory ‘/root’: Permission denied [2022-10-15T13:37:00.292Z] Exit code 1 [2022-10-15T13:37:00.292Z] Stop (2 ms): Run in container: test ! -f '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null [2022-10-15T13:37:00.292Z] Start: Run in container: cat /root/.vscode-server/data/Machine/settings.json [2022-10-15T13:37:00.294Z] [2022-10-15T13:37:00.294Z] cat: /root/.vscode-server/data/Machine/settings.json: Permission denied [2022-10-15T13:37:00.294Z] Exit code 1 [2022-10-15T13:37:00.294Z] Stop (2 ms): Run in container: cat /root/.vscode-server/data/Machine/settings.json [2022-10-15T13:37:00.294Z] Support for ARM64 is in preview.

[2022-10-15T13:37:00.295Z] Start: Run in container: test -d /root/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662
[2022-10-15T13:37:00.295Z]
[2022-10-15T13:37:00.296Z]
[2022-10-15T13:37:00.296Z] Exit code 1
[2022-10-15T13:37:00.296Z] Stop (1 ms): Run in container: test -d /root/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662
[2022-10-15T13:37:00.296Z] Start: Run in container: test -d /vscode/vscode-server/bin/linux-arm64/e4503b30fc78200f846c62cf8091b76ff5547662
[2022-10-15T13:37:00.297Z]
[2022-10-15T13:37:00.297Z]
[2022-10-15T13:37:00.297Z] Exit code 1
[2022-10-15T13:37:00.297Z] Stop (1 ms): Run in container: test -d /vscode/vscode-server/bin/linux-arm64/e4503b30fc78200f846c62cf8091b76ff5547662
[2022-10-15T13:37:00.297Z] Installing VS Code Server for commit e4503b30fc78200f846c62cf8091b76ff5547662
[2022-10-15T13:37:00.297Z] Start: Run in container: /bin/sh
[2022-10-15T13:37:00.298Z] Start: Downloading VS Code Server
[2022-10-15T13:37:00.298Z] e4503b30fc78200f846c62cf8091b76ff5547662 linux-arm64 stable
[2022-10-15T13:37:00.716Z] connect EBADF 152.199.4.33:443
[2022-10-15T13:37:00.716Z] Retrying to download VS Code Server.
[2022-10-15T13:37:00.750Z] Stop (452 ms): Downloading VS Code Server
[2022-10-15T13:37:00.751Z] Error: XHR failed
at XMLHttpRequest.p.onerror (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:70:8827)

</details>

@c-goes
Copy link

c-goes commented Oct 24, 2022

For me the container starts but the id isn't correct so I can't change anything in my project

Inside the container:

$ id
uid=1000(vscode) gid=1000(vscode) groups=1000(vscode),998(nvm),999(pipx)

$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
vscode:x:1000:1000::/home/vscode:/bin/bash
core:*:501:1000:CoreOS Admin:/:/bin/sh

Any recommendations how I can make it work? The mounted files are all owned by 501 but the container user is 1000.

I'm using Podman-Desktop 0.8.0 macOS and this added to devcontainer.json:

	"runArgs": ["--userns=keep-id"],
	"containerUser": "vscode"

@creaky
Copy link

creaky commented Oct 28, 2022

Given use of the Mac and podman-desktop, I am making the assumption the underlying virtualisation provider is qemu.

The UID mappings between host, podman machine and the container is a bit of a mess. Plus qemu has fatal protocol translation bug that was only just recently fixed in release 7.1.0 documented at https://gitlab.com/qemu-project/qemu/-/issues/1010 preventing bind mounts from working. Finally, typical vscode containers use root by default and have the vscode as an additional user that further interferes with the user id mapping.

So, to get it to work:

  1. Ensure qemu version 7.1.0 or later is installed.
  2. Ensure latest podman and podman-desktop is installed.
  3. Add one of the following configurations to devcontainer.json

If happy to run as a container root user.

"containerUser": "root",
"remoteUser": "root"

If happy to run as a non privileged user. Assuming the user "core" matches the podman machine username having the same ID as your real user host user ID. As mentioned earlier being 501 the following should work.

"runArgs": ["--user=501", "--userns=keep-id"],	
"containerUser": "core",
"remoteUser": "core"

@rhatdan
Copy link
Member

rhatdan commented Oct 28, 2022

Could you squash and sign your commits

git rebase -i origin
git commit -a --amend -s
git push --force

@c-goes
Copy link

c-goes commented Nov 1, 2022

@creaky Sadly both options don't work for me. For the rootfull option, do you change your VM to rootfull?

@creaky
Copy link

creaky commented Nov 3, 2022

@c-goes The root user is for a rootless container.

There are many possible reasons for failure including:

  1. SELinux.
  2. Incorrect user/group mappings.
  3. Not using VSCode Insiders build. This is an area of rapid development and the insiders edition is very useful.
  4. Specifying workspaceMount incorrectly.
  5. Not using the latest qemu 7.1+

SELinux labelling can be disabled by using runArgs like below:

"runArgs": ["--security-opt=label=disable", "--user=501", "--userns=keep-id"],	
"containerUser": "core",
"remoteUser": "core"

I would try and fire up the container with SELinux disabled and using the containerUser and remoteUser set to root and see if that makes a difference. Also ensure your devcontainer.json file is really simple and not doing other actions like custom workspace mounts etc.

Review microsoft/vscode-remote-release#6759 which discusses podman and vscode integration for further ideas.

It will be something local to your setup and configuration as I have it successfully working locally on my arm based Mac with podman-desktop, local qemu VM (podman default machine) running a local container controlled from vscode.

Also have it working with the Mac vscode frontend using the remote ssh extension into a remote VM with vscode interacting with the VM podman controlling the remote container.

Do keep persevering with it as it will likely be something simple in the end :-)

@vrothberg
Copy link
Member

Friendly ping. Can we kick this PR over the finish line?

@chris-schuetz
Copy link

I have been playing around with VS Code, Podman and toolbx on Fedora Kinoite. I have started to document my attempts at https://github.com/chris-schuetz/vscode-toolbx. I have VS Code with devcontainer running on podman with some limitations. I haven't finished looking at all those limitations yet, but I will keep updating my repo. Let me know if you want assistance with writing this documentation, I am willing to help.

@fulldecent
Copy link
Contributor Author

Yes please! My goal here is to have steps that work on a fresh install of macOS and result in VS Code using podman just as well as it can use the competition. So far I have some of the steps and the documentation format is decent but it is not working. Looking to know which steps I did wrong.

@mheon
Copy link
Member

mheon commented May 24, 2023

Closing as @jakecorrenti is now working on this and will open a separate PR

@mheon mheon closed this May 24, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants