簡體   English   中英

在 Ubuntu 仿生容器中運行 Docker

[英]Running Docker in Ubuntu Bionic Container

我正在最新的 Ubuntu Docker 映像上安裝 Docker CE 並收到以下錯誤。 我仔細按照安裝說明進行操作; 也許在 Docker 容器上安裝 Docker 不是解決這個問題的方法? 我正在使用 Jenkins Pipelines 並在 Ubuntu 容器上安裝了 Jenkins; 下一部分是讓 Docker 運行。

time="2018-10-26T13:25:09.920187300Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2018-10-26T13:25:09.920228600Z" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]" module=grpc
time="2018-10-26T13:25:09.920250500Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2018-10-26T13:25:09.920286200Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420047e60, CONNECTING" module=grpc
time="2018-10-26T13:25:09.920480100Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420047e60, READY" module=grpc
time="2018-10-26T13:25:09.920501400Z" level=info msg="Loading containers: start."
time="2018-10-26T13:25:09.920666400Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: , error: exec: \"modprobe\": executable file not found in $PATH"
time="2018-10-26T13:25:09.920704800Z" level=warning msg="Running modprobe nf_nat failed with message: ``, error: exec: \"modprobe\": executable file not found in $PATH"
time="2018-10-26T13:25:09.920733300Z" level=warning msg="Running modprobe xt_conntrack failed with message: ``, error: exec: \"modprobe\": executable file not found in $PATH"
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.6.1: can't initialize iptables table `nat': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)

典型的 Docker 容器以一組受限的權限運行。 即使你是容器中的root ,也不能修改網絡配置,也不能掛載文件系統。 所以你看到的錯誤......

啟動守護程序時出錯:初始化網絡控制器時出錯:獲取控制器實例時出錯:無法創建 NAT 鏈 DOCKER:iptables 失敗:iptables -t nat -N DOCKER:iptables v1.6.1:無法初始化 iptables 表 `nat':權限被拒絕(你必須是root)

...正在發生,因為這個限制。 您可以通過使用您的容器創建一個不受限制的容器:

docker run --privileged ...

可以使用更細粒度的內容並授予NET_ADMIN功能,如下所示:

docker run --cap-add NET_ADMIN ...

只要容器所需的唯一“特殊”權限是網絡配置,這就會起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM