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

Opam init in Dockerfile #4327

Closed
bruce-ricard opened this issue Aug 21, 2020 · 1 comment
Closed

Opam init in Dockerfile #4327

bruce-ricard opened this issue Aug 21, 2020 · 1 comment

Comments

@bruce-ricard
Copy link

I am trying to run opam init in my Dockerfile, to create my own Docker image for my server to run in, but I am running into this issue:

docker run -it ubuntu:20.04 bash
apt update
apt install opam --yes
opam init --yes

bwrap: Creating new namespace failed: Operation not permitted

A similar question is asked in #3498 but in the context of a docker run command, but the answer doesn't work for me as we can't run docker build in privileged mode

I see that I can instead run opam init --disable-sandboxing, but I'm not really sure I want to do that. The documentation about this flag is not very helpful, I have no idea what sandboxing is in this context. Is using this option the recommended path to initialize opam in a container?

@avsm
Copy link
Member

avsm commented Aug 22, 2020

Sandboxing is a security mechanism to prevent source builds from doing writes outside of their build areas. We use bubblewrap (cgroups) for this on Linux, but it doesn't nest cleanly. You can either run your container as --privileged, in which case you can create namespaces and sandboxing will work.

You probably just want to run with --disable-sandboxing, as you already have container-level protection in place.

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

3 participants