Must extend shm-size or you will get SIGTRAP error!
docker build --tag chromium -f Dockerfile.chromium
docker run -d --restart always --name chromium --shm-size=4G -p 6090:6080 chromium
Quick demo:
docker build -t docker-firefox -f Dockerfile.firefox . && docker run --rm -p 6080:6080 docker-firefox
then open your browser to http://localhost:6080 and use the username vncuser
and password asdasd
to connect. You can change the password by passing -e PASSWORD=mypassword
to docker run
.
Note: Firefox might have opened on virtual screen 9...
Dockerfile
contains everything you need as a base-image (vnc-server, window manager and webserver). Dockerfile.firefox
shows how to add new software (including auto-starting it).
You can run this in kubernetes as a side-car:
apiVersion: v1
kind: Pod
metadata:
name: test-x
namespace: pr
labels:
app: text-x
spec:
nodeSelector:
kubernetes.io/arch: amd64
volumes:
- name: xauth
emptyDir: {}
containers:
- name: x
image: toelke158/docker-vnc
ports:
- containerPort: 6080
volumeMounts:
- mountPath: /home/vncuser/.Xauthority
subPath: ".Xauthority"
name: xauth
- name: firefox
image: nixery.dev/shell/firefox/cacert
command:
- bash
- -c
- "DISPLAY=127.0.0.1:1 firefox"
volumeMounts:
- mountPath: /root/.Xauthority
subPath: ".Xauthority"
name: xauth