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

Update the container documentation for better Podman support #7978

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

samuel-garmany
Copy link

I found the instructions for using Podman with Devcontainers weren't working for me and other users. I had permission errors where after building the container Podman would try to make directories in the container and not be able to. This fix worked for me and is made up of fixes from other people so I imagine I'm not the only one with these issues. If there's a better way to achieve this functionality or formatting problems with my changes please let me know. I just want this to be more easily accessible information.

@ntrogh
Copy link
Contributor

ntrogh commented Jan 30, 2025

Looping in @chrmarti - can you review this PR?

@ntrogh ntrogh requested a review from chrmarti January 30, 2025 22:00
@ntrogh
Copy link
Contributor

ntrogh commented Jan 30, 2025

@samuel-garmany Thanks for taking the time to create this PR. We'll look into it.

@samuel-garmany
Copy link
Author

@microsoft-github-policy-service agree

@samuel-garmany
Copy link
Author

@samuel-garmany Thanks for taking the time to create this PR. We'll look into it.

There may be a better way to make this work so hopefully we can get some more opinions here.

Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Left a few comments.

To work around issues where Podman lacks permissions to create a directory in the new devcontainer, you can set Podman to build images with the Docker format, disable labling containers with SELinux, and maintain the user's UID and GID

```toml
[containers]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this located? If it's user configuration this would affect all Podman containers I guess?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, this configuration file should be located at ~/.config/containers/containers.conf. It will affect all containers build by podman. I haven't noticed a difference outside of devcontainers working but it is something that could be noted by the docs.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alviz22 Thats not how containers.conf works, you can’t just delete that line.

"containerEnv": {
"HOME": "/home/node"
}
"containerUser": "vscode"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting HOME is an alternative to this. Not sure what's best, but keeping the container user as root allows entrypoints to run as root which is sometimes needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my experience setting HOME did not fix this issue and I still had build problems where permission to create directories was denied. I understand the concern that you can't set the container user to root but the alternative for me was that I couldn't connect to the container at all. This may be an artifact of an immutable OS though so if someone else has experience that would probably be helpful.

@samuel-garmany
Copy link
Author

It's been some time so I'm just checking on this. I added some clarification to what files need to be updated and I've been using this configuration for a few weeks. It may not be perfect but I haven't found a better option and this may just be the price of using podman.

Thanks!

@ntrogh
Copy link
Contributor

ntrogh commented Feb 19, 2025

@chrmarti Any additional feedback on this PR?

@chrmarti
Copy link
Contributor

There is progress on microsoft/vscode-remote-release#10707 and microsoft/vscode-remote-release#10706 that will simplify the instructions we need in the documentation. I'm working on getting these released today or tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants