-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
First you need to sign your commits. git commit -a --amend -s |
Signed-off-by: William Entriken <[email protected]>
04ae612
to
d0bb2cc
Compare
@rhatdan Thank you, pushed. Hmm I need to reconfigure VS Code... |
Changes LGTM, thx @fulldecent |
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. |
A friendly reminder that this PR had no activity for 30 days. |
@fulldecent Any update on this |
[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 |
@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. |
@fulldecent what issue are you seeing? |
@rhatdan When I am attempting the process as per this new documentation, I get this error: Using the same process with Docker installed works. |
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. |
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. |
Cool, here is what I just tried: First I uninstalled, using these instructions from: #11319 (comment)
Then I installed using these instructions from https://podman.io/getting-started/installation#macos
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
|
For me the container starts but the id isn't correct so I can't change anything in my project Inside the container:
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:
|
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:
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" |
Could you squash and sign your commits git rebase -i origin |
@creaky Sadly both options don't work for me. For the rootfull option, do you change your VM to rootfull? |
@c-goes The root user is for a rootless container. There are many possible reasons for failure including:
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 :-) |
Friendly ping. Can we kick this PR over the finish line? |
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. |
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. |
Closing as @jakecorrenti is now working on this and will open a separate PR |
Does this PR introduce a user-facing change?