ITGOIT - Wiki

Firefox

cd /home/myusername/docker
mkdir firefox && cd "$_"

The command below automatically creates the Firefox policy.json configuration. The ExtensionSettings section includes the theme (BeautifulPurpleSky@Godie), which is automatically installed when Firefox starts. To ignore the theme, remove its entry located at the bottom of policy.json

mkdir -p ./data && cat > ./data/policy.json <<'EOF'
{
  "policies": {
    "SanitizeOnShutdown": false,
    
    "Homepage": {
      "URL": "https://www.youtube.com",
      "Locked": false,
      "StartPage": "homepage"
    },

    "ManagedBookmarks": [
      {
        "toplevel_name": "🎬 Watch Party Links"
      },
      {
        "name": "YouTube",
        "url": "https://www.youtube.com"
      },
      {
        "name": "Aniwaves",
        "url": "https://aniwaves.ru"
      },
      {
        "name": "Twitch",
        "url": "https://www.twitch.tv"
      },
      {
        "name": "Odysee",
        "url": "https://odysee.com"
      },

      {
        "name": "🎮 Fun & Entertainment",
        "children": [
          {
            "name": "Radio Garden",
            "url": "https://radio.garden"
          },
          {
            "name": "Internet Archive Movies",
            "url": "https://archive.org/details/movies"
          },
          {
            "name": "Famelack - World Wide TV & Radio",
            "url": "https://famelack.com"
          },
          {
            "name": "OpenGuessr",
            "url": "https://www.openguessr.com"
          },
          {
            "name": "Neal.fun",
            "url": "https://neal.fun"
          },
          {
            "name": "Akinator",
            "url": "https://en.akinator.com"
          },
          {
            "name": "Earth View",
            "url": "https://earthview.withgoogle.com"
          }
        ]
      }
    ],

    "DisableTelemetry": true,
    "DisableFirefoxStudies": true,
    "DisablePocket": true,
    "DontCheckDefaultBrowser": true,
    "OverrideFirstRunPage": "",
    "OverridePostUpdatePage": "",
    "DisplayBookmarksToolbar": "always",
    
    "DisableFirefoxAccounts": true,
    "OfferToSaveLogins": false,
    "PasswordManagerEnabled": false,
    "DisableAppUpdate": true,
    "DisableProfileImport": true,
    "CaptivePortal": false,
    "HardwareAcceleration": true,
    
    "Autoplay": {
      "Default": "allow-audio-video"
    },
    
    "Preferences": {
      "browser.aboutwelcome.enabled": false,
      "browser.newtabpage.activity-stream.showSponsoredTopSites": false,
      "browser.newtabpage.activity-stream.showSponsored": false,
      "browser.newtabpage.activity-stream.feeds.topsites": false,
      "browser.urlbar.suggest.quicksuggest.sponsored": false,
      "media.eme.enabled": true,
      "media.gmp-widevinecdm.visible": true,
      "media.gmp-widevinecdm.enabled": true
    },
    
    "ExtensionSettings": {
      "*": {
        "installation_mode": "blocked"
      },
      "[email protected]": {
        "install_url": "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi",
        "installation_mode": "force_installed"
      },
      "[email protected]": {
        "install_url": "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi",
        "installation_mode": "force_installed"
      },
      "[email protected]": {
        "install_url": "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi",
        "installation_mode": "force_installed"
      },
      "BeautifulPurpleSky@Godie": {
        "install_url": "https://addons.mozilla.org/firefox/downloads/latest/beautiful-purple-sky/latest.xpi",
        "installation_mode": "force_installed"
      }
    }
  }
}
EOF

nano docker-compose.yml

services:
  firefox:
    image: jlesage/firefox
    container_name: firefox
    restart: unless-stopped
    
    # Prevents tab crashes in Firefox by allowing the membarrier system call (Recommended by docs)
    security_opt:
      - seccomp=unconfined
    
    # Browsers need a decent amount of shared memory to prevent crashing on heavy sites
    shm_size: 2g 

    environment:
      # --- STARTUP CONFIGURATION ---
      # FF_OPEN_URL: https://startpage.com # uncomment to override the homepage url from policy
      DARK_MODE: 1                     # 1 is dark mode enabled, 0 is disabled
      
      # --- WEB UI FEATURES ---
      WEB_AUDIO: 1                     # Enable audio support in browser
      WEB_HOST_CLIPBOARD_SYNC: 1       # Sync host system clipboard with the container (HTTPS Required)
      WEB_FILE_MANAGER: 1              # Enables integrated file manager to upload/download files to the container
      WEB_NOTIFICATION: 0              # Forward Firefox desktop notifications to the host PC. (HTTPS Required)
      SECURE_CONNECTION: 0             # This forces http to be https, keep it at 0 if used locally. 
      WEB_TERMINAL: 1                  # Enables a web-based shell terminal
      
      # --- WEB AUTHENTICATION (Optional) ---
      # to protect Firefox with a login screen, uncomment these:
      # - WEB_AUTHENTICATION=1
      # - WEB_AUTHENTICATION_ALLOW_INSECURE=1 # Required as Traefik handles HTTPS, not the container itself
      # - WEB_AUTHENTICATION_USERNAME=admin
      # - WEB_AUTHENTICATION_PASSWORD=firefox!
    ports:
      - 8300:5800
    devices:
      - /dev/dri:/dev/dri # Required for hardware acceleration
    volumes:
      - ./config:/config:rw
      - ./data/policy.json:/usr/lib/firefox/distribution/policies.json:ro # optional Firefox policy configuration
docker compose up -d