First written by Tri Ahmad Irfan ([email protected])
This repository contains a Dockerfile for building an empty Jenkins template on top of Docker, preloaded with PHP QA tools.
Make sure you are in the same directory as the Dockerfile, then call
sudo docker build -t yourname/emptyjenkins .
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 containerjenkinsserver
, 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
You can stop a running container by calling
sudo docker stop jenkinsserver
You can remove an existing container by calling
sudo docker rm jenkinsserver