diff options
author | Cody Hiar <codyfh@gmail.com> | 2019-02-18 20:17:47 -0700 |
---|---|---|
committer | Cody Hiar <codyfh@gmail.com> | 2019-02-18 20:17:47 -0700 |
commit | 71a955a79495e09ff8a91b46f68c79e17447bd23 (patch) | |
tree | 9d9dc928f4150cc3db01e3010d1e4d241cae3750 | |
parent | 0685bd8dbb6f06a4581de7cd3345571004b001c3 (diff) |
Cleaning up code
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | README.md | 34 | ||||
-rw-r--r-- | data/.gitkeep | 0 | ||||
-rw-r--r-- | docker-compose.yml | 23 | ||||
-rwxr-xr-x | run.sh | 24 |
6 files changed, 68 insertions, 36 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06b2ab9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +data/* +!data/.gitkeep diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..accd178 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +.PHONY: build + +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +build: ## Build the Docker image + docker-compose -p firefox build + +up: build ## Bring the container up + xhost local:1000 + docker-compose -p firefox up -d + +down: ## Stop the container + docker-compose -p firefox stop + +enter: ## Enter the running container + docker-compose -p firefox exec backend /bin/bash + +clean: down ## Remove stoped containers + docker-compose -p firefox rm + @@ -1,13 +1,19 @@ -Sound in Container: https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio +# Firefox in a Docker Container -Create socket: +This is my project for running in a container. + +## Getting sound from the container using Pulse + +[source][1] + + +Step 1: Create socket ``` pactl load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket ``` - -create `/tmp/pulseaudio.client.conf` with: +Step 2: Create client config file `/tmp/pulseaudio.client.conf` with contents ``` default-server = unix:/tmp/pulseaudio.socket @@ -18,14 +24,18 @@ daemon-binary = /bin/true enable-shm = false ``` -Share pulse stuff +Step 3: Now run `make up` and your firefox container should start running + + +## Tabs contantly crashing + +You can disable multi-process windows in Firefox by setting these prefs to +false on the `about:config` page. ``` -docker run --rm \ - --env PULSE_SERVER=unix:/tmp/pulseaudio.socket \ - --env PULSE_COOKIE=/tmp/pulseaudio.cookie \ - --volume /tmp/pulseaudio.socket:/tmp/pulseaudio.socket \ - --volume /tmp/pulseaudio.client.conf:/etc/pulse/client.conf \ - --user $(id -u):$(id -g) \ - imagename +browser.tabs.remote.autostart = false ``` + + + +[1]: https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/data/.gitkeep diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cc7dae7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3' +services: + backend: + build: + context: ./ + dockerfile: ./Dockerfile + network_mode: "bridge" + container_name: firefox + image: thornycrackers/firefox + environment: + - DISPLAY=unix:0 + - PULSE_SERVER=unix:/tmp/pulseaudio.socket + - PULSE_COOKIE=/tmp/pulseaudio.cookie + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix + - /tmp/pulseaudio.socket:/tmp/pulseaudio.socket + - /tmp/pulseaudio.client.conf:/etc/pulse/client.conf + - /etc/localtime:/etc/localtime:ro + - ./data:/home/thorny/.mozilla + command: /bin/bash firefox + tty: true + stdin_open: true + @@ -1,24 +0,0 @@ - -# docker run --rm \ -# --user $(id -u):$(id -g) \ - - -# Error with container opening socket -# https://github.com/jessfraz/dockerfiles/issues/4 - - -docker build -t firefox . - -xhost local:root - -docker run -it \ - --rm \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e DISPLAY=unix"$DISPLAY" \ - --env PULSE_SERVER=unix:/tmp/pulseaudio.socket \ - --env PULSE_COOKIE=/tmp/pulseaudio.cookie \ - --volume /tmp/pulseaudio.socket:/tmp/pulseaudio.socket \ - --volume /tmp/pulseaudio.client.conf:/etc/pulse/client.conf \ - --volume /etc/localtime:/etc/localtime:ro \ - --name firefox \ - firefox |