-
Notifications
You must be signed in to change notification settings - Fork 527
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
Make volumes accessible on SELinux systems by adding relabel option. #3289
Conversation
I'm reluctant to have this flag added by default to all volume mounts in all We have logic to implicitly add several volume mappings as needed for debugging .NET and Python. If there are conflicts; i.e. if the user specifies a volume mapping to the same destination in the container, the user's input will be respected. In the example above I'm taking advantage of that logic to get Do you think updating package.json with |
More changes are needed besides updating
I'll look into this a bit deeper and get back to you. |
In addition to the changes to {
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build: debug"
],
"dockerRun": {
"volumes": [
{
"containerPath": "/src",
"localPath": "${workspaceFolder}",
"permissions": "rw,z"
},
{
"containerPath": "/app",
"localPath": "${workspaceFolder}",
"permissions": "rw,z"
},
{
"containerPath": "/remote_debugger",
"localPath": "~/.vsdbg",
"permissions": "ro,z"
},
{
"containerPath": "/root/.nuget/packages",
"localPath": "~/.nuget/packages",
"permissions": "ro,z"
},
]
},
"netCore": {
"appProject": "${workspaceFolder}/Net6.csproj",
"enableDebugging": true
}
}, This should work today albeit with the warning squiggles. For a Windows host, just replace the |
The comment in the docker docs is out-of-date with the implementation. It will not accept any of the paths mentioned for relabeling. Trying to relabel them will cause docker to fail. That means it is not a good idea to unconditionally add the 'z' as the PR is currently doing.
We should make a change that the volumes used for debugging are relabeled. Then they work out of the box on systems with SELinux. @bwateratmsft do you have a suggestion on how to change export interface DockerContainerVolume {
localPath: string;
containerPath: string;
permissions?: 'ro' | 'rw';
} |
Should we set it so that that flag is only added when For |
@bwateratmsft I've added the |
@bwateratmsft I had reverted the wrong commit. I've fixed it now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@bwateratmsft I've addressed your feedback. ptal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks @tmds!
This is now released in Docker extension version 1.19.0. |
The volumes mounted by the plugin are not accessible in the container on SELinux systems like Fedora and RHEL.
They need to be relabeled.
For more info see the Labeling Volume Mounts section in https://docs.podman.io/en/latest/markdown/podman-run.1.html.
@bwateratmsft ptal.