Skip to content

[docker-in-docker] Not working with Docker Desktop and Enhanced Container Isolation #1319

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

Open
koenig-dominik opened this issue Apr 4, 2025 · 0 comments
Assignees

Comments

@koenig-dominik
Copy link

koenig-dominik commented Apr 4, 2025

The feature docker-in-docker fails to start the docker daemon with the error message

mount: /sys/kernel/security: permission denied.
       dmesg(1) may have more information after failed mount system call.
Could not mount /sys/kernel/security.
AppArmor detection and --privileged mode might break.

when using a devcontainer with the Docker Desktop Hyper-V backend and having Enhanced Container Isolation enabled.

The container is started using --privileged however there are still some restrictions:

ECI

Containers become harder to breach. For example, sensitive system calls are vetted and portions of /proc and /sys are emulated inside the container.

This part of the code that checks for AppArmor stops the start, even though it would otherwise work perfectly fine.

    if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
        mount -t securityfs none /sys/kernel/security || {
            echo >&2 'Could not mount /sys/kernel/security.'
            echo >&2 'AppArmor detection and --privileged mode might break.'
        }
    fi

When building the container with ECI disabled and then running the built container with it enabled, everything works fine.

I would propose to either add a feature flag to disable the check or remove it altogether, however I am not too sure how many run into issues with running AppArmor inside a devcontainer base container.

@Mathiyarasy Mathiyarasy self-assigned this Apr 7, 2025
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

No branches or pull requests

2 participants