使用Docker安装部署Chrome浏览器
使用Docker安装部署Chrome浏览器
01 描述
使用Docker安装部署一个Chrome浏览器服务,实现浏览器里面使用浏览器<俄罗斯套娃🤣>
好处:不需要使用远程工具进行远程访问,直接使用浏览器访问浏览器域名。再通过浏览器访问内网的网页服务。
02 部署步骤
2.1 编辑docker-compose.yaml配置文件
1 |
|
2.1.1 Parameters<参数>
容器使用在运行时传递的参数进行配置(如上所述)。这些参数由冒号分隔,分别表示
<external>:<internal>
。例如,-p 8080:80
将暴露容器内部的80
端口,使其可以从容器外部的宿主 IP 地址上的端口8080
访问。
参数 | 参数说明 |
---|---|
-p 3000:3000 |
Chromium desktop gui. Chromium HTTP桌面 GUI。 |
-p 3001:3001 |
HTTPS Chromium desktop gui. HTTPS Chromium 桌面 GUI。 |
-e PUID=1000 |
for UserID - see below for explanation. 对于 UserID - 请见下文解释 |
-e PGID=1000 |
for GroupID - see below for explanation. 对于 GroupID - 请见下文解释 |
-e TZ=Etc/UTC |
specify a timezone to use, see this list. 指定要使用的时间区域,请参阅此列表。 |
-e CHROME_CLI=https://www.linuxserver.io/ |
Specify one or multiple Chromium CLI flags, this string will be passed to the application in full. 指定一个或多个 Chromium CLI 标志,此字符串将完整地传递给应用程序。 |
-v /config |
Users home directory in the container, stores local files and settings. 容器中用户的主目录,存储本地文件和设置。 |
-v /usr/share/fonts |
设置中文字体目录,让Chromium浏览器支持中文。 |
--shm-size= |
This is needed for any modern website to function like youtube. 这是任何现代网站像 YouTube 一样运行所必需的。 |
--security-opt seccomp=unconfined |
For Docker Engine only, many modern gui apps need this to function on older hosts as syscalls are unknown to Docker. Chromium runs in no-sandbox test mode without it. 仅适用于 Docker Engine,许多现代 GUI 应用程序需要此功能在较旧的宿主机上运行,因为系统调用对 Docker 来说是未知的。没有它,Chromium 将在无沙盒测试模式下运行。 |
2.1.1 Optional environment variables<可选环境变量>
Variable | Description |
---|---|
CUSTOM_PORT | Internal port the container listens on for http if it needs to be swapped from the default 3000. 内部端口号,如果需要从默认的 3000 端口更改为 HTTP 监听。 |
CUSTOM_HTTPS_PORT | Internal port the container listens on for https if it needs to be swapped from the default 3001. 内部端口,如果需要从默认的 3001 更改为 https,则容器监听此端口。 |
CUSTOM_USER | HTTP Basic auth username, abc is default. HTTP 基本认证用户名,abc 为默认。 |
PASSWORD | HTTP Basic auth password, abc is default. If unset there will be no auth HTTP 基本认证密码,abc 为默认值。如果未设置,则没有认证 |
SUBFOLDER | Subfolder for the application if running a subfolder reverse proxy, need both slashes IE /subfolder/ 子文件夹用于运行子文件夹反向代理的应用程序,需要两个斜杠 IE /subfolder/ |
TITLE | The page title displayed on the web browser, default “KasmVNC Client”. 网页浏览器上显示的页面标题,默认为“KasmVNC 客户端”。 |
FM_HOME | This is the home directory (landing) for the file manager, default “/config”. 这是文件管理器的家目录(着陆点),默认为”/config”。 |
START_DOCKER | If set to false a container with privilege will not automatically start the DinD Docker setup. 如果设置为 false,具有特权的容器将不会自动启动 DinD Docker 设置。 |
DRINODE | If mounting in /dev/dri for DRI3 GPU Acceleration allows you to specify the device to use IE /dev/dri/renderD128 如果将 DRI3 GPU 加速的挂载位置设置为/dev/dri,允许您指定要使用的设备 IE /dev/dri/renderD128 |
DISABLE_IPV6 | If set to true or any value this will disable IPv6 如果设置为 true 或任何值,这将禁用 IPv6 |
LC_ALL | Set the Language for the container to run as IE fr_FR.UTF-8 ar_AE.UTF-8 设置容器运行的语言为 IE fr_FR.UTF-8 ar_AE.UTF-8 |
NO_DECOR | If set the application will run without window borders in openbox for use as a PWA. 如果设置,应用程序将在 openbox 中以无窗口边框的方式运行,用作 PWA。 |
NO_FULL | Do not autmatically fullscreen applications when using openbox. 不要在使用 openbox 时自动全屏应用程序。 |
2.1.2 Optional run configurations<可选运行配置>
Variable | Description |
---|---|
--privileged |
Will start a Docker in Docker (DinD) setup inside the container to use docker in an isolated environment. For increased performance mount the Docker directory inside the container to the host IE -v /home/user/docker-data:/var/lib/docker .将在容器内启动 Docker in Docker (DinD)设置,以在隔离环境中使用 Docker。为了提高性能,将 Docker 目录挂载到主机上 IE -v /home/user/docker-data:/var/lib/docker 。 |
-v /var/run/docker.sock:/var/run/docker.sock |
Mount in the host level Docker socket to either interact with it via CLI or use Docker enabled applications. 在主机级别的 Docker 套接字中挂载,以便通过 CLI 与之交互或使用 Docker 支持的应用程序。 |
--device /dev/dri:/dev/dri |
Mount a GPU into the container, this can be used in conjunction with the DRINODE environment variable to leverage a host video card for GPU accelerated applications. Only Open Source drivers are supported IE (Intel,AMDGPU,Radeon,ATI,Nouveau)将 GPU 安装到容器中,这可以与 DRINODE 环境变量结合使用,以利用主机显卡进行 GPU 加速应用程序。仅支持开源驱动程序 IE(英特尔、AMDGPU、Radeon、ATI、Nouveau) |
2.2 使用docker-compose 命令启动服务
1 |
|
2.3 chrome浏览器中启用本地输入法
启用《启用本地输入法》功能后,支持本地输入法输入中文。反之chrome浏览器中不支持本地输入法输入中文。
03 使用Nginx配置反向代理,对外发布服务
使用Nginx 对外发布服务,使用chrome.Example.com
域名进行访问。
1 |
|
使用Docker安装部署Chrome浏览器
https://hesc.info/post/deploy-chrome-browser-with-docker-installation-2uvkis.html