docker slmpuppet - adean20csc/Files GitHub Wiki
docker-slmpuppet
This repository contains the files necessary to build the slmpuppet
Docker image. From this image it will create the slmpuppet
Docker container.
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.
-d : Runs the container in detached mode
--name : Assigns the container a name
-p : Expose a containers port(s) to the host
Files
slm_slmcam_ro_deployment_key_rsa
This is the deployment key that is used by the container to access the github.csc.com/Automation/slmcam repository. It is added to the container in the Dockerfile and renamed to id_rsa:
ADD slm_slmcam_ro_deployment_key_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.5
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.
USER
The USER
directive tells Docker to run the commands as the desired user. It is recommended to run them as a non-privileged user.
USER username
VOLUME
The VOLUME
directive mounts a host volume in the container. For this project we mount a few directories.
VOLUME ["/etc/puppet", "/var/lib/puppet", "/var/log/puppet"]
WORKDIR
The WORKDIR
directive tells Docker where to start from one the image is run. For this project it will be in the puppet directory.
WORKDIR /usr/bin
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 run the Puppet Master service in verbose mode.
CMD puppet master --no-daemonize --verbose
Building the Docker image
If the docker-slmpuppet
project is not already on the CAM it will need to be cloned.
git clone [email protected]:Automation/docker-slmpuppet.git
Next use docker build
command to build the image:
cd docker-slmpuppet
docker build -t slmpuppet .
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 -d --name slmpuppet -p 8140:8140 slmpuppet
For more information about Docker checkout their documentation here