Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.65 KB

File metadata and controls

60 lines (41 loc) · 1.65 KB

emptyjenkins

First written by Tri Ahmad Irfan (triahmadirfan@gmail.com)

This repository contains a Dockerfile for building an empty Jenkins template on top of Docker, preloaded with PHP QA tools.

Building an image

Make sure you are in the same directory as the Dockerfile, then call

sudo docker build -t yourname/emptyjenkins .

Running a container

You can list all images available on your instance by calling

sudo docker images

You can run a container from a specific image by calling

sudo docker run -dp 8080:8080 --name jenkinsserver yourname/emptyjenkins

Note:

  • -d will make the container to run in a daemon/detached mode
  • -p 8080:8080 will make the container to run at hostPort:containerPort
  • --name jenkinsserver will name your container jenkinsserver, so you can call the container using this name instead of using the hash id

You can map a the $JENKINS_HOME volume into a specific directory on your host machine by adding -v option

sudo docker run -dp 8080:8080 --name jenkinsserver -v /home/yourname/jenkins_home:/var/jenkins_home yourname/emptyjenkins

-v /home/yourname/jenkins_home:/var/jenkins_home will map /var/jenkins_home on your container into /home/yourname/jenkins_home on your host machine

After running the container, Jenkins will be available at http://yourpublicdns:8080

You can list all running containers by calling

sudo docker ps

Stopping a container

You can stop a running container by calling

sudo docker stop jenkinsserver

Removing a container

You can remove an existing container by calling

sudo docker rm jenkinsserver