Home - adean20csc/Files GitHub Wiki

docker-mediacascade

This repository contains the files necessary to build the slmmedia Docker image. From this image it will create the slmzsync Docker container. This slmzsync container will be scheduled to run a daily sync of the CAM /depot with an upstream media server.

Requirements

This project requires the use of Docker which is already contained on the CAM host. If for some reason it is not please refer to Install Docker Engine for more details.

CMD arguments

This project requires a few arguments get passed to the container during execution.

concat_url : The upstream server url files will be pulled from
target_folder: the folder where the downloaded files will be stored
exclude: files to be excluded from download

Files

slm_mdeiacascade_ro_deployment_key_rsa

This is the deployment key that is used by the container to access the github.csc.com/Automation/ansible-mediacasade-role repository. It is added to the container in the Dockerfile and renamed to id_rsa:

ADD slm_mediacascade_ro_deployment_key_rsa /tmp/id_rsa

Dockerfile

The Dockerfile contains the instructions to build the Docker image. If you not familiar with Docker please refer to the Dockerfile Reference page.

It provides Docker with different instructions based on the directive specified:

FROM

The FROM directive tells Docker what image to base the build on. Docker will look locally for the image and pull it from Dockerhub if it is not found.

FROM ubuntu:14.04

MAINTAINER

The MAINTAINER is simply a way to provide a contact for who is responsible for maintaining the image.

ADD

The ADD directive allows files to be added to the image from the host.

RUN

The RUN directive supplies most of the commands used to build the image.

WORKDIR

The WORKDIR directive tells Docker where to start from one the image is run. For this project it will be in the directory where the main Ansible playbook resides.

WORKDIR /etc/ansible/roles/mediacascade/playbooks

ENTRYPOINT

The ENTRYPOINT directive allows a container to run as an executable. Since this project is executing an Ansible playbook we run the ansible-playbook command.

ENTRYPOINT /usr/bin/ansible-playbook

CMD

The CMD directive provides defaults for an executing container. This is what gets executed when the container is run and no arguments are passed. In this case it will simplt run the Ansible --help command.

CMD --help 

Building the Docker image

If the docker-mediacascade project is not already on the CAM it will need to be cloned.

git clone [email protected]:Automation/docker-mediacascade.git

Next use docker build command to build the image:

cd docker-mediacascade
docker build -t slmmedia .

Once that is complete you can use docker images to view details about the image.

Run the Docker container

After the build completes use the Docker run command to launch the container.

docker run --rm --name slmzsync -v /depot:/depot slmmedia -e "concat_url=https://10.20.73.159:8443 target_folder=/depot exclude=./(CAM_OVF|OS_OVFS|Microsoft/SQLServer/2008R2)" syncfromupstream.yml

Here is an explanation of the switches used with the docker run command:

--rm: will automatically remove the container when it exits
--name: gives the container a readable name for use in troubleshooting and logs
-v: maps a folder on the host to the container
-e: command line arguments to be passed to the container

For more information about Docker checkout their documentation here