qqi*_*ihq 5 google-chrome chromium docker dockerfile
我\xe2\x80\x99d 喜欢运行容器化的 Chromium,而我\xe2\x80\x99m 面临沙箱问题。I\xe2\x80\x99m 运行 Chromium\xe2\x80\x9craw 构建\xe2\x80\x9d(不是通过包管理器下载的,但这应该\xe2\x80\x99t 有所作为,fwiw)。Here\xe2\x80\x99s 是一个最小的 Dockerfile,它将说明我的问题:
\n\nFROM ubuntu:16.04\n\nRUN set -ex; \\\n apt-get update; \\\n apt-get install curl unzip gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget -y;\n\nRUN set -ex; \\\n# download and install Chromium build, set permissions\n curl -o /tmp/chromium-download.zip https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/561732/chrome-linux.zip; \\\n unzip -d /opt /tmp/chromium-download.zip; \\\n chmod -R go=u-w /opt/chrome-linux; \\\n# create \'chrome\' group and user\n groupadd --system chrome; \\\n useradd --system --create-home --gid chrome --groups audio,video chrome; \\\n# Advice re. SUID sandbox in \'Installation instructions for \xe2\x80\x9cRaw builds of Chromium\xe2\x80\x9d\':\n# https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md#installation-instructions-for-raw-builds-of-chromium\n chown root:root /opt/chrome-linux/chrome_sandbox; \\\n chmod 4755 /opt/chrome-linux/chrome_sandbox;\n\nENV CHROME_DEVEL_SANDBOX="/opt/chrome-linux/chrome_sandbox"\nUSER chrome\nENV PATH="${PATH}:/opt/chrome-linux"\nRun Code Online (Sandbox Code Playgroud)\n\n构建它并尝试运行它:
\n\n$ docker build . -t chromium\n$ docker run -it chromium:latest chrome --headless\nRun Code Online (Sandbox Code Playgroud)\n\n我收到以下错误:
\n\n[0830/122656.151751:FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.\nRun Code Online (Sandbox Code Playgroud)\n\n最常见的故障排除口头禅(例如这里;不同的项目,但相同的问题):\xe2\x80\x9c只需添加--no-sandbox\xe2\x80\x99就可以了\xe2\x80\x9d。这确实有效。
然而,官方消息人士并不建议这样做,并声称,如果您在容器中正确设置用户,则不需要 \xe2\x80\x9cis。\xe2\x80\x9d(请参阅此处)。从我的感觉来看,容器内的用户已正确创建,并且我\xe2\x80\x99还遵循了设置SUID沙箱权限的建议(我不清楚其实际作用,此页面显示\ xe2 \x80\ x9cLinux SUID 沙箱几乎已被删除,但尚未完全删除。\xe2\x80\x9d——无论这在实践中意味着什么)。
\n\n有机会在不禁用沙箱的情况下运行它吗?(因为这用于测试,所以我\xe2\x80\x99d 理想地喜欢保留沙箱行为,因为我想尽可能接近地模拟 \xe2\x80\x9cnatural\xe2\x80\x9d 环境)
\n| 归档时间: |
|
| 查看次数: |
4125 次 |
| 最近记录: |