【发布时间】:2022-08-10 01:34:35
【问题描述】:
我正在尝试生成一个 docker 映像以在 M1 上运行 chromium 并附加 puppeteer。
为了生成它并将其推送到我的私人 docker hub 上,我使用 github 操作:
我的 github 动作
name: build-web-builder-docker
on:
workflow_dispatch:
inputs:
# no inputs
jobs:
build-docker:
name: build-docker
# not using self-hosted-org because this needs to run docker in privileged mode (see setup-builder step)
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup-quemu
id: qemu
uses: docker/setup-qemu-action@v2
- name: available-platforms
run: echo ${{ steps.qemu.outputs.platforms }}
- name: setup-builder
run: |
docker run --privileged --rm tonistiigi/binfmt --install all
echo \"${{secrets.DOCKERHUB_PASSWORD}}\" | docker login -u ${{secrets.DOCKERHUB_USER}} --password-stdin
docker buildx create --name mybuilder --use
docker buildx ls
- name: read-version
id: read-version # needed to read the step output in the next step
working-directory: ./docker
run: echo ::set-output name=DOCKER_TAG::$(cat version | xargs) # using xargs to trim surrounding whitespace
- name: build-docker
working-directory: ./docker
run: |
echo \"TAG=${{ steps.read-version.outputs.DOCKER_TAG }}\"
docker buildx build -t \"my/private-repo:${{ steps.read-version.outputs.DOCKER_TAG }}\" --platform linux/amd64,linux/arm64 . --push
这是我的Dockerfile:
FROM --platform=linux/amd64 debian:unstable-20211011-slim
RUN apt-get update && apt-get install -y --no-install-recommends \\
ca-certificates \\
apt-utils \\
locales \\
curl \\
git \\
unzip \\
procps
RUN apt-get install -y --no-install-recommends \\
fonts-liberation \\
libayatana-appindicator3-1 \\
libasound2 \\
libatk-bridge2.0-0 \\
libatk1.0-0 \\
libc6 \\
libcairo2 \\
libcups2 \\
libdbus-1-3 \\
libexpat1 \\
libfontconfig1 \\
libgbm1 \\
libgcc1 \\
libglib2.0-0 \\
libgtk-3-0 \\
libnspr4 \\
libnss3 \\
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 \\
lsb-release \\
wget \\
xdg-utils
# setup locale
RUN sed -i -e \'s/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/\' /etc/locale.gen && \\
dpkg-reconfigure --frontend=noninteractive locales
RUN apt-get update
RUN apt-get install chromium -fy
# install nodejs and related stuff
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get update && apt-get install -y --no-install-recommends \\
nodejs \\
gcc \\
g++ \\
make
RUN npm install -g yarn@^1.22.15
ENV TZ UTC
CMD [\"/usr/bin/google-chrome\", \\
# flags from https://github.com/GoogleChrome/puppeteer/blob/master/lib/Launcher.js
\"--disable-background-networking\", \\
\"--disable-background-timer-throttling\", \\
\"--disable-breakpad\", \\
\"--disable-client-side-phishing-detection\", \\
\"--disable-default-apps\", \\
\"--disable-dev-shm-usage\", \\
\"--disable-extensions\", \\
\"--disable-features=site-per-process\", \\
\"--disable-hang-monitor\", \\
\"--disable-popup-blocking\", \\
\"--disable-prompt-on-repost\", \\
\"--disable-sync\", \\
\"--disable-translate\", \\
\"--metrics-recording-only\", \\
\"--no-first-run\", \\
\"--safebrowsing-disable-auto-update\", \\
\"--enable-automation\", \\
\"--password-store=basic\", \\
\"--use-mock-keychain\", \\
\"--headless\", \\
\"--hide-scrollbars\", \\
# Disable sandbox mode
\"--no-sandbox\", \\
# Avoids font rendering differences between headless/headfull
\"--font-render-hinting=none\", \\
# Expose port 9222 for remote debugging
\"--remote-debugging-port=9222\", \\
\"--remote-debugging-address=0.0.0.0\", \\
\"--ignore-certificate-errors\" \\
]
图像的生成工作,但是当我尝试在我的 M1 上执行图像时,会发生这种情况:
我的docker-compose:
version: \'3\'
services:
docker-chromium:
platform: \"linux/amd64\"
image: my/private-repo:version
ports:
- \'9223:9222\'
如果我进入容器并尝试执行铬,我得到的输出:
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[0624/183808.715658:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0624/183808.722735:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0624/183808.730740:ERROR:file_path_watcher_inotify.cc(329)] inotify_init() failed: Function not implemented (38)
DevTools listening on ws://0.0.0.0:9222/devtools/browser/d4ccad21-67b3-4b0c-86a5-aafb98052cb4
qemu: unknown option \'type=utility\'
[0624/183808.891939:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[0624/183808.895531:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=1002
[0624/183808.895708:WARNING:gpu_process_host.cc(1277)] The GPU process has crashed 1 time(s)
[0624/183808.945000:ERROR:network_service_instance_impl.cc(474)] Network service crashed, restarting service.
qemu: unknown option \'type=utility\'
[0624/183809.119221:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=1002
[0624/183809.119287:WARNING:gpu_process_host.cc(1277)] The GPU process has crashed 2 time(s)
[0624/183809.127363:ERROR:network_service_instance_impl.cc(474)] Network service crashed, restarting service.
qemu: unknown option \'type=utility\'
[0624/183809.159148:INFO:render_frame_host_impl.cc(11505)] RenderFrameHostImpl::MaybeGenerateCrashReport url = , status = 5, exit_code = 1002
[0624/183809.171432:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=1002
[0624/183809.171993:WARNING:gpu_process_host.cc(1277)] The GPU process has crashed 3 time(s)
[0624/183809.185157:ERROR:network_service_instance_impl.cc(474)] Network service crashed, restarting service.
[0624/183809.204684:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=1002
[0624/183809.204793:WARNING:gpu_process_host.cc(1277)] The GPU process has crashed 4 time(s)
qemu: unknown option \'type=utility\'
[0624/183809.216082:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=1002
[0624/183809.216159:WARNING:gpu_process_host.cc(1277)] The GPU process has crashed 5 time(s)
[0624/183809.223755:ERROR:network_service_instance_impl.cc(474)] Network service crashed, restarting service.
[0624/183809.230447:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=1002
[0624/183809.230543:WARNING:gpu_process_host.cc(1277)] The GPU process has crashed 6 time(s)
[0624/183809.230650:FATAL:gpu_data_manager_impl_private.cc(451)] GPU process isn\'t usable. Goodbye.
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
Trace/breakpoint trap
root@5bb7c7d3c7f4:/# qemu: unknown option \'type=utility\'
这是怎么回事?为什么不运行?
标签: docker docker-compose chromium qemu