Docker

This page shows some first steps with Docker.

It's possible to start RIT in a Docker container. With RTVS 9.0.1 it is possible to have a service running in Docker.

ZDNET: What is Docker and Why is it so darn popular

It's possible to deploy docker containers in Bluemix.

Docker Commands

See the commands below as a reminder of often used commands.

docker --version
docker --help
docker rmi -f <tag>
docker run -t -i ubuntu /bin/bash
docker ps -a

8-docker-productivity-hacks - Check out #3!!

X11 on MacOS

See MacOS

# Based on: https://github.com/leftshiftit/rit-starter-edition/blob/master/Dockerfile
FROM ubuntu:latest
MAINTAINER Marc van Lint 

# Set environment variables for better re-use later on
ENV USERNAME lint
ENV HOME /home/${USERNAME}
ENV WORKDIR /opt
ENV RIT_VERSION_FILE ritse.linux.x86_64_9.0.0.v20160302_1549.zip

WORKDIR ${WORKDIR}

# Install relevant packages to make X11 forwarding work for the UI
RUN apt-get update && \
    apt-get install --no-install-recommends -y libxext-dev libxrender-dev libxtst-dev libxft2 unzip wget && \
    apt-get clean && \
	rm -rf /var/lib/apt/lists/* && \
	rm -rf /tmp/*

RTW on Docker

RTW on Docker

RIT on Docker

Figure: RIT in a Docker container (running on MacOS)

Work is performed on materials of ShiftLeft. This can be found at: RIT SE as docker container

To make the RIT-SE docker container:

docker build -f RIT-V900SE.dck -t ritv900se .

The RIT-V900SE.dck file:

# Based on: https://github.com/leftshiftit/rit-starter-edition/blob/master/Dockerfile
FROM x11:latest
MAINTAINER Marc van Lint 


# Set environment variables for better re-use later on
ENV USERNAME lint
ENV HOME /home/${USERNAME}
ENV WORKDIR /tmp/SW
ENV RIT_VERSION_FILE ritse.linux.x86_64_9.0.0.v20160302_1549.zip

WORKDIR ${WORKDIR}

# Add & configure the 'rit' user
RUN useradd -m ${USERNAME} && \
    echo "${USERNAME}:${USERNAME}" | chpasswd && \
    usermod --shell /bin/bash ${USERNAME} && \
    usermod -aG sudo ${USERNAME} && \
    mkdir /etc/sudoers.d && \
    echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/${USERNAME} && \
    chmod 0440 /etc/sudoers.d/${USERNAME} && \
    # Replace 1000 with your user/group id, this is required for X11 forwarding to work \
    groupmod --gid ${GID:-1000} ${USERNAME} && \
    chown -R ${USERNAME}:${USERNAME} ${WORKDIR}

USER ${USERNAME}

# Grab the software from IBM's DeveloperWorks website
RUN wget "ftp://public.dhe.ibm.com/software/spcn/continuoustest/${RIT_VERSION_FILE}" && \
    unzip "${RIT_VERSION_FILE}" && \
    rm "${RIT_VERSION_FILE}"


WORKDIR ${WORKDIR}/IntegrationTester

# RUN export DISPLAY=192.168.0.100:0.0

ENTRYPOINT ["./IntegrationTester"]

To start the container the following script can be executed:

export IPADD=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' `
export IPADD=`echo $IPADD | awk '{print $1;}' `
export DISPLAY=$IPADD:0.0
echo Output redirected to: $DISPLAY
#docker run -ti --rm -e DISPLAY -v /tmp/share:/tmp/share  -v /SW:/SW ritv900se
docker run -ti --rm -e DISPLAY ritv900se
# docker run -ti --rm -e DISPLAY x11

RTVS in Docker

With RIT901 it's possible to publish virtual services to a docker container.
More on: Virtual Services using and Docker

Other Resources

  1. Docker for Mac
  2. RIT SE as docker container
  3. Docker on PureApp
  4. Docker on Bluemix Movie
docker build -f Dockerfile -t addnumbers .
docker run -e RATIONAL_LICENSE_FILE=27000@winclient --add-host="winclient:192.168.0.115" addnumbers

Bluemix and Docker

Docker on Bluemix

Urbancode and Docker

Docker and Urbancode

Other Sources