Skip to content

HakimiX/jenkins-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Jenkins Image

Jenkins and Docker client

Usage

  1. Clone the repository in the host machine
  2. Build the image:
docker build -t jenkins-docker .
  1. Start the container:
docker run -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock --name jenkins -d jenkins-docker
  1. Enter the container to verify that docker is accessible:
docker exec -it jenkins bash
  1. Test
docker ps -a 

See the troubleshooting section If you get the following error:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:

Troubleshooting

The Dockerfile is adding a docker GID:

groupadd -g 999 docker && \

Run the following command to figure out the GID on the host machine:

cat /etc/group | grep docker

# output
docker:x:998:

change the Dockerfile to use 998 instead of 999 and rebuild the image in the host machine.

As a last resort
Run the following command to allow the whole system to write to the docker socket (which is not recommended for production setups, but just to get started).

chmod o+rw /var/run/docker.sock 

Rerun the image.

About

Jenkins CI/CD with Docker Client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published