containers icon indicating copy to clipboard operation
containers copied to clipboard

Cannot run in a rootless container using podman

Open yanjiew1 opened this issue 1 year ago • 1 comments

Describe the bug The startup script in dev-variant container assumes that it is not run in a user namespace. However, it is not true when using a rootless container. When it is run in a rootless container, uid 0 in the container will be mapped to the user who starts the container.

The startup script will try to create a user with uid 0 and the creation will fail with the error message.

useradd: UID 0 is not unique

To Reproduce Run the dev container using podman as normal user:

podman run -it \
       -v "${HOME}":"${HOME}" -e EDK2_DOCKER_USER_HOME="${HOME}" \
       ghcr.io/tianocore/containers/ubuntu-20-dev:latest /bin/bash

Expected behavior The container starts successfully and we can see the shell prompt.

Execution environment Host OS: Ubuntu 22.04 Container Engine: podman version 4.5.0 Podman command run as normal user:

podman run -it \
       -v "${HOME}":"${HOME}" -e EDK2_DOCKER_USER_HOME="${HOME}" \
       ghcr.io/tianocore/containers/ubuntu-20-dev:latest /bin/bash

Additional context Add any other context about the problem here.

yanjiew1 avatar May 24 '23 09:05 yanjiew1