Compare commits
No commits in common. "master" and "baseimage-v4" have entirely different histories.
master
...
baseimage-
35 changed files with 1492 additions and 166 deletions
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: jlesage
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: https://paypal.me/JocelynLeSage/0usd
|
158
.github/workflows/build-image.yml
vendored
Normal file
158
.github/workflows/build-image.yml
vendored
Normal file
|
@ -0,0 +1,158 @@
|
|||
name: Docker image CI/CD
|
||||
|
||||
env:
|
||||
DOCKER_IMAGE_NAME: jlesage/firefox
|
||||
PLATFORMS: linux/amd64,linux/386,linux/arm/v7,linux/arm64/v8
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
tags:
|
||||
- v[0-9][0-9].[0-9][0-9].[0-9]+
|
||||
- v[0-9][0-9].[0-9][0-9].[0-9]+-pre.[0-9]+
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build image
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Free disk space
|
||||
run: |
|
||||
# Free disk space.
|
||||
echo "::group::Before"
|
||||
df -h /
|
||||
echo "::endgroup::"
|
||||
echo "::group::Removing unneeded softwares and files..."
|
||||
for DIR in /usr/local/lib/android /usr/share/dotnet /opt/ghc
|
||||
do
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "Removing $DIR..."
|
||||
sudo rm -r "$DIR"
|
||||
fi
|
||||
done
|
||||
echo "::endgroup::"
|
||||
echo "::group::After"
|
||||
df -h /
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
# Determine the Docker container version.
|
||||
VERSION=unknown
|
||||
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
|
||||
# Git tag pushed: use tag as the version.
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
elif [[ $GITHUB_REF =~ refs/heads/* ]]; then
|
||||
# Git commit pushed: use the commit SHA as the version.
|
||||
VERSION=${GITHUB_SHA::8}
|
||||
elif [[ $GITHUB_REF =~ refs/pull/* ]]; then
|
||||
# Pull request: use PR number as the version.
|
||||
VERSION=pr-${{ github.event.number }}
|
||||
else
|
||||
echo "::error::Unexpected GITHUB_REF: $GITHUB_REF"
|
||||
exit 1
|
||||
fi
|
||||
# Determine the version to put in container label.
|
||||
LABEL_VERSION=${VERSION}
|
||||
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
|
||||
# Do not include the starting 'v' of the version.
|
||||
LABEL_VERSION=${VERSION:1}
|
||||
fi
|
||||
# Determine the Docker container tags.
|
||||
TAGS="${{ env.DOCKER_IMAGE_NAME }}:${VERSION}"
|
||||
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
|
||||
TAGS="$TAGS,${{ env.DOCKER_IMAGE_NAME }}:latest"
|
||||
fi
|
||||
# Determine the release type.
|
||||
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
|
||||
IS_RELEASE=yes
|
||||
if [[ $GITHUB_REF =~ -pre\.[0-9]+ ]]; then
|
||||
RELEASE_TYPE="pre"
|
||||
else
|
||||
RELEASE_TYPE="standard"
|
||||
fi
|
||||
else
|
||||
IS_RELEASE=no
|
||||
RELEASE_TYPE="n/a"
|
||||
fi
|
||||
# Print results.
|
||||
echo "::group::Results"
|
||||
echo "Github reference: $GITHUB_REF"
|
||||
echo "Release: $IS_RELEASE"
|
||||
echo "Release type: $RELEASE_TYPE"
|
||||
echo "Docker container version: $VERSION"
|
||||
echo "Docker container version label: $LABEL_VERSION"
|
||||
echo "Docker container tag(s): $TAGS"
|
||||
echo "::endgroup::"
|
||||
# Export outputs.
|
||||
echo ::set-output name=is_release::${IS_RELEASE}
|
||||
echo ::set-output name=release_type::${RELEASE_TYPE}
|
||||
echo ::set-output name=version::${VERSION}
|
||||
echo ::set-output name=label_version::${LABEL_VERSION}
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
#echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
platforms: arm,arm64,ppc64le,mips64,s390x
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: ${{ steps.prep.outputs.is_release == 'yes' }}
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: ${{ steps.prep.outputs.is_release == 'yes' }}
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
build-args: |
|
||||
DOCKER_IMAGE_VERSION=${{ steps.prep.outputs.label_version }}
|
||||
cache-from: type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}
|
||||
cache-to: type=gha,mode=max,scope=${{ env.DOCKER_IMAGE_NAME }}
|
||||
|
||||
- name: Inspect
|
||||
if: ${{ steps.prep.outputs.is_release == 'yes' }}
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE_NAME }}:${VERSION}
|
||||
|
||||
post-build:
|
||||
name: Post-build
|
||||
needs: [ build ]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Dockerhub description
|
||||
if: ${{ steps.prep.outputs.release_type == 'standard' }}
|
||||
uses: peter-evans/dockerhub-description@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
repository: ${{ env.DOCKER_IMAGE_NAME }}
|
||||
readme-filepath: DOCKERHUB.md
|
||||
|
||||
notification:
|
||||
name: Notification
|
||||
needs: [ build, post-build ]
|
||||
runs-on: ubuntu-20.04
|
||||
if: ${{ always() }}
|
||||
|
||||
steps:
|
||||
- name: Pushover notification
|
||||
uses: desiderati/github-action-pushover@v1
|
||||
with:
|
||||
job-status: ${{ needs.build.result }}
|
||||
pushover-api-token: ${{ secrets.PUSHOVER_API_TOKEN }}
|
||||
pushover-user-key: ${{ secrets.PUSHOVER_USER_KEY }}
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
config/
|
14
.travis.yml
Normal file
14
.travis.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# Travis CI recipe to build docker image.
|
||||
#
|
||||
|
||||
sudo: required
|
||||
|
||||
language: generic
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
script:
|
||||
- echo "Starting build of Docker image..."
|
||||
- docker build --no-cache --pull -t $TRAVIS_REPO_SLUG:$TRAVIS_JOB_ID .
|
49
DOCKERHUB.md
Normal file
49
DOCKERHUB.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
# Docker container for Firefox
|
||||
[](https://hub.docker.com/r/jlesage/firefox/tags) [](https://github.com/jlesage/docker-firefox/actions/workflows/build-image.yml) [](https://github.com/jlesage/docker-firefox/releases/latest) [](https://paypal.me/JocelynLeSage/0usd)
|
||||
|
||||
This is a Docker container for [Firefox](https://www.mozilla.org/en-US/firefox/).
|
||||
|
||||
The GUI of the application is accessed through a modern web browser (no
|
||||
installation or configuration needed on the client side) or via any VNC client.
|
||||
|
||||
---
|
||||
|
||||
[](https://www.mozilla.org/en-US/firefox/)[](https://www.mozilla.org/en-US/firefox/)
|
||||
|
||||
Mozilla Firefox is a free and open-source web browser developed by Mozilla
|
||||
Foundation and its subsidiary, Mozilla Corporation.
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
**NOTE**: The Docker command provided in this quick start is given as an example
|
||||
and parameters should be adjusted to your need.
|
||||
|
||||
Launch the Firefox docker container with the following command:
|
||||
```shell
|
||||
docker run -d \
|
||||
--name=firefox \
|
||||
-p 5800:5800 \
|
||||
-v /docker/appdata/firefox:/config:rw \
|
||||
--shm-size 2g \
|
||||
jlesage/firefox
|
||||
```
|
||||
|
||||
Where:
|
||||
- `/docker/appdata/firefox`: This is where the application stores its configuration, states, log and any files needing persistency.
|
||||
|
||||
Browse to `http://your-host-ip:5800` to access the Firefox GUI.
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation is available at https://github.com/jlesage/docker-firefox.
|
||||
|
||||
## Support or Contact
|
||||
|
||||
Having troubles with the container or have questions? Please
|
||||
[create a new issue].
|
||||
|
||||
For other great Dockerized applications, see https://jlesage.github.io/docker-apps.
|
||||
|
||||
[create a new issue]: https://github.com/jlesage/docker-firefox/issues
|
109
Dockerfile
109
Dockerfile
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Chromium Dockerfile
|
||||
# firefox Dockerfile
|
||||
#
|
||||
# https://git.mmbradley.ca/MichaelBradley/docker-chromium
|
||||
# https://github.com/jlesage/docker-firefox
|
||||
#
|
||||
|
||||
# Build the membarrier check tool.
|
||||
|
@ -13,53 +13,124 @@ RUN gcc -static -o membarrier_check membarrier_check.c
|
|||
RUN strip membarrier_check
|
||||
|
||||
# Pull base image.
|
||||
FROM jlesage/baseimage-gui:alpine-3.21-v4.7.1
|
||||
FROM jlesage/baseimage-gui:alpine-3.16-v4.0.1
|
||||
|
||||
# Docker image version is provided via build arg.
|
||||
ARG DOCKER_IMAGE_VERSION=v0.1.0
|
||||
ARG DOCKER_IMAGE_VERSION=
|
||||
|
||||
# Define software versions.
|
||||
ARG CHROMIUM_VERSION=136.0.7103.113-r0
|
||||
ARG FIREFOX_VERSION=101.0.1-r0
|
||||
ARG JSONLZ4_VERSION=c4305b8
|
||||
ARG LZ4_VERSION=1.8.1.2
|
||||
#ARG PROFILE_CLEANER_VERSION=2.36
|
||||
|
||||
# Define software download URLs.
|
||||
ARG JSONLZ4_URL=https://github.com/avih/dejsonlz4/archive/${JSONLZ4_VERSION}.tar.gz
|
||||
ARG LZ4_URL=https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz
|
||||
#ARG PROFILE_CLEANER_URL=https://github.com/graysky2/profile-cleaner/raw/v${PROFILE_CLEANER_VERSION}/common/profile-cleaner.in
|
||||
|
||||
# Define working directory.
|
||||
WORKDIR /tmp
|
||||
|
||||
# Install Chromium.
|
||||
# Install JSONLZ4 tools.
|
||||
RUN \
|
||||
add-pkg --virtual build-dependencies \
|
||||
curl \
|
||||
build-base \
|
||||
&& \
|
||||
mkdir jsonlz4 && \
|
||||
mkdir lz4 && \
|
||||
curl -# -L {$JSONLZ4_URL} | tar xz --strip 1 -C jsonlz4 && \
|
||||
curl -# -L {$LZ4_URL} | tar xz --strip 1 -C lz4 && \
|
||||
mv jsonlz4/src/ref_compress/*.c jsonlz4/src/ && \
|
||||
cp lz4/lib/lz4.* jsonlz4/src/ && \
|
||||
cd jsonlz4 && \
|
||||
gcc -static -Wall -o dejsonlz4 src/dejsonlz4.c src/lz4.c && \
|
||||
gcc -static -Wall -o jsonlz4 src/jsonlz4.c src/lz4.c && \
|
||||
strip dejsonlz4 jsonlz4 && \
|
||||
cp -v dejsonlz4 /usr/bin/ && \
|
||||
cp -v jsonlz4 /usr/bin/ && \
|
||||
cd .. && \
|
||||
# Cleanup.
|
||||
del-pkg build-dependencies && \
|
||||
rm -rf /tmp/* /tmp/.[!.]*
|
||||
|
||||
# Install Firefox.
|
||||
RUN \
|
||||
# add-pkg --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
|
||||
# --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||
# --upgrade chromium=${CHROMIUM_VERSION}
|
||||
add-pkg chromium=${CHROMIUM_VERSION}
|
||||
# --upgrade firefox=${FIREFOX_VERSION}
|
||||
add-pkg firefox=${FIREFOX_VERSION}
|
||||
|
||||
# Install extra packages.
|
||||
RUN \
|
||||
add-pkg \
|
||||
# WebGL support.
|
||||
mesa-dri-gallium \
|
||||
# Audio support.
|
||||
libpulse \
|
||||
# Icons used by folder/file selection window (when saving as).
|
||||
adwaita-icon-theme \
|
||||
gnome-icon-theme \
|
||||
# A font is needed.
|
||||
font-dejavu \
|
||||
ttf-dejavu \
|
||||
# The following package is used to send key presses to the X process.
|
||||
xdotool
|
||||
|
||||
# Set default settings.
|
||||
RUN \
|
||||
CFG_FILE="$(ls /usr/lib/firefox/browser/defaults/preferences/firefox-branding.js)" && \
|
||||
echo '' >> "$CFG_FILE" && \
|
||||
echo '// Default download directory.' >> "$CFG_FILE" && \
|
||||
echo 'pref("browser.download.dir", "/config/downloads");' >> "$CFG_FILE" && \
|
||||
echo 'pref("browser.download.folderList", 2);' >> "$CFG_FILE"
|
||||
|
||||
# Install profile-cleaner.
|
||||
#RUN \
|
||||
# add-pkg --virtual build-dependencies curl && \
|
||||
# curl -# -L -o /usr/bin/profile-cleaner {$PROFILE_CLEANER_URL} && \
|
||||
# sed-patch 's/@VERSION@/'${PROFILE_CLEANER_VERSION}'/' /usr/bin/profile-cleaner && \
|
||||
# chmod +x /usr/bin/profile-cleaner && \
|
||||
# add-pkg \
|
||||
# bash \
|
||||
# file \
|
||||
# coreutils \
|
||||
# bc \
|
||||
# parallel \
|
||||
# sqlite \
|
||||
# && \
|
||||
# # Cleanup.
|
||||
# del-pkg build-dependencies && \
|
||||
# rm -rf /tmp/* /tmp/.[!.]*
|
||||
|
||||
# Enable log monitoring.
|
||||
RUN \
|
||||
sed-patch 's|LOG_FILES=|LOG_FILES=/config/log/firefox/error.log|' /etc/logmonitor/logmonitor.conf && \
|
||||
sed-patch 's|STATUS_FILES=|STATUS_FILES=/tmp/.firefox_shm_check,/tmp/.firefox_membarrier_check|' /etc/logmonitor/logmonitor.conf
|
||||
|
||||
# Generate and install favicons.
|
||||
RUN \
|
||||
APP_ICON_URL=https://github.com/jlesage/docker-templates/raw/master/jlesage/images/firefox-icon.png && \
|
||||
install_app_icon.sh "$APP_ICON_URL"
|
||||
|
||||
# Add files.
|
||||
COPY rootfs/ /
|
||||
COPY --from=membarrier /tmp/membarrier_check /usr/bin/
|
||||
|
||||
# Set internal environment variables.
|
||||
RUN \
|
||||
set-cont-env APP_NAME "Chromium" && \
|
||||
set-cont-env APP_VERSION "$CHROMIUM_VERSION" && \
|
||||
set-cont-env APP_NAME "Firefox" && \
|
||||
set-cont-env APP_VERSION "$FIREFOX_VERSION" && \
|
||||
set-cont-env DOCKER_IMAGE_VERSION "$DOCKER_IMAGE_VERSION" && \
|
||||
true
|
||||
|
||||
# Set public environment variables.
|
||||
ENV \
|
||||
FF_OPEN_URL= \
|
||||
FF_KIOSK=0
|
||||
|
||||
# Define mountable directories.
|
||||
VOLUME ["/config"]
|
||||
|
||||
# Metadata.
|
||||
LABEL \
|
||||
org.label-schema.name="chromium" \
|
||||
org.label-schema.description="Docker container for Chromium" \
|
||||
org.label-schema.name="firefox" \
|
||||
org.label-schema.description="Docker container for Firefox" \
|
||||
org.label-schema.version="${DOCKER_IMAGE_VERSION:-unknown}" \
|
||||
org.label-schema.vcs-url="https://git.mmbradley.ca/MichaelBradley/docker-chromium" \
|
||||
org.label-schema.vcs-url="https://github.com/jlesage/docker-firefox" \
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
|
22
LICENSE
22
LICENSE
|
@ -1,22 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2025 Jocelyn Le Sage
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
584
README.md
584
README.md
|
@ -1,3 +1,583 @@
|
|||
# Docker container for Chromium
|
||||
# Docker container for Firefox
|
||||
[](https://hub.docker.com/r/jlesage/firefox/tags) [](https://github.com/jlesage/docker-firefox/actions/workflows/build-image.yml) [](https://github.com/jlesage/docker-firefox/releases/latest) [](https://paypal.me/JocelynLeSage/0usd)
|
||||
|
||||
Based off of [jlesage/docker-firefox](https://github.com/jlesage/docker-firefox/)
|
||||
This is a Docker container for [Firefox](https://www.mozilla.org/en-US/firefox/).
|
||||
|
||||
The GUI of the application is accessed through a modern web browser (no
|
||||
installation or configuration needed on the client side) or via any VNC client.
|
||||
|
||||
---
|
||||
|
||||
[](https://www.mozilla.org/en-US/firefox/)[&textColor=rgba(121,121,121,1))](https://www.mozilla.org/en-US/firefox/)
|
||||
|
||||
Mozilla Firefox is a free and open-source web browser developed by Mozilla
|
||||
Foundation and its subsidiary, Mozilla Corporation.
|
||||
|
||||
---
|
||||
|
||||
## Table of Content
|
||||
|
||||
* [Quick Start](#quick-start)
|
||||
* [Usage](#usage)
|
||||
* [Environment Variables](#environment-variables)
|
||||
* [Data Volumes](#data-volumes)
|
||||
* [Ports](#ports)
|
||||
* [Changing Parameters of a Running Container](#changing-parameters-of-a-running-container)
|
||||
* [Docker Compose File](#docker-compose-file)
|
||||
* [Docker Image Versioning](#docker-image-versioning)
|
||||
* [Docker Image Update](#docker-image-update)
|
||||
* [Synology](#synology)
|
||||
* [unRAID](#unraid)
|
||||
* [User/Group IDs](#usergroup-ids)
|
||||
* [Accessing the GUI](#accessing-the-gui)
|
||||
* [Security](#security)
|
||||
* [SSVNC](#ssvnc)
|
||||
* [Certificates](#certificates)
|
||||
* [VNC Password](#vnc-password)
|
||||
* [Reverse Proxy](#reverse-proxy)
|
||||
* [Routing Based on Hostname](#routing-based-on-hostname)
|
||||
* [Routing Based on URL Path](#routing-based-on-url-path)
|
||||
* [Shell Access](#shell-access)
|
||||
* [Increasing Shared Memory Size](#increasing-shared-memory-size)
|
||||
* [Allowing the membarrier System Call](#allowing-the-membarrier-system-call)
|
||||
* [Sound Support](#sound-support)
|
||||
* [Setting Firefox Preferences Via Environment Variables](#setting-firefox-preferences-via-environment-variables)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
* [Crashes](#crashes)
|
||||
* [Support or Contact](#support-or-contact)
|
||||
|
||||
## Quick Start
|
||||
|
||||
**NOTE**: The Docker command provided in this quick start is given as an example
|
||||
and parameters should be adjusted to your need.
|
||||
|
||||
Launch the Firefox docker container with the following command:
|
||||
```shell
|
||||
docker run -d \
|
||||
--name=firefox \
|
||||
-p 5800:5800 \
|
||||
-v /docker/appdata/firefox:/config:rw \
|
||||
--shm-size 2g \
|
||||
jlesage/firefox
|
||||
```
|
||||
|
||||
Where:
|
||||
- `/docker/appdata/firefox`: This is where the application stores its configuration, states, log and any files needing persistency.
|
||||
|
||||
Browse to `http://your-host-ip:5800` to access the Firefox GUI.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
docker run [-d] \
|
||||
--name=firefox \
|
||||
[-e <VARIABLE_NAME>=<VALUE>]... \
|
||||
[-v <HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]]... \
|
||||
[-p <HOST_PORT>:<CONTAINER_PORT>]... \
|
||||
--shm-size VALUE \
|
||||
jlesage/firefox
|
||||
```
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| -d | Run the container in the background. If not set, the container runs in the foreground. |
|
||||
| -e | Pass an environment variable to the container. See the [Environment Variables](#environment-variables) section for more details. |
|
||||
| -v | Set a volume mapping (allows to share a folder/file between the host and the container). See the [Data Volumes](#data-volumes) section for more details. |
|
||||
| -p | Set a network port mapping (exposes an internal container port to the host). See the [Ports](#ports) section for more details. |
|
||||
| --shm-size | Set the size of `/dev/shm` to `VALUE`. The format of `VALUE` is `<number><unit>`, where `number` must be greater than `0` and `unit` can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). **NOTE**: To avoid crashes, it is recommended to set this value to `2g`. |
|
||||
|
||||
### Environment Variables
|
||||
|
||||
To customize some properties of the container, the following environment
|
||||
variables can be passed via the `-e` parameter (one for each variable). Value
|
||||
of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------------|----------------------------------------------|---------|
|
||||
|`USER_ID`| ID of the user the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` |
|
||||
|`GROUP_ID`| ID of the group the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` |
|
||||
|`SUP_GROUP_IDS`| Comma-separated list of supplementary group IDs of the application. | `""` |
|
||||
|`UMASK`| Mask that controls how file permissions are set for newly created files. The value of the mask is in octal notation. By default, the default umask value is `0022`, meaning that newly created files are readable by everyone, but only writable by the owner. See the online umask calculator at http://wintelguy.com/umask-calc.pl. | `0022` |
|
||||
|`TZ`| [TimeZone](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones) used by the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container. | `Etc/UTC` |
|
||||
|`KEEP_APP_RUNNING`| When set to `1`, the application will be automatically restarted when it crashes or terminates. | `0` |
|
||||
|`APP_NICENESS`| Priority at which the application should run. A niceness value of -20 is the highest priority and 19 is the lowest priority. The default niceness value is 0. **NOTE**: A negative niceness (priority increase) requires additional permissions. In this case, the container should be run with the docker option `--cap-add=SYS_NICE`. | `0` |
|
||||
|`INSTALL_PACKAGES`| Space-separated list of packages to install during the startup of the container. Packages are installed from the repository of the Linux distribution this container is based on. **ATTENTION**: Container functionality can be affected when installing a package that overrides existing container files (e.g. binaries). | `""` |
|
||||
|`CONTAINER_DEBUG`| Set to `1` to enable debug logging. | `0` |
|
||||
|`DISPLAY_WIDTH`| Width (in pixels) of the application's window. | `1920` |
|
||||
|`DISPLAY_HEIGHT`| Height (in pixels) of the application's window. | `1080` |
|
||||
|`DARK_MODE`| When set to `1`, dark mode is enabled for the application. | `0` |
|
||||
|`SECURE_CONNECTION`| When set to `1`, an encrypted connection is used to access the application's GUI (either via a web browser or VNC client). See the [Security](#security) section for more details. | `0` |
|
||||
|`SECURE_CONNECTION_VNC_METHOD`| Method used to perform the secure VNC connection. Possible values are `SSL` or `TLS`. See the [Security](#security) section for more details. | `SSL` |
|
||||
|`SECURE_CONNECTION_CERTS_CHECK_INTERVAL`| Interval, in seconds, at which the system verifies if web or VNC certificates have changed. When a change is detected, the affected services are automatically restarted. A value of `0` disables the check. | `60` |
|
||||
|`WEB_LISTENING_PORT`| Port used by the web server to serve the UI of the application. This port is used internally by the container and it is usually not required to be changed. By default, a container is created with the default bridge network, meaning that, to be accessible, each internal container port must be mapped to an external port (using the `-p` or `--publish` argument). However, if the container is created with another network type, changing the port used by the container might be useful to prevent conflict with other services/containers. **NOTE**: a value of `-1` disables listening, meaning that the application's UI won't be accessible over HTTP/HTTPs. | `5800` |
|
||||
|`VNC_LISTENING_PORT`| Port used by the VNC server to serve the UI of the application. This port is used internally by the container and it is usually not required to be changed. By default, a container is created with the default bridge network, meaning that, to be accessible, each internal container port must be mapped to an external port (using the `-p` or `--publish` argument). However, if the container is created with another network type, changing the port used by the container might be useful to prevent conflict with other services/containers. **NOTE**: a value of `-1` disables listening, meaning that the application's UI won't be accessible over VNC. | `5900` |
|
||||
|`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | `""` |
|
||||
|`ENABLE_CJK_FONT`| When set to `1`, open-source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` |
|
||||
|`FF_OPEN_URL`| The URL to open when Firefox starts. | (unset) |
|
||||
|`FF_KIOSK`| Set to `1` to enable kiosk mode. This mode launches Firefox in a very restricted and limited mode best suitable for public areas or customer-facing displays. | `0` |
|
||||
|
||||
### Data Volumes
|
||||
|
||||
The following table describes data volumes used by the container. The mappings
|
||||
are set via the `-v` parameter. Each mapping is specified with the following
|
||||
format: `<HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]`.
|
||||
|
||||
| Container path | Permissions | Description |
|
||||
|-----------------|-------------|-------------|
|
||||
|`/config`| rw | This is where the application stores its configuration, states, log and any files needing persistency. |
|
||||
|
||||
### Ports
|
||||
|
||||
Here is the list of ports used by the container. They can be mapped to the host
|
||||
via the `-p` parameter (one per port mapping). Each mapping is defined in the
|
||||
following format: `<HOST_PORT>:<CONTAINER_PORT>`. The port number inside the
|
||||
container cannot be changed, but you are free to use any port on the host side.
|
||||
|
||||
| Port | Mapping to host | Description |
|
||||
|------|-----------------|-------------|
|
||||
| 5800 | Optional | Port to access the application's GUI via the web interface. Mapping to the host is optional if access through the web interface is not wanted. For a container not using the default bridge network, the port can be changed with the `WEB_LISTENING_PORT` environment variable. |
|
||||
| 5900 | Optional | Port to access the application's GUI via the VNC protocol. Mapping to the host is optional if access through the VNC protocol is not wanted. For a container not using the default bridge network, the port can be changed with the `VNC_LISTENING_PORT` environment variable. |
|
||||
|
||||
### Changing Parameters of a Running Container
|
||||
|
||||
As can be seen, environment variables, volume and port mappings are all specified
|
||||
while creating the container.
|
||||
|
||||
The following steps describe the method used to add, remove or update
|
||||
parameter(s) of an existing container. The general idea is to destroy and
|
||||
re-create the container:
|
||||
|
||||
1. Stop the container (if it is running):
|
||||
```
|
||||
docker stop firefox
|
||||
```
|
||||
2. Remove the container:
|
||||
```
|
||||
docker rm firefox
|
||||
```
|
||||
3. Create/start the container using the `docker run` command, by adjusting
|
||||
parameters as needed.
|
||||
|
||||
**NOTE**: Since all application's data is saved under the `/config` container
|
||||
folder, destroying and re-creating a container is not a problem: nothing is lost
|
||||
and the application comes back with the same state (as long as the mapping of
|
||||
the `/config` folder remains the same).
|
||||
|
||||
## Docker Compose File
|
||||
|
||||
Here is an example of a `docker-compose.yml` file that can be used with
|
||||
[Docker Compose](https://docs.docker.com/compose/overview/).
|
||||
|
||||
Make sure to adjust according to your needs. Note that only mandatory network
|
||||
ports are part of the example.
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
services:
|
||||
firefox:
|
||||
image: jlesage/firefox
|
||||
ports:
|
||||
- "5800:5800"
|
||||
volumes:
|
||||
- "/docker/appdata/firefox:/config:rw"
|
||||
```
|
||||
|
||||
## Docker Image Versioning
|
||||
|
||||
Each release of a Docker image is versioned. Prio to october 2022, the
|
||||
[semantic versioning](https://semver.org) was used as the versioning scheme.
|
||||
|
||||
Since then, versioning scheme changed to
|
||||
[calendar versioning](https://calver.org). The format used is `YY.MM.SEQUENCE`,
|
||||
where:
|
||||
- `YY` is the zero-padded year (relative to year 2000).
|
||||
- `MM` is the zero-padded month.
|
||||
- `SEQUENCE` is the incremental release number within the month (first release
|
||||
is 1, second is 2, etc).
|
||||
|
||||
## Docker Image Update
|
||||
|
||||
Because features are added, issues are fixed, or simply because a new version
|
||||
of the containerized application is integrated, the Docker image is regularly
|
||||
updated. Different methods can be used to update the Docker image.
|
||||
|
||||
The system used to run the container may have a built-in way to update
|
||||
containers. If so, this could be your primary way to update Docker images.
|
||||
|
||||
An other way is to have the image be automatically updated with [Watchtower].
|
||||
Watchtower is a container-based solution for automating Docker image updates.
|
||||
This is a "set and forget" type of solution: once a new image is available,
|
||||
Watchtower will seamlessly perform the necessary steps to update the container.
|
||||
|
||||
Finally, the Docker image can be manually updated with these steps:
|
||||
|
||||
1. Fetch the latest image:
|
||||
```
|
||||
docker pull jlesage/firefox
|
||||
```
|
||||
2. Stop the container:
|
||||
```
|
||||
docker stop firefox
|
||||
```
|
||||
3. Remove the container:
|
||||
```
|
||||
docker rm firefox
|
||||
```
|
||||
4. Create and start the container using the `docker run` command, with the
|
||||
the same parameters that were used when it was deployed initially.
|
||||
|
||||
[Watchtower]: https://github.com/containrrr/watchtower
|
||||
|
||||
### Synology
|
||||
|
||||
For owners of a Synology NAS, the following steps can be used to update a
|
||||
container image.
|
||||
|
||||
1. Open the *Docker* application.
|
||||
2. Click on *Registry* in the left pane.
|
||||
3. In the search bar, type the name of the container (`jlesage/firefox`).
|
||||
4. Select the image, click *Download* and then choose the `latest` tag.
|
||||
5. Wait for the download to complete. A notification will appear once done.
|
||||
6. Click on *Container* in the left pane.
|
||||
7. Select your Firefox container.
|
||||
8. Stop it by clicking *Action*->*Stop*.
|
||||
9. Clear the container by clicking *Action*->*Reset* (or *Action*->*Clear* if
|
||||
you don't have the latest *Docker* application). This removes the
|
||||
container while keeping its configuration.
|
||||
10. Start the container again by clicking *Action*->*Start*. **NOTE**: The
|
||||
container may temporarily disappear from the list while it is re-created.
|
||||
|
||||
### unRAID
|
||||
|
||||
For unRAID, a container image can be updated by following these steps:
|
||||
|
||||
1. Select the *Docker* tab.
|
||||
2. Click the *Check for Updates* button at the bottom of the page.
|
||||
3. Click the *update ready* link of the container to be updated.
|
||||
|
||||
## User/Group IDs
|
||||
|
||||
When using data volumes (`-v` flags), permissions issues can occur between the
|
||||
host and the container. For example, the user within the container may not
|
||||
exist on the host. This could prevent the host from properly accessing files
|
||||
and folders on the shared volume.
|
||||
|
||||
To avoid any problem, you can specify the user the application should run as.
|
||||
|
||||
This is done by passing the user ID and group ID to the container via the
|
||||
`USER_ID` and `GROUP_ID` environment variables.
|
||||
|
||||
To find the right IDs to use, issue the following command on the host, with the
|
||||
user owning the data volume on the host:
|
||||
|
||||
id <username>
|
||||
|
||||
Which gives an output like this one:
|
||||
```
|
||||
uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),46(plugdev),113(lpadmin)
|
||||
```
|
||||
|
||||
The value of `uid` (user ID) and `gid` (group ID) are the ones that you should
|
||||
be given the container.
|
||||
|
||||
## Accessing the GUI
|
||||
|
||||
Assuming that container's ports are mapped to the same host's ports, the
|
||||
graphical interface of the application can be accessed via:
|
||||
|
||||
* A web browser:
|
||||
```
|
||||
http://<HOST IP ADDR>:5800
|
||||
```
|
||||
|
||||
* Any VNC client:
|
||||
```
|
||||
<HOST IP ADDR>:5900
|
||||
```
|
||||
|
||||
## Security
|
||||
|
||||
By default, access to the application's GUI is done over an unencrypted
|
||||
connection (HTTP or VNC).
|
||||
|
||||
Secure connection can be enabled via the `SECURE_CONNECTION` environment
|
||||
variable. See the [Environment Variables](#environment-variables) section for
|
||||
more details on how to set an environment variable.
|
||||
|
||||
When enabled, application's GUI is performed over an HTTPs connection when
|
||||
accessed with a browser. All HTTP accesses are automatically redirected to
|
||||
HTTPs.
|
||||
|
||||
When using a VNC client, the VNC connection is performed over SSL. Note that
|
||||
few VNC clients support this method. [SSVNC] is one of them.
|
||||
|
||||
[SSVNC]: http://www.karlrunge.com/x11vnc/ssvnc.html
|
||||
|
||||
### SSVNC
|
||||
|
||||
[SSVNC] is a VNC viewer that adds encryption security to VNC connections.
|
||||
|
||||
While the Linux version of [SSVNC] works well, the Windows version has some
|
||||
issues. At the time of writing, the latest version `1.0.30` is not functional,
|
||||
as a connection fails with the following error:
|
||||
```
|
||||
ReadExact: Socket error while reading
|
||||
```
|
||||
However, for your convenience, an unofficial and working version is provided
|
||||
here:
|
||||
|
||||
https://github.com/jlesage/docker-baseimage-gui/raw/master/tools/ssvnc_windows_only-1.0.30-r1.zip
|
||||
|
||||
The only difference with the official package is that the bundled version of
|
||||
`stunnel` has been upgraded to version `5.49`, which fixes the connection
|
||||
problems.
|
||||
|
||||
### Certificates
|
||||
|
||||
Here are the certificate files needed by the container. By default, when they
|
||||
are missing, self-signed certificates are generated and used. All files have
|
||||
PEM encoded, x509 certificates.
|
||||
|
||||
| Container Path | Purpose | Content |
|
||||
|---------------------------------|----------------------------|---------|
|
||||
|`/config/certs/vnc-server.pem` |VNC connection encryption. |VNC server's private key and certificate, bundled with any root and intermediate certificates.|
|
||||
|`/config/certs/web-privkey.pem` |HTTPs connection encryption.|Web server's private key.|
|
||||
|`/config/certs/web-fullchain.pem`|HTTPs connection encryption.|Web server's certificate, bundled with any root and intermediate certificates.|
|
||||
|
||||
**NOTE**: To prevent any certificate validity warnings/errors from the browser
|
||||
or VNC client, make sure to supply your own valid certificates.
|
||||
|
||||
**NOTE**: Certificate files are monitored and relevant daemons are automatically
|
||||
restarted when changes are detected.
|
||||
|
||||
### VNC Password
|
||||
|
||||
To restrict access to your application, a password can be specified. This can
|
||||
be done via two methods:
|
||||
* By using the `VNC_PASSWORD` environment variable.
|
||||
* By creating a `.vncpass_clear` file at the root of the `/config` volume.
|
||||
This file should contain the password in clear-text. During the container
|
||||
startup, content of the file is obfuscated and moved to `.vncpass`.
|
||||
|
||||
The level of security provided by the VNC password depends on two things:
|
||||
* The type of communication channel (encrypted/unencrypted).
|
||||
* How secure the access to the host is.
|
||||
|
||||
When using a VNC password, it is highly desirable to enable the secure
|
||||
connection to prevent sending the password in clear over an unencrypted channel.
|
||||
|
||||
**ATTENTION**: Password is limited to 8 characters. This limitation comes from
|
||||
the Remote Framebuffer Protocol [RFC](https://tools.ietf.org/html/rfc6143) (see
|
||||
section [7.2.2](https://tools.ietf.org/html/rfc6143#section-7.2.2)). Any
|
||||
characters beyond the limit are ignored.
|
||||
|
||||
## Reverse Proxy
|
||||
|
||||
The following sections contain NGINX configurations that need to be added in
|
||||
order to reverse proxy to this container.
|
||||
|
||||
A reverse proxy server can route HTTP requests based on the hostname or the URL
|
||||
path.
|
||||
|
||||
### Routing Based on Hostname
|
||||
|
||||
In this scenario, each hostname is routed to a different application/container.
|
||||
|
||||
For example, let's say the reverse proxy server is running on the same machine
|
||||
as this container. The server would proxy all HTTP requests sent to
|
||||
`firefox.domain.tld` to the container at `127.0.0.1:5800`.
|
||||
|
||||
Here are the relevant configuration elements that would be added to the NGINX
|
||||
configuration:
|
||||
|
||||
```
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
upstream docker-firefox {
|
||||
# If the reverse proxy server is not running on the same machine as the
|
||||
# Docker container, use the IP of the Docker host here.
|
||||
# Make sure to adjust the port according to how port 5800 of the
|
||||
# container has been mapped on the host.
|
||||
server 127.0.0.1:5800;
|
||||
}
|
||||
|
||||
server {
|
||||
[...]
|
||||
|
||||
server_name firefox.domain.tld;
|
||||
|
||||
location / {
|
||||
proxy_pass http://docker-firefox;
|
||||
}
|
||||
|
||||
location /websockify {
|
||||
proxy_pass http://docker-firefox;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_read_timeout 86400;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Routing Based on URL Path
|
||||
|
||||
In this scenario, the hostname is the same, but different URL paths are used to
|
||||
route to different applications/containers.
|
||||
|
||||
For example, let's say the reverse proxy server is running on the same machine
|
||||
as this container. The server would proxy all HTTP requests for
|
||||
`server.domain.tld/firefox` to the container at `127.0.0.1:5800`.
|
||||
|
||||
Here are the relevant configuration elements that would be added to the NGINX
|
||||
configuration:
|
||||
|
||||
```
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
upstream docker-firefox {
|
||||
# If the reverse proxy server is not running on the same machine as the
|
||||
# Docker container, use the IP of the Docker host here.
|
||||
# Make sure to adjust the port according to how port 5800 of the
|
||||
# container has been mapped on the host.
|
||||
server 127.0.0.1:5800;
|
||||
}
|
||||
|
||||
server {
|
||||
[...]
|
||||
|
||||
location = /firefox {return 301 $scheme://$http_host/firefox/;}
|
||||
location /firefox/ {
|
||||
proxy_pass http://docker-firefox/;
|
||||
location /firefox/websockify {
|
||||
proxy_pass http://docker-firefox/websockify/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_read_timeout 86400;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Shell Access
|
||||
|
||||
To get shell access to the running container, execute the following command:
|
||||
|
||||
```shell
|
||||
docker exec -ti CONTAINER sh
|
||||
```
|
||||
|
||||
Where `CONTAINER` is the ID or the name of the container used during its
|
||||
creation (e.g. `crashplan-pro`).
|
||||
|
||||
## Increasing Shared Memory Size
|
||||
|
||||
To prevent crashes from happening when running Firefox
|
||||
inside a Docker container, the size of the shared memory located at `/dev/shm`
|
||||
must be increased. The issue is documented [here].
|
||||
|
||||
By default, the size is 64MB, which is not enough. It is recommended to use a
|
||||
size of 2GB. This value is arbitrary, but known to work well. Setting the
|
||||
size of `/dev/shm` can be done via two method:
|
||||
|
||||
- By adding the `--shm-size 2g` parameter to the `docker run` command. See
|
||||
the [Usage](#usage) section for more details.
|
||||
- By using shared memory of the host, by mapping `/dev/shm` via the parameter
|
||||
`-v /dev/shm:/dev/shm` of the `docker run` command.
|
||||
|
||||
## Allowing the membarrier System Call
|
||||
|
||||
To properly work, recent versions of Firefox need the
|
||||
`membarrier` system call. Without it, tabs would frequently crash.
|
||||
|
||||
Docker uses [seccomp profile] to restrict system calls available to the
|
||||
container. Before Docker version `20.10.0`, the `membarrier` system call was
|
||||
not allowed in the default profile. If you run a such version, you can use one
|
||||
of the following solutions, from the most to the least secure, to provide the
|
||||
container permission to use this sytem call:
|
||||
|
||||
1. Run the container with a custom seccomp profile allowing the `membarrier`
|
||||
system call. The [latest official seccomp profile] can be used. Download
|
||||
the file and then add the following parameter when creating the container:
|
||||
`--security-opt seccomp=/path/to/seccomp_profile.json`.
|
||||
2. Run the container without the default seccomp profile (thus allowing all
|
||||
system calls). Use the following parameter when creating the container:
|
||||
`--security-opt seccomp=unconfined`.
|
||||
3. Run the container in privileged mode. This effectively disables usage of
|
||||
seccomp. Add the `--privileged` parameter when creating the container.
|
||||
|
||||
[here]: https://bugzilla.mozilla.org/show_bug.cgi?id=1338771#c10
|
||||
[latest official seccomp profile]: https://github.com/moby/moby/blob/master/profiles/seccomp/default.json
|
||||
[seccomp profile]: https://docs.docker.com/engine/security/seccomp/
|
||||
|
||||
## Sound Support
|
||||
|
||||
For Firefox to be able to use the audio device available on
|
||||
the host, `/dev/snd` must be exposed to the container by adding the
|
||||
`--device /dev/snd` parameter to the `docker run` command.
|
||||
|
||||
## Setting Firefox Preferences Via Environment Variables
|
||||
|
||||
Firefox preferences can be set via environment variables
|
||||
passed to the container. During the startup, a script process all these
|
||||
variables and modify the preference file accordingly.
|
||||
|
||||
The name of the environment variable must start with `FF_PREF_`, followed by a
|
||||
string of your choice. For example, `FF_PREF_MY_PREF` is a valid name.
|
||||
|
||||
The content of the variable should be in the format `NAME=VAL`, where `NAME` is
|
||||
the name of the preference (as found in the `about:config` page) and `VAL` is
|
||||
its value. A value can be one of the following types:
|
||||
- string
|
||||
- integer
|
||||
- boolean
|
||||
|
||||
It is important to note that a value of type `string` should be surrounded by
|
||||
double quotes. Other types don't need them.
|
||||
|
||||
For example, to set the `network.proxy.http` preference, one would pass the
|
||||
environment variable to the container by adding the following argument to the
|
||||
`docker run` command:
|
||||
|
||||
```
|
||||
-e "FF_PREF_HTTP_PROXY=network.proxy.http=\"proxy.example.com\""
|
||||
```
|
||||
|
||||
If a preference needs to be *removed*, its value should be set to `UNSET`. For
|
||||
example:
|
||||
|
||||
```
|
||||
-e "FF_PREF_HTTP_PROXY=network.proxy.http=UNSET"
|
||||
```
|
||||
|
||||
**NOTE**: This is an advanced usage and it is recommended to set preferences
|
||||
via Firefox directly.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Crashes
|
||||
|
||||
If Firefox is crashing frequently, make sure that:
|
||||
- The size of the shared memory located at `/dev/shm` has been increased. See
|
||||
the [Increasing Shared Memory Size](#increasing-shared-memory-size) section
|
||||
for more details.
|
||||
- The `membarrier` system call is not blocked by Docker. See the
|
||||
[Allowing the membarrier System Call](#allowing-the-membarrier-system-call)
|
||||
for more details.
|
||||
- Make sure the kernel of your Linux distribution is up-to-date.
|
||||
|
||||
## Support or Contact
|
||||
|
||||
Having troubles with the container or have questions? Please
|
||||
[create a new issue].
|
||||
|
||||
For other great Dockerized applications, see https://jlesage.github.io/docker-apps.
|
||||
|
||||
[create a new issue]: https://github.com/jlesage/docker-firefox/issues
|
||||
|
|
299
appdefs.yml
Normal file
299
appdefs.yml
Normal file
|
@ -0,0 +1,299 @@
|
|||
---
|
||||
|
||||
#
|
||||
# Definitions for Firefox docker container.
|
||||
#
|
||||
# This file is used as data source to generate README.md and unRAID template files
|
||||
# from Jinja2 templates.
|
||||
#
|
||||
#
|
||||
app:
|
||||
id: 14
|
||||
name: firefox
|
||||
friendly_name: Firefox
|
||||
gui_type: x11
|
||||
project:
|
||||
description: |-
|
||||
Mozilla Firefox is a free and open-source web browser developed by Mozilla
|
||||
Foundation and its subsidiary, Mozilla Corporation.
|
||||
url: https://www.mozilla.org/en-US/firefox/
|
||||
unraid:
|
||||
support_url: https://forums.unraid.net/topic/69440-support-firefox/
|
||||
category: "Tools:"
|
||||
documentation:
|
||||
sections:
|
||||
- title: Increasing Shared Memory Size
|
||||
level: 2
|
||||
content: |-
|
||||
To prevent crashes from happening when running {{ app.friendly_name }}
|
||||
inside a Docker container, the size of the shared memory located at `/dev/shm`
|
||||
must be increased. The issue is documented [here].
|
||||
|
||||
By default, the size is 64MB, which is not enough. It is recommended to use a
|
||||
size of 2GB. This value is arbitrary, but known to work well. Setting the
|
||||
size of `/dev/shm` can be done via two method:
|
||||
|
||||
- By adding the `--shm-size 2g` parameter to the `docker run` command. See
|
||||
the [Usage](#usage) section for more details.
|
||||
- By using shared memory of the host, by mapping `/dev/shm` via the parameter
|
||||
`-v /dev/shm:/dev/shm` of the `docker run` command.
|
||||
- title: Allowing the membarrier System Call
|
||||
level: 2
|
||||
content: |-
|
||||
To properly work, recent versions of {{ app.friendly_name }} need the
|
||||
`membarrier` system call. Without it, tabs would frequently crash.
|
||||
|
||||
Docker uses [seccomp profile] to restrict system calls available to the
|
||||
container. Before Docker version `20.10.0`, the `membarrier` system call was
|
||||
not allowed in the default profile. If you run a such version, you can use one
|
||||
of the following solutions, from the most to the least secure, to provide the
|
||||
container permission to use this sytem call:
|
||||
|
||||
1. Run the container with a custom seccomp profile allowing the `membarrier`
|
||||
system call. The [latest official seccomp profile] can be used. Download
|
||||
the file and then add the following parameter when creating the container:
|
||||
`--security-opt seccomp=/path/to/seccomp_profile.json`.
|
||||
2. Run the container without the default seccomp profile (thus allowing all
|
||||
system calls). Use the following parameter when creating the container:
|
||||
`--security-opt seccomp=unconfined`.
|
||||
3. Run the container in privileged mode. This effectively disables usage of
|
||||
seccomp. Add the `--privileged` parameter when creating the container.
|
||||
|
||||
[here]: https://bugzilla.mozilla.org/show_bug.cgi?id=1338771#c10
|
||||
[latest official seccomp profile]: https://github.com/moby/moby/blob/master/profiles/seccomp/default.json
|
||||
[seccomp profile]: https://docs.docker.com/engine/security/seccomp/
|
||||
- title: Sound Support
|
||||
level: 2
|
||||
content: |-
|
||||
For {{ app.friendly_name }} to be able to use the audio device available on
|
||||
the host, `/dev/snd` must be exposed to the container by adding the
|
||||
`--device /dev/snd` parameter to the `docker run` command.
|
||||
- title: Setting {{ app.friendly_name }} Preferences Via Environment Variables
|
||||
level: 2
|
||||
content: |-
|
||||
{{ app.friendly_name }} preferences can be set via environment variables
|
||||
passed to the container. During the startup, a script process all these
|
||||
variables and modify the preference file accordingly.
|
||||
|
||||
The name of the environment variable must start with `FF_PREF_`, followed by a
|
||||
string of your choice. For example, `FF_PREF_MY_PREF` is a valid name.
|
||||
|
||||
The content of the variable should be in the format `NAME=VAL`, where `NAME` is
|
||||
the name of the preference (as found in the `about:config` page) and `VAL` is
|
||||
its value. A value can be one of the following types:
|
||||
- string
|
||||
- integer
|
||||
- boolean
|
||||
|
||||
It is important to note that a value of type `string` should be surrounded by
|
||||
double quotes. Other types don't need them.
|
||||
|
||||
For example, to set the `network.proxy.http` preference, one would pass the
|
||||
environment variable to the container by adding the following argument to the
|
||||
`docker run` command:
|
||||
|
||||
```
|
||||
-e "FF_PREF_HTTP_PROXY=network.proxy.http=\"proxy.example.com\""
|
||||
```
|
||||
|
||||
If a preference needs to be *removed*, its value should be set to `UNSET`. For
|
||||
example:
|
||||
|
||||
```
|
||||
-e "FF_PREF_HTTP_PROXY=network.proxy.http=UNSET"
|
||||
```
|
||||
|
||||
**NOTE**: This is an advanced usage and it is recommended to set preferences
|
||||
via {{ app.friendly_name }} directly.
|
||||
- title: Troubleshooting
|
||||
level: 2
|
||||
- title: Crashes
|
||||
level: 3
|
||||
content: |-
|
||||
If {{ app.friendly_name }} is crashing frequently, make sure that:
|
||||
- The size of the shared memory located at `/dev/shm` has been increased. See
|
||||
the [Increasing Shared Memory Size](#increasing-shared-memory-size) section
|
||||
for more details.
|
||||
- The `membarrier` system call is not blocked by Docker. See the
|
||||
[Allowing the membarrier System Call](#allowing-the-membarrier-system-call)
|
||||
for more details.
|
||||
- Make sure the kernel of your Linux distribution is up-to-date.
|
||||
changelog:
|
||||
- version: 1.18.0
|
||||
date: 2021-12-30
|
||||
changes:
|
||||
- 'Updated Firefox to version 94.0-r0.'
|
||||
- 'Now using baseimage version 3.5.8, based on Alpine 3.15, which brings the following change:'
|
||||
- '2:Updated installed packages to get latest security fixes.'
|
||||
- version: 1.17.1
|
||||
date: 2021-04-13
|
||||
changes:
|
||||
- 'Now using baseimage version 3.5.7, which brings the following change:'
|
||||
- '2:Updated installed packages to get latest security fixes.'
|
||||
- version: 1.17.0
|
||||
date: 2021-02-06
|
||||
changes:
|
||||
- 'Updated Firefox to version 84.0.2-r0.'
|
||||
- version: 1.16.0
|
||||
date: 2020-12-16
|
||||
changes:
|
||||
- 'Updated Firefox to version 83.0-r1.'
|
||||
- version: 1.15.0
|
||||
date: 2020-10-01
|
||||
changes:
|
||||
- 'Updated Firefox to version 81.0-r0'
|
||||
- version: 1.14.0
|
||||
date: 2020-08-05
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 79.0-r0.'
|
||||
- 'Now using baseimage to version 3.5.6, which brings the following changes:'
|
||||
- '2:Other small adjustments for the YAD log monitor target.'
|
||||
- version: 1.13.0
|
||||
date: 2020-07-19
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 78.0.2-r1.'
|
||||
- 'Added check for missing `membarrier` system call support.'
|
||||
- 'Now using baseimage v3.5.5, based on Alpine 3.12, which brings the following changes:'
|
||||
- '2:Upgraded glibc to version 2.31 on Alpine Linux images with glibc integrated.'
|
||||
- '2:Updated installed packages to get latest security fixes.'
|
||||
- '2:Adjusted the log monitor target for recent versions of YAD.'
|
||||
- version: 1.12.0
|
||||
date: 2020-06-24
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 77.0.1-r2.'
|
||||
- version: 1.11.0
|
||||
date: 2020-04-25
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 75.0-r2.'
|
||||
- version: 1.10.0
|
||||
date: 2020-03-15
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 74.0-r0.'
|
||||
- version: 1.9.1
|
||||
date: 2020-02-10
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 72.0.2-r0.'
|
||||
- version: 1.9.0
|
||||
date: 2020-01-14
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 72.0.1-r0.'
|
||||
- version: 1.8.0
|
||||
date: 2019-12-25
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 71.0-r0.'
|
||||
- 'Now using baseimage v3.5.3, which brings the following changes:'
|
||||
- '2:Updated installed packages to get latest security fixes.'
|
||||
- '2:Make sure the tzdata is installed.'
|
||||
- 'Use baseimage based on Alpine Linux 3.10.'
|
||||
- version: 1.7.1
|
||||
date: 2019-08-26
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 68.0.2-r0.'
|
||||
- version: 1.7.0
|
||||
date: 2019-08-05
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 68.0.r0.'
|
||||
- version: 1.6.0
|
||||
date: 2019-07-17
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 67.0.4-r0.'
|
||||
- version: 1.5.1
|
||||
date: 2019-05-12
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 66.0.5-r1.'
|
||||
- version: 1.5.0
|
||||
date: 2019-05-09
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 66.0.4-r0.'
|
||||
- 'Print the Firefox version during the container startup.'
|
||||
- version: 1.4.1
|
||||
date: 2019-04-24
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 62.0.3-r4.'
|
||||
- 'Now using baseimage v3.5.2, which brings the following changes:'
|
||||
- '2:Updated installed packages to get latest security fixes.'
|
||||
- '2:Fixed issue where the container could have a zombie process.'
|
||||
- '2:Fixed issue where the password would not be submitted when pressing the enter key in the password modal.'
|
||||
- '2:Use relative path for favicon ressources to be more friendly with reverse proxy senarios.'
|
||||
- version: 1.4.0
|
||||
date: 2019-02-24
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 62.0.3-r2.'
|
||||
- 'Preferences can now be set via environment variables.'
|
||||
- 'Use baseimage based on Alpine Linux 3.9.'
|
||||
- version: 1.3.1
|
||||
date: 2018-09-18
|
||||
changes:
|
||||
- 'Now using baseimage v3.5.1, which brings the following changes:'
|
||||
- '2:Updated installed packages to get latest security fixes.'
|
||||
- version: 1.3.0
|
||||
date: 2018-07-27
|
||||
changes:
|
||||
- 'Added support for more playable video formats.'
|
||||
- 'Added support for sound in Firefox.'
|
||||
- version: 1.2.0
|
||||
date: 2018-07-12
|
||||
changes:
|
||||
- 'Now using baseimage v3.4.0, which is based on Alpine Linux 3.8.'
|
||||
- 'Upgraded Firefox to version 61.0.1-r0.'
|
||||
- version: 1.1.0
|
||||
date: 2018-05-31
|
||||
changes:
|
||||
- 'Upgraded Firefox to version 60.0.1-r0.'
|
||||
- version: 1.0.2
|
||||
date: 2018-03-15
|
||||
changes:
|
||||
- 'Fixed issue where Firefox would not gracefully terminate.'
|
||||
- 'Fixed an issue where restoring session would resize window to the wrong dimensions.'
|
||||
- version: 1.0.1
|
||||
date: 2018-03-02
|
||||
changes:
|
||||
- 'Now using baseimage v3.3.4, which brings the following changes:'
|
||||
- '2:Fixed issue where log monitor states were not cleared during container startup.'
|
||||
- 'Updated Firefox to version 58.0.1-r2.'
|
||||
- version: 1.0.0
|
||||
date: 2018-02-16
|
||||
changes:
|
||||
- 'Initial release.'
|
||||
|
||||
container:
|
||||
rough_download_size: 150MB
|
||||
unsupported_volume: /storage
|
||||
|
||||
# Environment variables.
|
||||
environment_variables:
|
||||
- name: FF_OPEN_URL
|
||||
description: >-
|
||||
The URL to open when {{ app.friendly_name }} starts.
|
||||
type: public
|
||||
default:
|
||||
- name: FF_KIOSK
|
||||
description: >-
|
||||
Set to `1` to enable kiosk mode. This mode launches Firefox in a very
|
||||
restricted and limited mode best suitable for public areas or
|
||||
customer-facing displays.
|
||||
type: public
|
||||
default: 0
|
||||
|
||||
# Volumes
|
||||
volumes: []
|
||||
|
||||
# Network ports
|
||||
ports: []
|
||||
|
||||
# Devices
|
||||
devices:
|
||||
- path: /dev/snd
|
||||
description: Optional Linux device to expose to have sound.
|
||||
|
||||
# Extra parameters
|
||||
extra_params:
|
||||
- name: shm-size
|
||||
value: 2g
|
||||
description: >-
|
||||
Set the size of `/dev/shm` to `VALUE`. The format of `VALUE` is
|
||||
`<number><unit>`, where `number` must be greater than `0` and `unit`
|
||||
can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g`
|
||||
(gigabytes). **NOTE**: To avoid crashes, it is recommended to set this
|
||||
value to `2g`.
|
||||
include_in_quick_start: true
|
21
compose.yaml
21
compose.yaml
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
services:
|
||||
docker-chromium:
|
||||
image: git.mmbradley.ca/michaelbradley/docker-chromium:latest
|
||||
container_name: docker-chromium
|
||||
restart: unless-stopped
|
||||
shm_size: 2gb
|
||||
ports:
|
||||
- '5800:5800'
|
||||
# Seems to break on restarts, recommend only using for debugging
|
||||
# volumes:
|
||||
# - ./config:/config
|
||||
environment:
|
||||
LANG: en_CA.UTF-8
|
||||
TZ: America/Toronto
|
||||
KEEP_APP_RUNNING: 1
|
||||
WEB_AUDIO: 1
|
||||
WEB_AUTHENTICATION: 1
|
||||
WEB_AUTHENTICATION_USERNAME: username
|
||||
WEB_AUTHENTICATION_PASSWORD: password
|
||||
SECURE_CONNECTION: 1
|
39
hooks/post_push
Executable file
39
hooks/post_push
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Post push hook for Docker Automated Build.
|
||||
#
|
||||
# This hook adds the 'latest' tag to the image.
|
||||
#
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
source custom_hook_env
|
||||
|
||||
echo "Environment variables:
|
||||
IMAGE_NAME=$IMAGE_NAME
|
||||
DOCKER_REPO=$DOCKER_REPO
|
||||
DOCKER_TAG=$DOCKER_TAG
|
||||
SOURCE_BRANCH=$SOURCE_BRANCH
|
||||
IMAGE_VERSION=$IMAGE_VERSION
|
||||
"
|
||||
|
||||
if [[ "$DOCKER_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+-alpha[0-9]+$ ]]; then
|
||||
DOCKER_NEWTAG="$(echo "$DOCKER_TAG" | sed 's/-alpha[0-9]\+$/-alpha/')"
|
||||
elif [[ "$DOCKER_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+-beta[0-9]+$ ]]; then
|
||||
DOCKER_NEWTAG="$(echo "$DOCKER_TAG" | sed 's/-beta[0-9]\+$/-beta/')"
|
||||
elif [[ "$DOCKER_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$ ]]; then
|
||||
DOCKER_NEWTAG="$(echo "$DOCKER_TAG" | sed 's/-rc[0-9]\+$/-rc/')"
|
||||
elif [[ "$DOCKER_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
DOCKER_NEWTAG="latest"
|
||||
else
|
||||
echo "ERROR: Invalid docker tag."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Adding tag '$DOCKER_NEWTAG' to image..."
|
||||
docker tag $IMAGE_NAME ${DOCKER_REPO}:$DOCKER_NEWTAG
|
||||
echo "Pushing image..."
|
||||
docker push ${DOCKER_REPO}:$DOCKER_NEWTAG
|
||||
|
||||
echo "post_push hook terminated successfully."
|
38
hooks/pre_build
Executable file
38
hooks/pre_build
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Pre build hook for Docker Automated Build.
|
||||
#
|
||||
# This hooks modifies the Dockerfile by inserting the image version in the
|
||||
# related label.
|
||||
#
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
# Make sure the DOCKER_TAG has a supported format like:
|
||||
# v1.0.0
|
||||
# v0.1.0-beta1
|
||||
# v2.0.0-rc2
|
||||
if [[ ! "$DOCKER_TAG" =~ ^v[0-9\.]+(-(alpha|beta|rc)[0-9]+)?$ ]]; then
|
||||
echo "Unsupported DOCKER_TAG: $DOCKER_TAG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The version to use is the same has the DOCKER_TAG, minus the initial 'v'.
|
||||
IMAGE_VERSION="${DOCKER_TAG:1}"
|
||||
|
||||
# Export our custom variables.
|
||||
echo "IMAGE_VERSION=\"$IMAGE_VERSION\"" >> custom_hook_env
|
||||
|
||||
echo "Environment variables:
|
||||
IMAGE_NAME=$IMAGE_NAME
|
||||
DOCKER_REPO=$DOCKER_REPO
|
||||
DOCKER_TAG=$DOCKER_TAG
|
||||
SOURCE_BRANCH=$SOURCE_BRANCH
|
||||
IMAGE_VERSION=$IMAGE_VERSION
|
||||
"
|
||||
|
||||
echo "Inserting image version in Dockerfile..."
|
||||
sed -i "s/org.label-schema.version=\"unknown\"/org.label-schema.version=\"$IMAGE_VERSION\"/" Dockerfile
|
||||
|
||||
echo "pre_build hook terminated successfully."
|
2
rootfs/defaults/prefs.js
Normal file
2
rootfs/defaults/prefs.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Disable the privacy notice page.
|
||||
user_pref("toolkit.telemetry.reportingpolicy.firstRun", false);
|
|
@ -13,5 +13,9 @@ fi
|
|||
# Save the associated group.
|
||||
SND_GRP="$(find "$SND_DEV" -maxdepth 1 -not -type d -exec stat -c "%g" {} \; | sort -u | tail -n1)"
|
||||
echo "sound device group $SND_GRP."
|
||||
if [ -f /var/run/s6/container_environment/SUP_GROUP_IDS ]; then
|
||||
echo -n "," >> /var/run/s6/container_environment/SUP_GROUP_IDS
|
||||
fi
|
||||
echo -n "$SND_GRP" >> /var/run/s6/container_environment/SUP_GROUP_IDS
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
||||
# vim: set ft=sh :
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
# Make sure some directories are created.
|
||||
mkdir -p /config/downloads
|
||||
mkdir -p /config/log/chromium
|
||||
|
||||
# Generate machine id.
|
||||
if [ ! -f /config/machine-id ]; then
|
||||
echo "generating machine-id..."
|
||||
cat /proc/sys/kernel/random/uuid | tr -d '-' > /config/machine-id
|
||||
fi
|
||||
|
||||
# Initialize log files.
|
||||
for LOG_FILE in /config/log/chromium/output.log /config/log/chromium/error.log
|
||||
do
|
||||
touch "$LOG_FILE"
|
||||
|
||||
# Make sure the file doesn't grow indefinitely.
|
||||
if [ "$(stat -c %s "$LOG_FILE")" -gt 1048576 ]; then
|
||||
echo > "$LOG_FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
74
rootfs/etc/cont-init.d/55-firefox.sh
Executable file
74
rootfs/etc/cont-init.d/55-firefox.sh
Executable file
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
# Make sure some directories are created.
|
||||
mkdir -p /config/downloads
|
||||
mkdir -p /config/log/firefox
|
||||
mkdir -p /config/profile
|
||||
|
||||
# Generate machine id.
|
||||
if [ ! -f /config/machine-id ]; then
|
||||
echo "generating machine-id..."
|
||||
cat /proc/sys/kernel/random/uuid | tr -d '-' > /config/machine-id
|
||||
fi
|
||||
|
||||
# Copy default preferences.
|
||||
[ -f /config/profile/prefs.js ] || cp /defaults/prefs.js /config/profile/prefs.js
|
||||
|
||||
# Verify the size of /dev/shm.
|
||||
SHM_SIZE_MB="$(df -m /dev/shm | tail -n 1 | tr -s ' ' | cut -d ' ' -f2)"
|
||||
if [ "$SHM_SIZE_MB" -eq 64 ]; then
|
||||
echo 'SHM_CHECK_FAIL' > /tmp/.firefox_shm_check
|
||||
else
|
||||
echo 'SHM_CHECK_PASS' > /tmp/.firefox_shm_check
|
||||
fi
|
||||
chown $USER_ID:$GROUP_ID /tmp/.firefox_shm_check
|
||||
|
||||
if /usr/bin/membarrier_check 2>/dev/null; then
|
||||
echo 'MEMBARRIER_CHECK_PASS' > /tmp/.firefox_membarrier_check
|
||||
else
|
||||
echo 'MEMBARRIER_CHECK_FAIL' > /tmp/.firefox_membarrier_check
|
||||
fi
|
||||
chown $USER_ID:$GROUP_ID /tmp/.firefox_membarrier_check
|
||||
|
||||
# Clean/optimize Firefox databases.
|
||||
#if [ -d /config/.mozilla/firefox ] && [ -d /config/profile ]; then
|
||||
# [ -f /config/.mozilla/firefox/profiles.ini ] || cp /defaults/profiles.ini /config/.mozilla/firefox/
|
||||
# env HOME=/config /usr/bin/profile-cleaner f
|
||||
#fi
|
||||
|
||||
# Fix window display size is session stores.
|
||||
if [ -n "$(ls /config/profile/sessionstore-backups/*.jsonlz4 2>/dev/null)" ]; then
|
||||
for FILE in /config/profile/sessionstore-backups/*.jsonlz4; do
|
||||
WORKDIR="$(mktemp -d)"
|
||||
|
||||
dejsonlz4 "$FILE" "$WORKDIR"/json
|
||||
cp "$WORKDIR"/json "$WORKDIR"/json.orig
|
||||
|
||||
sed -i 's/"width":[0-9]\+/"width":'$DISPLAY_WIDTH'/' "$WORKDIR"/json
|
||||
sed -i 's/"height":[0-9]\+/"height":'$DISPLAY_HEIGHT'/' "$WORKDIR"/json
|
||||
sed -i 's/"screenX":[0-9]\+/"screenX":0/' "$WORKDIR"/json
|
||||
sed -i 's/"screenY":[0-9]\+/"screenY":0/' "$WORKDIR"/json
|
||||
|
||||
if ! diff "$WORKDIR"/json "$WORKDIR"/json.orig >/dev/null; then
|
||||
jsonlz4 "$WORKDIR"/json "$WORKDIR"/jsonlz4
|
||||
mv "$WORKDIR"/jsonlz4 "$FILE"
|
||||
echo "fixed display size in $FILE."
|
||||
fi
|
||||
|
||||
rm -r "$WORKDIR"
|
||||
done
|
||||
fi
|
||||
|
||||
# Make sure monitored log files exist.
|
||||
for LOG_FILE in /config/log/firefox/error.log
|
||||
do
|
||||
touch "$LOG_FILE"
|
||||
done
|
||||
|
||||
# Take ownership of the config directory content.
|
||||
find /config -mindepth 1 -exec chown $USER_ID:$GROUP_ID {} \;
|
||||
|
||||
# vim: set ft=sh :
|
44
rootfs/etc/cont-init.d/56-firefox-set-prefs-from-env.sh
Executable file
44
rootfs/etc/cont-init.d/56-firefox-set-prefs-from-env.sh
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
PREF_FILE="${1:-/config/profile/prefs.js}"
|
||||
|
||||
if [ -z "$PREF_FILE" ]; then
|
||||
echo "ERROR: Preference file not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$PREF_FILE")"
|
||||
[ -f "$PREF_FILE" ] || touch "$PREF_FILE"
|
||||
|
||||
env | grep "^FF_PREF_" | while read ENV
|
||||
do
|
||||
ENAME="$(echo "$ENV" | cut -d '=' -f1)"
|
||||
EVAL="$(echo "$ENV" | cut -d '=' -f2-)"
|
||||
|
||||
if [ -z "$EVAL" ]; then
|
||||
echo "Skipping environment variable '$ENAME': no value set."
|
||||
continue
|
||||
fi
|
||||
|
||||
if echo "$EVAL" | grep -q "="; then
|
||||
PNAME="$(echo "$EVAL" | cut -d '=' -f1)"
|
||||
PVAL="$(echo "$EVAL" | cut -d '=' -f2-)"
|
||||
[ -n "$PVAL" ] || PVAL='""'
|
||||
else
|
||||
PNAME="$EVAL"
|
||||
PVAL='""'
|
||||
fi
|
||||
|
||||
if [ "$PVAL" = "UNSET" ]; then
|
||||
echo "Removing preference '$PNAME'..."
|
||||
sed -i "/user_pref(\"$PNAME\",.*);/d" "$PREF_FILE"
|
||||
elif grep -q "user_pref(\"$PNAME\"," "$PREF_FILE"; then
|
||||
echo "Setting preference '$PNAME'..."
|
||||
sed -i "s/user_pref(\"$PNAME\",.*);/user_pref(\"$PNAME\", $PVAL);/" "$PREF_FILE"
|
||||
else
|
||||
echo "Setting new preference '$PNAME'..."
|
||||
echo "user_pref(\"$PNAME\", $PVAL);" >> "$PREF_FILE"
|
||||
fi
|
||||
done
|
2
rootfs/etc/jwm/main-window-selection.jwmrc
Normal file
2
rootfs/etc/jwm/main-window-selection.jwmrc
Normal file
|
@ -0,0 +1,2 @@
|
|||
<Type>normal</Type>
|
||||
<Name>^Navigator</Name>
|
2
rootfs/etc/logmonitor/notifications.d/membarrier/desc
Executable file
2
rootfs/etc/logmonitor/notifications.d/membarrier/desc
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
echo "$APP_NAME is likely to crash because it requires the membarrier system call. See the documentation of this Docker container to find out how this system call can be allowed."
|
16
rootfs/etc/logmonitor/notifications.d/membarrier/filter
Executable file
16
rootfs/etc/logmonitor/notifications.d/membarrier/filter
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
LINE="$1"
|
||||
|
||||
if [ "$LINE" = "MEMBARRIER_CHECK_FAIL" ]; then
|
||||
echo 'MEMBARRIER_CHECK_ACK' > /tmp/.firefox_membarrier_check
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# No match found.
|
||||
exit 1
|
||||
|
||||
# vim: set ft=sh :
|
1
rootfs/etc/logmonitor/notifications.d/membarrier/level
Normal file
1
rootfs/etc/logmonitor/notifications.d/membarrier/level
Normal file
|
@ -0,0 +1 @@
|
|||
WARNING
|
2
rootfs/etc/logmonitor/notifications.d/membarrier/title
Executable file
2
rootfs/etc/logmonitor/notifications.d/membarrier/title
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
echo "$APP_NAME requires the membarrier system call."
|
2
rootfs/etc/logmonitor/notifications.d/shm_size/desc
Executable file
2
rootfs/etc/logmonitor/notifications.d/shm_size/desc
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
echo "$APP_NAME is likely to crash because of the lack of shared memory. Size of shared memory needs to be increased. See the documentation of the Docker container to find out how this can be done."
|
16
rootfs/etc/logmonitor/notifications.d/shm_size/filter
Executable file
16
rootfs/etc/logmonitor/notifications.d/shm_size/filter
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
LINE="$1"
|
||||
|
||||
if [ "$LINE" = "SHM_CHECK_FAIL" ]; then
|
||||
echo 'SHM_CHECK_ACK' > /tmp/.firefox_shm_check
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# No match found.
|
||||
exit 1
|
||||
|
||||
# vim: set ft=sh :
|
1
rootfs/etc/logmonitor/notifications.d/shm_size/level
Normal file
1
rootfs/etc/logmonitor/notifications.d/shm_size/level
Normal file
|
@ -0,0 +1 @@
|
|||
WARNING
|
2
rootfs/etc/logmonitor/notifications.d/shm_size/title
Executable file
2
rootfs/etc/logmonitor/notifications.d/shm_size/title
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
echo "$APP_NAME lacks of shared memory."
|
2
rootfs/etc/logmonitor/notifications.d/tab_crash/desc
Executable file
2
rootfs/etc/logmonitor/notifications.d/tab_crash/desc
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
echo "A $APP_NAME tab crashed because of the lack of shared memory. Size of shared memory needs to be increased. See the documentation of this Docker container to find out how this can be done."
|
17
rootfs/etc/logmonitor/notifications.d/tab_crash/filter
Executable file
17
rootfs/etc/logmonitor/notifications.d/tab_crash/filter
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
LINE="$1"
|
||||
|
||||
#if echo "$LINE" | grep -q "OutOfMemoryError occurred...RESTARTING!"; then
|
||||
if [ "$LINE" = "###!!! [Parent][MessageChannel] Error: (msgtype=0x150084,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# No match found.
|
||||
exit 1
|
||||
|
||||
# vim: set ft=sh :
|
1
rootfs/etc/logmonitor/notifications.d/tab_crash/level
Normal file
1
rootfs/etc/logmonitor/notifications.d/tab_crash/level
Normal file
|
@ -0,0 +1 @@
|
|||
ERROR
|
2
rootfs/etc/logmonitor/notifications.d/tab_crash/title
Executable file
2
rootfs/etc/logmonitor/notifications.d/tab_crash/title
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
echo "$APP_NAME lacks of shared memory."
|
|
@ -1,2 +0,0 @@
|
|||
<Type>normal</Type>
|
||||
<Name>Navigator</Name>
|
|
@ -1,25 +1,14 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Chromium doesn't gracefully shutdown when receiving SIGTERM. For example, last
|
||||
# opened tabs may not be saved. Instead, terminate Chromium by sending the
|
||||
# CTRL+q key presses.
|
||||
# When receiving SIGTERM, Firefox doesn't qui immediately and instead ask for
|
||||
# confirmation. Instead, terminate Firefox by sending the CTRL+q key presses.
|
||||
#
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
xdotool key "Escape"
|
||||
sleep 0.5
|
||||
xdotool key "ctrl+q"
|
||||
|
||||
for i in $(seq 1 10)
|
||||
do
|
||||
if ! ps | grep "/usr/lib/chromium/chromium" | grep -q -v grep
|
||||
then
|
||||
break
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
||||
|
||||
|
|
|
@ -3,8 +3,20 @@
|
|||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
# Always make browser take up full screen
|
||||
echo "--start-maximized"
|
||||
# Set location of profile.
|
||||
echo "--profile"
|
||||
echo "/config/profile"
|
||||
|
||||
# Disable sandboxing, which isn't supported in containers
|
||||
echo "--no-sandbox"
|
||||
# Make sure we don't get ask to be the default browser.
|
||||
echo "--setDefaultBrowser"
|
||||
|
||||
# Check if kiosk mode is enabled.
|
||||
if [ "${FF_KIOSK:-0}" == 1 ]; then
|
||||
echo "--kiosk"
|
||||
fi
|
||||
|
||||
# URL to open.
|
||||
# NOTE: This should be the last argument.
|
||||
if [ -n "${FF_OPEN_URL:-}" ]; then
|
||||
echo "$FF_OPEN_URL"
|
||||
fi
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Get the supplementary group ID(s) needed to access sound device. These are
|
||||
# added to the ones provided by $SUP_GROUP_IDS.
|
||||
#
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
SND_DEV="/dev/snd"
|
||||
|
||||
SUP_GROUP_IDS="${SUP_GROUP_IDS:-}"
|
||||
|
||||
# Add group associated to the sound device.
|
||||
if [ -d "$SND_DEV" ]; then
|
||||
# Save the associated group.
|
||||
SND_GRP="$(find "$SND_DEV" -maxdepth 1 -not -type d -exec stat -c "%g" {} \; | sort -u | tail -n1)"
|
||||
|
||||
if [ -n "$SUP_GROUP_IDS" ]; then
|
||||
SUP_GROUP_IDS="$SUP_GROUP_IDS,$SND_GRP"
|
||||
else
|
||||
SUP_GROUP_IDS="$SND_GRP"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$SUP_GROUP_IDS" | tr ',' '\n'
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
|
@ -5,29 +5,5 @@ set -u # Treat unset variables as an error.
|
|||
|
||||
export HOME=/config
|
||||
|
||||
PIDS=
|
||||
|
||||
notify() {
|
||||
for N in $(ls /etc/logmonitor/targets.d/*/send)
|
||||
do
|
||||
"$N" "$1" "$2" "$3" &
|
||||
PIDS="$PIDS $!"
|
||||
done
|
||||
}
|
||||
|
||||
# Verify support for membarrier.
|
||||
if ! /usr/bin/membarrier_check 2>/dev/null; then
|
||||
notify "$APP_NAME requires the membarrier system call." "$APP_NAME is likely to crash because it requires the membarrier system call. See the documentation of this Docker container to find out how this system call can be allowed." "WARNING"
|
||||
fi
|
||||
|
||||
# Wait for all PIDs to terminate.
|
||||
set +e
|
||||
for PID in "$PIDS"; do
|
||||
wait $PID
|
||||
done
|
||||
set -e
|
||||
|
||||
/usr/bin/chromium --version
|
||||
exec /usr/bin/chromium "$@" >> /config/log/chromium/output.log 2>> /config/log/chromium/error.log
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
||||
/usr/bin/firefox --version
|
||||
exec /usr/bin/firefox "$@" >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue