gpt4 book ai didi

docker - docker 内使用 bazel 进行端口隔离

转载 作者:行者123 更新时间:2023-12-03 03:36:55 25 4
gpt4 key购买 nike

尝试在 docker 特权容器内使用 bazel 和 linux 测试端口隔离,但失败了。

我的环境如下(所有命令都从在 aws 上启动的特权容器运行):

$ uname -a
Linux 167-docker99 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux
builduser@167-docker99:~/ws/bazel-port-isolation$ cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"Bazel version

$ bazel version
Build label: 0.5.1
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 6 10:34:11 2017 (1496745251)
Build timestamp: 1496745251
Build timestamp as int: 1496745251

根据this指令 - 确保启用 unprivileged_userns_clone

$ cat /proc/sys/kernel/unprivileged_userns_clone 
1

仓库:https://github.com/ittaiz/bazel-port-isolation

运行测试:$ 巴泽尔测试//...

...........
____Loading package:
____Loading package: @bazel_tools//tools/cpp
____Loading package: @local_config_xcode//
____Loading package: @local_jdk//
____Loading package: @local_config_cc//
____Loading complete. Analyzing...
____Loading package: tools/defaults
____Loading package: @bazel_tools//tools/test
____Loading package: @junit_junit//jar
____Found 2 test targets...
____Building...
____[0 / 12] Expanding template SocketIsolationTest
____[9 / 12] Extracting interface @junit_junit//jar:jar ERROR: /home/builduser/.cache/bazel/_bazel_builduser/a589c0f8758972ab3aadcf172c468873/external/junit_junit/jar/BUILD.bazel:2:1: Extracting interface @junit_junit//jar:jar failed: Process exited with status 1 [sandboxed]. src/main/tools/linux-sandbox-pid1.cc:193: "mount(/tmp, /tmp, NULL, MS_BIND, NULL)": Invalid argument Use
--strategy=JavaIjar=standalone to disable sandboxing for the failing actions.
____Building complete.
____Elapsed time: 5.651s, Critical Path: 1.62s //:SocketIsolation2Test NO STATUS

Executed 0 out of 2 tests: 1 fails to build and 1 was skipped.

另一个重要的输入可能是我确实设法使 bazel 在 docker 主机上成功运行测试。

出了什么问题?

最佳答案

似乎它已在 HEAD 上修复(baf7d4bce8bb14d785760d10694122e8ead2a177)。

安装bazel HEAD后成功通过

关于docker - docker 内使用 bazel 进行端口隔离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44656481/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com