-
Install docker
- Locally: https://docs.docker.com/get-docker/
- On AWS EC2: See section below
- Remember to add the user to the
docker
group and re-login into the account
-
Install docker-compose
-
Create the jenkins home directory docker for bind mounted volume
mkdir ~/jenkins
-
Create
docker-compose.yml
version: '3.8'
services:
jenkins:
image: jenkinsci/blueocean
privileged: true
user: root
ports:
- 8081:8080
- 50000:50000
container_name: jenkins
volumes:
- ~/jenkins:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker
-
Run the
docker-compose.yml
filedocker-compose up -d
-
Get the initial setup admin password for jenkins setup
docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
-
Using web-browser navigate to
localhost:8081
to finish the setup
- As stated here, named volume mounts, are easuer to back up and migrate. In order to use named volume mounts instead of bind mounts, use the following
docker-compose.yml
version: '3.8'
services:
jenkins:
image: jenkinsci/blueocean
privileged: true
user: root
ports:
- 8081:8080
- 50000:50000
container_name: jenkins
volumes:
- jenkins-home:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker
volumes:
jenkins-home:
-
Install docker using these steps:
-
Remember to expose/add Security Group Inbound Rule
- Public Access: TCP, Port 8081, from 0.0.0.0/0
- Custom Access: TCP, Port 8081, form YOUR PUBLIC IP ADDRESS CIDR RANGE
-
If you configure scuirty group inbound rule to be public, make sure to change the default admin password! If you don't people obviously will know the default jenkins admin password ...