Giter Club home page Giter Club logo

jenkins-docker's Introduction

Overview

This project focuses on a specific task: enabling Jenkins to communicate with the Docker engine while running inside a Docker container.

Prerequisites

To run this project, you'll need the following requirements:

Running Jenkins on Docker Guide

In this guide, you will find the steps to launch Jenkins on Docker and establish communication between Docker and Jenkins.

Building the Jenkins Docker Image

  1. Clone this repository locally or download it as a zip:

    git clone https://github.com/veyselkaraca/jenkins-docker.git
    
  2. Navigate to the project directory:

    cd jenkins-docker
    
  3. Build the Docker image for Jenkins using the provided Dockerfile:

    docker build -t <image_name> .
    

Replace <image_name> with the image name of your jenkins.

  1. Or you can use docker compose for Jenkins image build
    docker-compose build
    # or
    docker compose build
    

Running Jenkins on Docker

  1. Run the Jenkins Docker container using the following command:

    # docker engine
    docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home my-jenkins
    # or you can use docker compose
    docker-compose up -d
    # new verison of docker compose following this command
    docker compose up -d
    

This will start Jenkins in a Docker container and expose it on port 8080. You can access the Jenkins web interface by opening a web browser and going to http://localhost:8080.

  1. To access the Jenkins container's shell, use the following command:

    docker exec -it <container_id> /bin/bash
    
    

Replace <container_id> with the actual ID of the Jenkins container.

  1. To access the docker socket in Jenkins container, use the following command:

    docker info
    # or
    docker container ls

Configuring Jenkins

  1. Follow the initial setup wizard in the Jenkins web interface to set up Jenkins.
  2. When prompted for plugins, you can install the suggested plugins or select your preferred ones.

Update docker compose version

If you want to change the version of Docker Compose on Jenkins, open the Dockerfile file and update the curl request. For example:

RUN curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose

To this

RUN curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose

Now, you updated docker compose to version 1.25.4

Additional Configuration (Optional)

  • If you want to use Docker Compose for managing the Jenkins container and any additional services, you can update a docker-compose.yml file and define the services there. You can then start the services using docker-compose up.

jenkins-docker's People

Contributors

veyselkaraca avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.