Skip to content

Commit

Permalink
add docker wrapper scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Stromdahl <[email protected]>
  • Loading branch information
erstrom committed Jul 9, 2017
1 parent a433755 commit 75c5063
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
#! /bin/sh

docker build -t erstrom/qt .
32 changes: 32 additions & 0 deletions docker-run-qtcreator.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,32 @@
#! /bin/sh
#

# Fix for running GUI programs from within the docker container:
#
# Make xorg disable access control, i.e. let any x client connect to our
# server.
xhost

# In order to let the container connect to the pulseaudio server over TCP,
# the module-native-protocol-tcp module must be enabled:
#
# load-module module-native-protocol-tcp

# 172.17.0.1 is the default host ip address of the docker network interface
# (docker0). In case this is changed (e.g. docker container not using NAT
# address) the below env var must of course be updated.
PULSE_SERVER_TCP_ENV="-e PULSE_SERVER=tcp:172.17.0.1:4713"

# Create the container with all options needed to let a GUI program
# like qtcreator connect to the host xorg server.
# The current user home directory is also mounted directly into the
# container.
docker run -it \
--privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /home/`id -nu`:/home/`id -nu` \
-e DISPLAY=unix$DISPLAY \
$PULSE_SERVER_TCP_ENV \
--name qtcreator \
erstrom/qt \
qtcreator
31 changes: 31 additions & 0 deletions docker-run-shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,31 @@
#! /bin/sh
#

# Fix for running GUI programs from within the docker container:
#
# Make xorg disable access control, i.e. let any x client connect to our
# server.
xhost

# In order to let the container connect to the pulseaudio server over TCP,
# the module-native-protocol-tcp module must be enabled:
#
# load-module module-native-protocol-tcp

# 172.17.0.1 is the default host ip address of the docker network interface
# (docker0). In case this is changed (e.g. docker container not using NAT
# address) the below env var must of course be updated.
PULSE_SERVER_TCP_ENV="-e PULSE_SERVER=tcp:172.17.0.1:4713"

# Create the container with all options needed to let a GUI program
# like qtcreator connect to the host xorg server.
# The current user home directory is also mounted directly into the
# container.
docker run -it \
--privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /home/`id -nu`:/home/`id -nu` \
-e DISPLAY=unix$DISPLAY \
$PULSE_SERVER_TCP_ENV \
--name qt-sh \
erstrom/qt
9 changes: 9 additions & 0 deletions docker-start-qtcreator.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,9 @@
#! /bin/sh

# Fix for running GUI programs from within the docker container:
#
# Make xorg disable access control, i.e. let any x client connect to our
# server.
xhost

docker start qtcreator --attach --interactive
9 changes: 9 additions & 0 deletions docker-start-shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,9 @@
#! /bin/sh

# Fix for running GUI programs from within the docker container:
#
# Make xorg disable access control, i.e. let any x client connect to our
# server.
xhost

docker start qt-sh --attach --interactive

0 comments on commit 75c5063

Please sign in to comment.