Skip to content

Instantly share code, notes, and snippets.

@h3ct0rjs
Created June 27, 2021 23:41
Show Gist options
  • Save h3ct0rjs/b994dc911ace763fe1fce9216cc75d04 to your computer and use it in GitHub Desktop.
Save h3ct0rjs/b994dc911ace763fe1fce9216cc75d04 to your computer and use it in GitHub Desktop.

Notes about Jenkins on Docker

  • Get docker image :
docker pull jenkins/jenkins:lts-jdk11
  • play and run with jenkins using docker, command line :
docker run -d -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts-jdk11
  • You can also use docker-compose up -d, adding the following content to the docker-compose.yml :
# Define docker compose for the jenkins udemy course.
# hfjimenez@utp.edu.co
version: '3'
services: 
  jenkins:
    container_name: jenkins_udemy
    image:  jenkins/jenkins:lts-jdk11
    ports: 
      - "8080:8080"
      - "50000:50000"
    volumes:
      - $PWD/jenkins_home:/var/jenkins_home
    networks:
      - netjenkins
networks:
  netjenkins:
  • if you want to stop the service :
docker-compose stop 
  • if you want to start the service :
docker-compose start
  • if you want to delete all the service :
docker-compose down

keep in mind that if you previously execute the down command you will need to run the up command:

docker-compose up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment