Docker chromium 浏览器

services:
  chromium:
    image: linuxserver/chromium:latest
    container_name: chromium
    environment:
      - PUID=0
      - PGID=0
      - CUSTOM_PORT=3033
      - CUSTOM_HTTPS_PORT=3034
      - TZ=Asia/Shanghai
      - CUSTOM_USER=xxxxxxxxxxxxxxxxx
      - PASSWORD=xxxxxxxxxxxxxxxx
      - FILE_MANAGER_PATH=/qbittorrent
      - LC_ALL=zh_CN.UTF-8
    volumes:
      - ./config:/config
      - /opt/qbittorrent:/qbittorrent
    ports:
#      - 3033:3033
      - 3034:3034
    shm_size: "2gb"
    restart: always
    network_mode: bridge

Chrome&Firefox

1.Start a Standalone Chrome

docker run -d -p 4444:4444 -p 7900:7900 --cpus="0.5" --memory="1g" --shm-size="1g" selenium/standalone-chrome:latest
docker run -d -p 4444:4444 -p 7900:7900 --cpus="1" --memory="1g" --shm-size="1g" selenium/standalone-chrome:114.0
docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-firefox:4.28.1-20250202

That's it!

2.(Optional) To see what is happening inside the container

head to http://localhost:7900/?autoconnect=1&resize=scale&password=secret.

Firefox

docker pull jlesage/firefox
mkdir ~/wm
docker run -d --name=firefox -p 5800:5800 -v ~/wm:/config:rw jlesage/firefox
curl -o font.tff https://courier.toptopn.com/download/AlibabaPuHuiTi-3-65-Medium.ttf
docker container ls
docker cp font.tff ID:/usr/share/fonts

Chrome

mkdir -p /opt/chrome/fonts
wget https://github.com/owent-utils/font/raw/d2842bf67a6211bb1d91bf4307a0f3859081e2b9/%E5%BE%AE%E8%BD%AF%E9%9B%85%E9%BB%91/MSYH.TTC
docker run -d \
  --name=chromium \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Shanghai \
  -p 3000:3000 \
  -p 3001:3001 \
  -v /opt/chrome/config:/config \
  -v /opt/chrome/fonts:/usr/share/fonts \
  --shm-size="1gb" \
  --restart unless-stopped \
  linuxserver/chromium:latest
docker cp MSYH.TTC ID:/usr/share/fonts/