Skip to content

Instantly share code, notes, and snippets.

@leewardbound
Last active November 13, 2022 22:55
Show Gist options
  • Save leewardbound/4a2d24514c386ee861640e47cbd0fc4e to your computer and use it in GitHub Desktop.
Save leewardbound/4a2d24514c386ee861640e47cbd0fc4e to your computer and use it in GitHub Desktop.
VNC container with Google Chrome (for Industry Idle)

INSTRUCTIONS FOR USE:

  1. Save this as docker-compose.yml (and the related Dockerfile) into a folder called industry-idle

  2. IMPORTANT: Update the password, and comment out the last section "volumes" of docker-compose.yml (the last line) by putting a "#" before it, then run:

    docker-compose up -d docker cp industry-idle_vnc_1:/headless data docker-compose down

    This creates the container with a new Chrome profile inside the container, and copies the fresh user profile to the local ./data directory (it will later be mounted for persistence)

  3. Now edit docker-compose.yml and re-enable (un-comment) the Volumes section, then:

    docker-compose up -d docker-compose run --entrypoint="" --user="0" vnc chown -R 1000:1000 /headless

    This starts the container with the volume mounted (so user data persists across container restarts) and then fixes the ownership permissions for the VNC user

    Now you can start and use the container as normal with just docker-compose up -d, enjoy!

Hosting & Performance Considerations -

  • I host this on a 4gb ($20/mo) VPS from Linode in Fremont, CA; the machine also runs some other light workloads.
  • I have to restart the container about once every 48 hours (fluxbox stops responding, chrome freezes)
  • I am able to access from about 250 miles away with very usable refresh rates from my home (gigabit) connection (5+ FPS) and my mobile (4g, ~1 FPS)
version: "2.1"
services:
vnc:
build:
context: .
shm_size: 2g
ports:
- 59001:5901
- 6901:6901
environment:
- VNC_PW=secure.VNC.password
- VNC_RESOLUTION=1920x1080
restart: always # This is optional, up to you - restarting the container will NOT open the browser
volumes: ["./data:/headless"] # Comment out THIS LINE in step 1 by adding another # before the word "volumes:"
FROM consol/ubuntu-xfce-vnc
USER 0
RUN apt-get update -yq
RUN wget -O /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i /tmp/google-chrome.deb || true
RUN apt-get install -fyq
USER 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment