mirror of
https://github.com/woodchen-ink/docker-firefox.git
synced 2025-07-18 13:52:02 +08:00
Firefox is no longer using /dev/shm
.
This commit is contained in:
parent
974a94d2fd
commit
071fb903b0
@ -26,7 +26,6 @@ docker run -d \
|
||||
--name=firefox \
|
||||
-p 5800:5800 \
|
||||
-v /docker/appdata/firefox:/config:rw \
|
||||
--shm-size 2g \
|
||||
jlesage/firefox
|
||||
```
|
||||
|
||||
|
22
README.md
22
README.md
@ -38,7 +38,6 @@ Foundation and its subsidiary, Mozilla Corporation.
|
||||
* [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)
|
||||
@ -57,7 +56,6 @@ docker run -d \
|
||||
--name=firefox \
|
||||
-p 5800:5800 \
|
||||
-v /docker/appdata/firefox:/config:rw \
|
||||
--shm-size 2g \
|
||||
jlesage/firefox
|
||||
```
|
||||
|
||||
@ -74,7 +72,6 @@ docker run [-d] \
|
||||
[-e <VARIABLE_NAME>=<VALUE>]... \
|
||||
[-v <HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]]... \
|
||||
[-p <HOST_PORT>:<CONTAINER_PORT>]... \
|
||||
--shm-size VALUE \
|
||||
jlesage/firefox
|
||||
```
|
||||
| Parameter | Description |
|
||||
@ -83,7 +80,6 @@ docker run [-d] \
|
||||
| -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
|
||||
|
||||
@ -478,21 +474,6 @@ docker exec -ti CONTAINER sh
|
||||
Where `CONTAINER` is the ID or the name of the container used during its
|
||||
creation.
|
||||
|
||||
## 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
|
||||
@ -566,9 +547,6 @@ via Firefox directly.
|
||||
### 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.
|
||||
|
30
appdefs.yml
30
appdefs.yml
@ -22,21 +22,6 @@ app:
|
||||
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: |-
|
||||
@ -111,9 +96,6 @@ app:
|
||||
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.
|
||||
@ -325,15 +307,3 @@ container:
|
||||
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
|
||||
|
@ -17,15 +17,6 @@ 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
|
||||
|
@ -1,2 +0,0 @@
|
||||
#!/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."
|
@ -1,16 +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.
|
||||
|
||||
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 +0,0 @@
|
||||
WARNING
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
echo "$APP_NAME lacks of shared memory."
|
@ -1,2 +0,0 @@
|
||||
#!/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."
|
@ -1,17 +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.
|
||||
|
||||
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 +0,0 @@
|
||||
ERROR
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
echo "$APP_NAME lacks of shared memory."
|
Loading…
x
Reference in New Issue
Block a user