Я хочу запустить браузер Chrome для Linux с помощью Docker в режиме графического интерфейса. >
Это мой Dockerfile
Код: Выделить всё
# Use the official Ubuntu base image
FROM ubuntu:24.04
# Install necessary packages
RUN apt-get update && apt-get install -y \
wget \
gnupg \
software-properties-common \
libx11-xcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxrandr2 \
libgbm1 \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libnspr4 \
libnss3 \
libxss1 \
libxtst6 \
fonts-liberation \
xdg-utils \
libu2f-udev \
x11-apps \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Add Google Chrome repository and install Google Chrome
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# Create a normal user
RUN useradd -m -s /bin/bash chrome \
&& echo "chrome ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Switch to the normal user
USER chrome
# Set environment variables for X11 forwarding
ENV DISPLAY=:0
ENV XAUTHORITY=/home/chrome/.Xauthority
# Set the entrypoint to run Chrome
ENTRYPOINT [ "google-chrome" ]
Код: Выделить всё
sudo docker build -t chrome-container .
Код: Выделить всё
[+] Building 6.8s (5/7) docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.32kB 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:24.04 2.9s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [1/4] FROM docker.io/library/ubuntu:24.04@sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30 0.0s
=> ERROR [2/4] RUN apt-get update && apt-get install -y wget gnupg software-properties-common libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 3.9s
------
> [2/4] RUN apt-get update && apt-get install -y wget gnupg software-properties-common libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxrandr2 libgbm1 libasound2 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libnspr4 libnss3 libxss1 libxtst6 fonts-liberation xdg-utils libu2f-udev x11-apps sudo && rm -rf /var/lib/apt/lists/*:
1.111 Get:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease [256 kB]
2.291 Err:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease
2.291 At least one invalid signature was encountered.
2.584 Get:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease [126 kB]
2.884 Err:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease
2.884 At least one invalid signature was encountered.
3.031 Get:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease [126 kB]
3.339 Err:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease
3.339 At least one invalid signature was encountered.
3.516 Get:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease [126 kB]
3.842 Err:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease
3.842 At least one invalid signature was encountered.
3.846 Reading package lists...
3.863 W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble InRelease: At least one invalid signature was encountered.
3.863 E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble InRelease' is not signed.
3.863 W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease: At least one invalid signature was encountered.
3.863 E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease' is not signed.
3.863 W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease: At least one invalid signature was encountered.
3.863 E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease' is not signed.
3.863 W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-security InRelease: At least one invalid signature was encountered.
3.863 E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-security InRelease' is not signed.
------
Dockerfile:5
--------------------
4 | # Install necessary packages
5 | >>> RUN apt-get update && apt-get install -y \
6 | >>> wget \
7 | >>> gnupg \
8 | >>> software-properties-common \
9 | >>> libx11-xcb1 \
10 | >>> libxcomposite1 \
11 | >>> libxcursor1 \
12 | >>> libxdamage1 \
13 | >>> libxrandr2 \
14 | >>> libgbm1 \
15 | >>> libasound2 \
16 | >>> libatk1.0-0 \
17 | >>> libatk-bridge2.0-0 \
18 | >>> libcups2 \
19 | >>> libdrm2 \
20 | >>> libnspr4 \
21 | >>> libnss3 \
22 | >>> libxss1 \
23 | >>> libxtst6 \
24 | >>> fonts-liberation \
25 | >>> xdg-utils \
26 | >>> libu2f-udev \
27 | >>> x11-apps \
28 | >>> sudo \
29 | >>> && rm -rf /var/lib/apt/lists/*
30 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y wget gnupg software-properties-common libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxrandr2 libgbm1 libasound2 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libnspr4 libnss3 libxss1 libxtst6 fonts-liberation xdg-utils libu2f-udev x11-apps sudo && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/wh2rk22doe4prdqnrdd8uidwt
Подробнее здесь: https://stackoverflow.com/questions/787 ... cos-in-gui
Мобильная версия