Opam Init在Docker上失败

发布于 2025-01-30 18:23:16 字数 773 浏览 2 评论 0原文

我正在尝试使用 opam on docker 上的简单 linux 环境:

$ type .\Dockerfile_Opam.txt
FROM ubuntu:22.04
RUN                        \
apt-get update -y       && \
apt-get install opam -y && \
opam init

等效命令在本机Linux上工作正常但是有了Docker,我会遇到一个错误:

$ docker build --tag host --file .\Dockerfile_Opam.txt .
# ... omitted for brevity ...
#5 48.09 [ERROR] Sandboxing is not working on your platform ubuntu:
#5 48.09         "~/.opam/opam-init/hooks/sandbox.sh build sh -c echo SUCCESS >$TMPDIR/opam-sandbox-check-out && cat $TMPDIR/opam-sandbox-check-out; rm -f $TMPDIR/opam-sandbox-check-out" exited with code 1 "bwrap: Creating new namespace failed: Operation not permitted"

I'm trying to install a simple linux environment with opam on docker:

$ type .\Dockerfile_Opam.txt
FROM ubuntu:22.04
RUN                        \
apt-get update -y       && \
apt-get install opam -y && \
opam init

Equivalent commands work fine on native linux but with docker I get an error:

$ docker build --tag host --file .\Dockerfile_Opam.txt .
# ... omitted for brevity ...
#5 48.09 [ERROR] Sandboxing is not working on your platform ubuntu:
#5 48.09         "~/.opam/opam-init/hooks/sandbox.sh build sh -c echo SUCCESS >$TMPDIR/opam-sandbox-check-out && cat $TMPDIR/opam-sandbox-check-out; rm -f $TMPDIR/opam-sandbox-check-out" exited with code 1 "bwrap: Creating new namespace failed: Operation not permitted"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏至、离别 2025-02-06 18:23:16

安装软件包时,Opam运行将构建。为了防止越野车的档案(可能会偶然运行rm -rf /code>),Opam使用BubbleWrap来砂盒子构建。安装BubbleWrap(apt-get install bubblewrap),或者,如果您想跳过,因为无论如何都在容器中运行,请这样初始化OPAM:

opam init --disable-sandboxing

OPAM runs builds when installing packages. To guard against buggy makefiles (that might run rm -rf / by accident), OPAM uses bubblewrap to sandbox the builds. Either install bubblewrap (apt-get install bubblewrap) or, if you wish to skip, because you're running in a container anyway, initialize OPAM like this:

opam init --disable-sandboxing
心舞飞扬 2025-02-06 18:23:16

这也有效,但如果IDK安全或具有禁用沙箱选项的Cons/Pros,则可以使用:

USER root
RUN apt-get update && apt-get install -y --no-install-recommends bubblewrap
RUN opam init

This also works but idk if its safe or the cons/pros with the disabling sandbox option:

USER root
RUN apt-get update && apt-get install -y --no-install-recommends bubblewrap
RUN opam init
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文