Docker:来自 CLI 的 运行 容器失败但来自 docker 桌面,不允许 RTENETLINK Oper
Docker: Running container from CLI fails but not from docker desktop, RTENETLINK Oper not permitted
我正在学习 docker,我将它下载到我的 Mac 并且我能够从桌面应用程序 运行 我的第一个 docker 容器。从命令行为同一图像启动容器失败。
下面的错误日志显示 RteNetLink 失败。
有什么想法可以修复它吗?
% docker run ghcr.io/nokia/srlinux
Thu Aug 5 19:36:13 UTC 2021: entrypoint.sh called
Thu Aug 5 19:36:13 UTC 2021: renaming docker interface eth0 to mgmt0
RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted
Cannot find device "mgmt0"
Device "mgmt0" does not exist.
Cannot find device "mgmt0"
Thu Aug 5 19:36:14 UTC 2021: turning off checksum offloading on mgmt0
netlink error: Operation not permitted
Thu Aug 5 19:36:14 UTC 2021: starting sshd
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
mount: /var/log/srlinux/buffer: permission denied.
Thu Aug 5 19:36:14 UTC 2021: Calling boot_run script
chmod: cannot access '/dev/console': No such file or directory
chmod: missing operand after '0666'
Try 'chmod --help' for more information.
/usr/bin/find: '/var/log/srlinux/file': No such file or directory
logmgr_set_env.sh: plain_bootup_start
Thu Aug 5 19:36:15 UTC 2021 logmgr_set_env.sh: restart of rsyslogd
Failed to set capabilities on file `/usr/sbin/tcpdump' (No such file or directory)
usage: setcap [-q] [-v] [-n <rootid>] (-r|-|<caps>) <filename> [ ... (-r|-|<capsN>) <filenameN> ]
Note <filename> must be a regular (non-symlink) file.
Thu Aug 5 19:36:15 UTC 2021: entrypoint.sh done, executing /bin/bash
而当我运行容器处于交互模式时,我检查了OS版本,它是CentOS Stream。
[user@33681341ddf6 /]$ cat /etc/os-release
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
从命令行为同一图像启动容器不会失败,如果您查看使用 Docker Desktop 启动的容器的日志,您会看到相同的行。
发生的事情是 centos dockerfile 使用 bash 作为其默认命令。
当您 运行 一个容器时,默认情况下它会附加到 stdout 和 stderr,但不会附加到 stdin。
添加 -i
将附加标准输入。
添加 -t
将为您提供一个伪 tty
要实际使用 bash,您需要提供两者:-it
总而言之,下面是如何模仿 Docker Desktop 所做的,在后台启动容器 -d
:
docker run -it -d ghcr.io/nokia/srlinux
我正在学习 docker,我将它下载到我的 Mac 并且我能够从桌面应用程序 运行 我的第一个 docker 容器。从命令行为同一图像启动容器失败。
下面的错误日志显示 RteNetLink 失败。
有什么想法可以修复它吗?
% docker run ghcr.io/nokia/srlinux
Thu Aug 5 19:36:13 UTC 2021: entrypoint.sh called
Thu Aug 5 19:36:13 UTC 2021: renaming docker interface eth0 to mgmt0
RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted
Cannot find device "mgmt0"
Device "mgmt0" does not exist.
Cannot find device "mgmt0"
Thu Aug 5 19:36:14 UTC 2021: turning off checksum offloading on mgmt0
netlink error: Operation not permitted
Thu Aug 5 19:36:14 UTC 2021: starting sshd
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
mount: /var/log/srlinux/buffer: permission denied.
Thu Aug 5 19:36:14 UTC 2021: Calling boot_run script
chmod: cannot access '/dev/console': No such file or directory
chmod: missing operand after '0666'
Try 'chmod --help' for more information.
/usr/bin/find: '/var/log/srlinux/file': No such file or directory
logmgr_set_env.sh: plain_bootup_start
Thu Aug 5 19:36:15 UTC 2021 logmgr_set_env.sh: restart of rsyslogd
Failed to set capabilities on file `/usr/sbin/tcpdump' (No such file or directory)
usage: setcap [-q] [-v] [-n <rootid>] (-r|-|<caps>) <filename> [ ... (-r|-|<capsN>) <filenameN> ]
Note <filename> must be a regular (non-symlink) file.
Thu Aug 5 19:36:15 UTC 2021: entrypoint.sh done, executing /bin/bash
而当我运行容器处于交互模式时,我检查了OS版本,它是CentOS Stream。
[user@33681341ddf6 /]$ cat /etc/os-release
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
从命令行为同一图像启动容器不会失败,如果您查看使用 Docker Desktop 启动的容器的日志,您会看到相同的行。
发生的事情是 centos dockerfile 使用 bash 作为其默认命令。
当您 运行 一个容器时,默认情况下它会附加到 stdout 和 stderr,但不会附加到 stdin。
添加 -i
将附加标准输入。
添加 -t
将为您提供一个伪 tty
要实际使用 bash,您需要提供两者:-it
总而言之,下面是如何模仿 Docker Desktop 所做的,在后台启动容器 -d
:
docker run -it -d ghcr.io/nokia/srlinux