如何修复创建 Docker 容器时的问题

huangapple go评论66阅读模式
英文:

How to fix docker on create containers

问题

我正在尝试在Linux上使用Docker创建一个容器
我试图运行

docker run hello-world

然后我得到了一个错误

> docker: 守护程序的错误响应: 创建 shim 任务失败: OCI
> runtime create 失败: runc create 失败: 无法启动容器
> 进程: 在容器初始化期间发生错误: 在 rootfs 中封装进程时出现错误: pivot_root .: 无效的参数: 未知。

不幸的是,我的系统没有 apt
dpkg
这就是为什么我的使用受到限制,我在系统上具有完全的 root 访问权限
我的系统信息
Linux localhost 5.13.x #1 SMP Fri Apr 14 00:13:58 CST 2023 x86_64 GNU/Linux

我尝试运行 docked 并且这些是输出内容

> root@localhost:/volume1/.@root # dockerd ...
> 警告[2023-06-08T19:55:02.790387966+03:00] 无法找到 ip6tables:
> 执行: "ip6tables": $PATH 中找不到可执行文件
> 警告[2023-06-08T19:55:02.821529061+03:00] 无法加载 Conntrack 所需的模块: 运行 modprobe nf_conntrack 失败,错误消息为: modprobe: 无效选项 -- 'a' BusyBox v1.31.1 (2023-04-14
> 03:02:50 CST) 多功能调用二进制文件。用法: modprobe [-rq] MODULE
> [SYMBOL=VALUE]... -r 移除 MODULE -q 安静模式,错误: 退出状态 1
> 信息[2023-06-08T19:55:02.898668345+03:00] 默认桥接 (docker0) 分配了 IP 地址 172.17.0.0/16。可以使用守护程序选项 --bip 来设置首选 IP 地址
> 信息[2023-06-08T19:55:02.916840721+03:00] 正在加载容器: 完成。
> 警告[2023-06-08T19:55:02.917174613+03:00] 无法获取操作系统名称: 打开 /usr/lib/os-release 时出错: 打开
> /usr/lib/os-release: 没有此文件或目录
> 警告[2023-06-08T19:55:02.917207803+03:00] 无法获取操作系统版本: 打开 /usr/lib/os-release 时出错: 打开
> /usr/lib/os-release: 没有此文件或目录
> 信息[2023-06-08T19:55:02.970614869+03:00] Docker 守护程序
> 提交=42c8b31 图形驱动程序(s)=overlay2 版本=20.10.22
> 信息[2023-06-08T19:55:02.970648693+03:00] 守护程序已完成初始化 信息[2023-06-08T19:55:02.984664788+03:00] API
> 侦听于 /var/run/docker.sock

我不能在这里放所有的输出,我不知道为什么

它之前正常工作,但我不知道现在出了什么问题。有人可以帮我解决这个问题吗?

英文:

I'm trying to create a container on Docker using Linux
I'm trying to run

docker run hello-world

And I get an error

> docker: Error response from daemon: failed to create shim task: OCI
> runtime create failed: runc create failed: unable to start container
> process: error during container init: error jailing process inside
> rootfs: pivot_root .: invalid argument: unknown.

Unfortunately, my system does not have apt
or dpkg
This is why I am limited in use, I have full root access on my system
my system info
Linux localhost 5.13.x #1 SMP Fri Apr 14 00:13:58 CST 2023 x86_64 GNU/Linux

I've tried to run docked and these are the outputs

> root@localhost:/volume1/.@root # dockerd ...
> WARN[2023-06-08T19:55:02.790387966+03:00] Failed to find ip6tables:
> exec: "ip6tables": executable file not found in $PATH
> WARN[2023-06-08T19:55:02.821529061+03:00] Could not load necessary
> modules for Conntrack: Running modprobe nf_conntrack failed with
> message: modprobe: invalid option -- 'a' BusyBox v1.31.1 (2023-04-14
> 03:02:50 CST) multi-call binary. Usage: modprobe [-rq] MODULE
> [SYMBOL=VALUE]... -r Remove MODULE -q Quiet, error: exit status 1
> INFO[2023-06-08T19:55:02.898668345+03:00] Default bridge (docker0) is
> assigned with an IP address 172.17.0.0/16. Daemon option --bip can be
> used to set a preferred IP address
> INFO[2023-06-08T19:55:02.916840721+03:00] Loading containers: done.
> WARN[2023-06-08T19:55:02.917174613+03:00] Could not get operating
> system name: Error opening /usr/lib/os-release: open
> /usr/lib/os-release: no such file or directory
> WARN[2023-06-08T19:55:02.917207803+03:00] Could not get operating
> system version: Error opening /usr/lib/os-release: open
> /usr/lib/os-release: no such file or directory
> INFO[2023-06-08T19:55:02.970614869+03:00] Docker daemon
> commit=42c8b31 graphdriver(s)=overlay2 version=20.10.22
> INFO[2023-06-08T19:55:02.970648693+03:00] Daemon has completed
> initialization INFO[2023-06-08T19:55:02.984664788+03:00] API
> listen on /var/run/docker.sock

I can't put all outputs here, I don't know why

It was working fine, but I don't know what's wrong now. Can someone help me solve the problem, please?

答案1

得分: 1

The pivot_root issue should be related to the ramdisk filesystem that is not supported on overlay2.

So set the environment variable for dockerd about ramdisk:

DOCKER_RAMDISK=true
英文:

The pivot_root issue should be related to the ramdisk filesystem that is not a supported on overlay2.

So set the environemnt variable for dockerd about ramdisk:

DOCKER_RAMDISK=true

huangapple
  • 本文由 发表于 2023年6月9日 01:01:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76434166.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定