Skip to content

5.1.1 Centos Docker Guide

avilcheslopez edited this page Dec 31, 2014 · 7 revisions

Overview

Docker can be thought of as lightweight virtualization without a hypervisor. It is built on top of linux containers and allows applications to run in a sandboxed environment. Each container has its own IP address which allows us to test communications functionality of a distributed system.

Installation

Centos Docker Installation Guide

SElinux

Either selinux should be disabled in /etc/sysconfig/selinux or via cmdline or add:

other_args="--selinux-enabled=true"

to /etc/sysconfig/docker

Centos 6

Add EPEL repo to yum: EPEL Installation

sudo yum install docker-io
sudo service docker start
sudo chkconfig docker on

Centos 7

sudo yum install docker

Proxy

If sitting behind a proxy, it may be necessary to configure docker to provide it with the proxy settings. See this Docker article on Controlling and configuring Docker using Systemd for details.

Alternatively, on older distributions that don't support Systemd, it may be necessary to start the docker daemon as follows:

sudo HTTP_PROXY=<proxy> docker -d &

Building Images

Images are built from a Dockerfile. An example Dockerfile for building orcm from git within a centos container can be found here. More example will be available in the future. To build an image:

git clone https://github.com/benmcclelland/orcm-centos.git
cd orcm-centos
docker build -t orcm .

or pull the pre-built image, but this one isn't guaranteed to be up to date with the latest orcm repo at all times.

docker pull benmcclelland/orcm-centos

Running ORCM Containers

A convenience script is available here for launching an orcm container cluster. Here is the general idea:

launch the database container

/usr/bin/docker run -d --name db -h db intel/orcm sudo -u postgres /usr/pgsql-9.3/bin/postmaster -p 5432 -D /var/lib/pgsql/9.3/data

launch the scheduler

/usr/bin/docker run -d --name master -h master --link db:db intel/orcm /opt/open-rcm/bin/orcmsched

launch an aggregator

/usr/bin/docker run -d --name agg01 -h agg01 --link db:db --link master:master intel/orcm /opt/open-rcm/bin/orcmd --omca db_odbc_dsn orcmdb_psql --omca db_odbc_user orcmuser:orcmpassword --omca db_odbc_table data_sample --omca sensor heartbeat,sigar

launch the compute nodes

/usr/bin/docker run -d --name node001 -h node001 --link agg01:agg01 intel/orcm /opt/open-rcm/bin/orcmd --omca sensor heartbeat,sigar 
/usr/bin/docker run -d --name node002 -h node002 --link agg01:agg01 --link node001:node001 intel/orcm /opt/open-rcm/bin/orcmd --omca sensor heartbeat,sigar 
...

launch interactive shell (simulating login node)

/usr/bin/docker run -it --rm --link master:master --link db:db intel/orcm /bin/bash 

options

The -v options allows us to bind mount a directory or file into the container from the host. So if you would like to test a new orcm configuration file, you can add the option:

-v /path/to/orcm-site.xml:/opt/open-rcm/etc/orcm-site.xml

to the above docker commands. If you want a shared home directory across the virtual cluster, you could add:

-v /home:/home

to the shell and compute nodes and they would all share the common home directory.

Cleaning up

stop all running containers

docker stop $(docker ps -a -q)

remove containers

docker rm $(docker ps -a -q)
Clone this wiki locally