In this tutorial we will create desktop environments via docker on the fly. This environments could be used for development and/or testing purposes. For example you could expand it with Selenium-Grid nodes or provide manual testers all they need.
Preconditions
- docker-machine installed
- x2go client installed
- XQuartz installed (Mac OS X)
Steps
# create new VM $ docker-machine create -d virtualbox xserver # ssh into VM $ docker-machine ssh xserver # create Dockerfile $ vi Dockerfile
FROM centos:centos7 MAINTAINER Lupin3000 RUN yum update -y RUN yum install -y epel-release RUN yum install -y x2goserver x2goserver-xsession RUN yum groupinstall -y Xfce RUN yum install -y firefox RUN /usr/bin/ssh-keygen -t rsa -f /etc /ssh/ssh_host_rsa_key -N '' RUN /usr/bin/ssh-keygen -t ecdsa -f /etc /ssh/ssh_host_ecdsa_key -N '' RUN /usr/bin/ssh-keygen -t ed25519 -f /etc /ssh/ssh_host_ed25519_key -N '' RUN adduser testuser RUN echo 'testuser:test123' | chpasswd RUN echo 'root:test123' | chpasswd EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"]
* Note: the space after etc is because of the security settings of my provider!
# build Docker image from Dockerfile $ docker build -t centos7/xserver . # run Docker container from image $ docker run -p 2222:22 -d --name centos7-xserver centos7/xserver
Connect with x2go client
The following example shows the client configuration. Important are values for host (192.168.99.100), port (2222) and session type (XFCE).
Now it’s up to you to add more users, tools etc. – or to integrate everything into a build process.