Skip to content

Instantly share code, notes, and snippets.

@GeertJohan
Created February 24, 2015 15:34
Show Gist options
  • Save GeertJohan/64d0163e6b104280e1db to your computer and use it in GitHub Desktop.
Save GeertJohan/64d0163e6b104280e1db to your computer and use it in GitHub Desktop.
explanation at the bottom
FROM ubuntu
RUN sudo apt-get update && sudo apt-get -y install xpra x11-apps
RUN export uid=1000 gid=1000 && \
mkdir -p /home/user && \
echo "user:x:${uid}:${gid}:User,,,:/home/user:/bin/bash" >> /etc/passwd && \
echo "user:x:${uid}:" >> /etc/group && \
chown ${uid}:${gid} -R /home/user
ADD init.sh /usr/local/bin/init.sh
ENTRYPOINT /usr/local/bin/init.sh
#!/bin/sh
DOCKER_CONTAINER_NAME=xeyes
docker stop ${DOCKER_CONTAINER_NAME} 2>&1 > /dev/null
docker kill ${DOCKER_CONTAINER_NAME} 2>&1 > /dev/null
docker rm ${DOCKER_CONTAINER_NAME} 2>&1 > /dev/null
docker run -d \
-v /var/run/dbus:/var/run/dbus \
-v /home/geertjohan/.dbus/session-bus/:/home/user/.dbus/session-bus/ \
-v /home/geertjohan/.xpra:/home/user/.xpra \
--name ${DOCKER_CONTAINER_NAME} \
xeyes
xpra attach :100
The dockerfile is used to build the `xeyes` image. I start the image and try to connect to the container with `dockrun-xeyes`. That fails with an error:
```
Connection failed: [Errno 2] No such file or directory
```
On the host system I cd to `~/.xpra` and do `ln -s 5b140a830a50-100 foizetux-100`
In this case `5b140a830a50` is the hostname of the container, but this will change every time it is restarted.
After creating the symlink I try `xpra attach :100` again and this fails with another error (I can see a blank window displayed in the screen for a very short time):
```
$ xpra attach :100
Xlib: extension "RANDR" missing on display ":0.0".
Server's virtual screen is too small -- (server: 5120x1200 vs. client: 5760x1200)
You may see strange behavior.
Please see https://www.xpra.org/trac/ticket/10
Attached (press Control-C to detach)
Connection lost
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 368, in do_configure_event
self._client.send(["configure-window", self._id, x, y, w, h])
File "/usr/lib/python2.7/dist-packages/xpra/client_base.py", line 121, in send
self._protocol.source.queue_ordinary_packet(packet)
AttributeError: 'NoneType' object has no attribute 'source'
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 368, in do_configure_event
self._client.send(["configure-window", self._id, x, y, w, h])
File "/usr/lib/python2.7/dist-packages/xpra/client_base.py", line 121, in send
self._protocol.source.queue_ordinary_packet(packet)
AttributeError: 'NoneType' object has no attribute 'source'
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 368, in do_configure_event
self._client.send(["configure-window", self._id, x, y, w, h])
File "/usr/lib/python2.7/dist-packages/xpra/client_base.py", line 121, in send
self._protocol.source.queue_ordinary_packet(packet)
AttributeError: 'NoneType' object has no attribute 'source'
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 350, in do_map_event
self._client.send(["map-window", self._id, x, y, w, h])
File "/usr/lib/python2.7/dist-packages/xpra/client_base.py", line 121, in send
self._protocol.source.queue_ordinary_packet(packet)
AttributeError: 'NoneType' object has no attribute 'source'
```
#!/bin/sh
chown -R user:user /home/user/.dbus
chown -R user:user /home/user/.xpra
export HOME="/home/user"
sudo -u user xpra start :100 --start-child=xeyes --no-daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment