Running GUI apps in Docker containers using VNC

In case you don’t feel like reading yet another rant, this is the gist of it:

1) Run your container and expose port 5901 to your host
docker run -p 5901:5901 -t -i ubuntu

2) set up VNC server in the container and run it

sudo apt-get install vnc4server
vnc4server -geometry 1400x1000

3) export $DISPLAY environment variable

export DISPLAY=<change this to the right DISPLAY name from vnc server output, see screenshot below>

4) run your GUI app
5) connect to the VNC server ( from your host OS using one of the freely available VNC clients.
I used TightVNC and it sure was tight.

That’s it. Now if you feel like reading, I can explain my use case. Read on.
Continue reading “Running GUI apps in Docker containers using VNC”

Openvpn on FreeBSD

All of my linux servers are connected over OpenVPN and now came the turn for my new FreeBSD droplet to join them.

Ran into one small issue. Upon installing and configuring OpenVPN I was getting this error:

Sun Jul 12 17:59:49 2015 us=222242 Cannot allocate TUN/TAP dev dynamically  
Sun Jul 12 17:59:49 2015 us=222330 Exiting due to fatal error  

Since I am using tun and not tap, tried manually loading tun module:

[fx@badger ~]$ sudo kldload if_tun
kldload: can't load if_tun: module already loaded or in kernel  

But that just showed that this is not the problem.
Tried creating tun interface manually and no probs:

[fx@badger ~]$ sudo ifconfig tun0 create
[fx@badger ~]$ sudo ifconfig tun0
tun0: flags=8010<POINTOPOINT,MULTICAST> metric 0 mtu 1500  

That pointed me to my openvpn.conf config and sure enough I had specified my VPN device as “VPN”:

dev VPN  

Ths works great in Linux but apparently not in FreeBSD. Changed that to tun0 and problem resolved. Yay.

So just for the record, working OpenVPN installation steps:

sudo pkg install openvpn  

Enable OpenVPN starting at boot by adding this to /etc/rc.conf:


Configure it, the default config file is /usr/local/etc/openvpn/openvpn.conf and looks like you have to create /usr/local/etc/openvpn directory manually.
Working config:

dev-type tun  
dev tun0  
proto tcp  
remote 1194  
resolv-retry infinite  
# certs that you got from vpn server
ca /usr/local/etc/openvpn/keys/ca.crt  
cert /usr/local/etc/openvpn/keys/vpn-client.crt  
key /usr/local/etc/openvpn/keys/vpn-client.key  
# don't forget to make sure this is rotated
log-append /var/log/openpvn.log  
ns-cert-type server  
verb 4  
mute 20  

Testing jekyll

It has been couple of years at least (more like three) and I am thinking about blogging again.
Why? Well, why not.

So let’s see if this becomes yet another failed attempt or not.

This time I’m using Jekyll as the blog engine.

Easy to set up and I relly like the idea of static content. Otherwise with the various dynamic options it would be yet another thing that needs maintaining and security patching.