美文网首页
Ubuntu24.04-Docker-Desktop必须现问题4

Ubuntu24.04-Docker-Desktop必须现问题4

作者: g才华横溢 | 来源:发表于2024-06-04 02:51 被阅读0次

系统:Ubunutu 24.04
Docker版本:Docker version 26.1.3, build b72abbb
DockerDesktop版本:v4.30.0

初期问题参考文章地址:
https://www.cnblogs.com/happy68/p/18168484

以下是原文:

  1. 安装docker desktop后启动无窗口
    现象: 执行sudo apt install ./docker-desktop-4.29.0-amd64.deb成功安装docker desktop后,无论是在菜单里点击Docker Desktop图标还是执行systemctl --user start docker-desktop均没有窗口出现。
    查看日志:在~/.docker/desktop/log/host/Docker Desktop.stderr.log 中有以下内容:
[2024-04-27T06:39:49.728616797Z] [22344:0427/143949.728566:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /opt/docker-desktop/chrome-sandbox is owned by root and has mode 4755.

解决方法:执行

sudo chown root:root /opt/docker-desktop/chrome-sandbox
sudo chmod 4755 /opt/docker-desktop/chrome-sandbox

然后执行 systemctl --user restart docker-desktop,窗口出现,问题解决。

  1. 启动出现 "An unexpected error occurred"或一直显示"Starting the Docker Engine..."
    报错内容:
running engine: waiting for the VM setup to be ready: running filesharing: running virtiofsd for /home:  Error entering sandbox:
DropSupplementalGroups(Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" })

执行sudo dmesg出现以下等内容

[ 2329.792894] audit: type=1400 audit(1714467432.031:190): apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=10057 comm="virtiofsd" capability=6  capname="setgid"

解决方法:

echo "==> Disabling Apparmor unprivileged userns mediation"
echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns

echo "==> Disabling Apparmor unprivileged unconfined mediation"
echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_unconfined

以下是原创:

我这里主要解决的是第二个问题:

. 启动出现 "An unexpected error occurred"或一直显示"Starting the Docker Engine..."
报错内容:
running engine: waiting for the VM setup to be ready: running filesharing: running virtiofsd for /home:  Error entering sandbox:
DropSupplementalGroups(Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" })

这个问题是因为上是docker-desktop 获取的权限超出了
unprivileged_userns 规定的权限。
原因是 ubuntu24.04中的 /etc/apparmor.d 目录中没有默认配置对应的文件权限导致的。

# Special profile transitioned to by unconfined when creating an unprivileged
# user namespace.
#
abi <abi/4.0>,
include <tunables/global>

profile unprivileged_userns {
     audit deny capability,
    -----------------这一条-----------------
     audit deny change_profile,

     # allow block to be replaced by allow when x dominance test is fixed
     #allow all,
     allow network,
     allow signal,
     allow dbus,
     allow file rwlkm /**,
     allow unix,
     allow mqueue,
     allow ptrace,
     allow userns,

     # stack children to strip capabilities
     allow pix /** -> &unprivileged_userns ,

     # Site-specific additions and overrides. See local/README for details.
     include if exists <local/unprivileged_userns>
}

使用命令:

sudo dmesg #使用命令可以看到下面的内容,差别不会很大。
[ 4399.656681] audit: type=1400 audit(1717525854.237:1154): apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=35535 comm=446F636B6572204465736B746F70 capability=21  capname="sys_admin"

解决方法:
在 /etc/apparmor.d 目录中创建授权文件,我这里用的是 docker-desktop
下面是文件内容

# This profile allows everything and only exists to give the
# application a name instead of having the label "unconfined"

abi <abi/4.0>,
include <tunables/global>

profile docker-desktop  /opt/docker-desktop/bin/*  flags=(unconfined) {
  userns,
  capability,
  capability chown,
  capability dac_override,
  capability setuid,
  capability setgid,
  capability net_bind_service,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/docker-desktop>
}

写入完成后重启 apparmor

sudo systemctl restart apparmor
#重启docker-desktop
systemctl --user restart docker-desktop

至此问题可以解决。

相关文章

  • 提现问题

    昨天发的三篇文都锁了,打赏的钱,4月11日申请提现后,到今天还没到账。 我发邮件反馈,简书的回复永远是那句话:“您...

  • 提现问题

    都知道简书可以赚钱,却不知道怎么提现,每天更新会有简书贝,知道简书贝可以转为简书钻后才能变成钱,可是怎么提现呢? ...

  • 偶现线程读写问题导致的bugly崩溃验证和修复

    偶现问题复现 ,for 循环10万次增加偶现概率 尝试5次, 每次分别给予10万次读和写 , 出现4次crash...

  • 问题分析与解决技巧

    为什么他们问完问题,答案就跟着出现了? 五个步骤让你高效解决问题 1发现问题 2提出问题 3提出方案 4评估方案 ...

  • 趋势投资学习笔记

    趋势投资4个必须敬畏,参与股市,必须时刻谨记4个“必须敬畏”: 必须敬畏市场趋势、必须敬畏法治、必须敬畏专业、必须...

  • Mac安装BeautifulSoup4出现的问题与pycharm

    一、Mac安装BeautifulSoup4出现的问题 直接在终端用pip安装时我总是出现Could not fin...

  • 周一早会总结

    1、营销落地(上下差异太大)。 2、要到人、到店、到型号。 3、客户的问题必须及时解决。 4、人员跑动(终端问题的...

  • 培训了4天,我终于按捺不了!

    开学4天了,也意味着没学习4天了,心里多多少少有些恐慌。必须按照学校要求,拎着电脑去公司实训,从上一次实训结束到现...

  • 4、梦境在现

    陈铭总觉得这个梦很真实,正当他思考着,又听见了客厅里有脚步声,这让他想到了自己的梦!他小心翼翼的走到客厅,果...

  • 不《深度工作》,未来将被淘汰!

    为什么要深度工作? 只为掌握一个复杂的技术,或解决一个艰深的问题。复杂工作必须要靠深度工作来解决。 现...

网友评论

      本文标题:Ubuntu24.04-Docker-Desktop必须现问题4

      本文链接:https://www.haomeiwen.com/subject/bzxyqjtx.html