---
# System prepended metadata

title: Install Jenkins in Docker
tags: [CI/CD, Docker]

---

# Install Jenkins in Docker

> Jenkinsci/blueocean image not include dotnet related library by default that we need to customize a docker image for dotnet sdk. 

## Steps

### 1. Git clone jenkins docker image for dotnet core
https://github.com/yuze1995/docker-image/tree/master/jenkins-dotnet-core/2.2
> Based on jenkinsci/blueocean image and install dotnet core sdk and dotnet core runtime dependencies.

### 2. Build docker image
```shell=
docker build -t {repository:tag} .
```
**Example:**
```sql=
docker build -t jenkinsci/blueocean/dotnet-core:v1 .
```

### 3. Create jenkins docker container
```shell=
docker run \
  -u root \
  -d \
  -p 8080:8080 \
  -v jenkins-data:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  --restart=always \
  jenkinsci/blueocean/dotnet-core:v1
```
> [reference](https://jenkins.io/doc/book/installing/)

###### tags: `Docker` `CI/CD` 