|
1 | | -# Jenkins with hosts Docker socket |
| 1 | +# Jenkins with access to hosts Docker engine |
2 | 2 |
|
3 | 3 | Note that by default each of the example docker compose configurations will create their own volumes for the data. This might not be what you want. In order to use the same volumes for every docker compose configuration, run docker compose with `-p` (or `--project-name`) option. This can also be done by setting `COMPOSE_PROJECT_NAME` environment variable: |
4 | 4 |
|
5 | 5 | ```sh |
6 | 6 | export COMPOSE_PROJECT_NAME=jenkins |
7 | 7 | ``` |
8 | 8 |
|
9 | | -## Jenkins image with Docker-in-Docker support |
| 9 | +## Jenkins image with Docker client |
10 | 10 |
|
11 | 11 | To be able run Docker commands from inside the Jenkins container, we will need to install the Docker client. This can be done with a suitable Dockerfile: |
12 | 12 |
|
13 | 13 | ```Dockerfile title="Dockerfile" |
14 | | ---8<-- "docs/examples/jenkins/dind-jenkins/Dockerfile" |
| 14 | +--8<-- "docs/examples/jenkins/jenkins-host-docker/Dockerfile" |
15 | 15 | ``` |
16 | 16 |
|
17 | | -When running this container, we will want to define ports and volumes. To do this, we will use a `docker-compose.yml` configuration: |
| 17 | +## Jenkins container with access to hosts Docker engine |
| 18 | + |
| 19 | +When running Jenkins in a container, we will want to define ports and volumes. To do this, we will use a `docker-compose.yml` configuration: |
18 | 20 |
|
19 | 21 | ```yaml title="docker-compose.yml" |
20 | | ---8<-- "docs/examples/jenkins/dind-jenkins/docker-compose.yml" |
| 22 | +--8<-- "docs/examples/jenkins/jenkins-host-docker/docker-compose.yml" |
21 | 23 | ``` |
22 | 24 |
|
23 | | -These files are available in the repository that provides this website. In order to run Jenkins container with Docker-in-Docker support, `cd` into `docs/examples/jenkins/dind-jenkins` directory and run `docker compose up`. |
| 25 | +These files are available in the repository that provides this website. In order to run Jenkins container with Docker-in-Docker support, `cd` into `docs/examples/jenkins/jenkins-host-docker` directory and run `docker compose up`. |
24 | 26 |
|
25 | 27 | ```sh |
26 | | -cd docs/examples/jenkins/dind-jenkins |
| 28 | +cd docs/examples/jenkins/jenkins-host-docker |
27 | 29 |
|
28 | 30 | # If you want to see logs in the current terminal |
29 | 31 | docker compose up --build |
|
0 commit comments