Docker:从CLI运行容器失败,但不是从Docker桌面,RTENETLINK Oper不允许

2022-01-27 04:08:02 标签 linuxmacosdockercontainerscentos8

我正在学习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

当我在交互模式下运行容器时,我检查了操作系统版本,它是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将附加stdin。

添加-t将为您提供一个伪tty

要真正使用bash,您需要同时提供:-it

总结一下,如何模仿Docker Desktop在后台用-d启动容器:

docker run -it -d ghcr.io/nokia/srlinux
阅读全文

▼ 版权说明

相关文章也很精彩
推荐内容
更多标签
相关热门
全站排行
随便看看

错说 cuoshuo.com —— 程序员的报错记录

部分内容根据CC版权协议转载;网站内容仅供参考,生产环境使用务必查阅官方文档

辽ICP备19011660号-5

×

扫码关注公众号:职场神器
发送: 1
获取永久解锁本站全部文章的验证码