---
# System prepended metadata

title: Homework 1 - Docker

---

# Homework 1 - Docker

## Create Network

`docker network create homework-network`

![](https://i.imgur.com/P1Rzjvu.png)

## Required Containers

### PostgreSQL
`docker volume create --name postgresql-data`

`--network homework-network \
-v postgresql-data:/var/lib/postgresql/data \
-e POSTGRES_DB=sonar-db \
-e POSTGRES_USER=sonar \
-e POSTGRES_PASSWORD=secret \
postgres:12.7-alpine`

![](https://i.imgur.com/Zgi0W6S.png)

### Sonarqube Community Edition

`docker volume create --name sonarqube-data`
`docker volume create --name sonarqube-logs`
`docker volume create --name sonarqube-extensions`

![](https://i.imgur.com/izPAtvS.png)

`docker run -d --name sonarqube \
--network homework-network \
-p 9000:9000 \
-e SONAR_JDBC_URL=jdbc:postgresql://sonarqube-db:5432/sonar \
-e SONAR_JDBC_USERNAME=sonar \
-e SONAR_JDBC_PASSWORD=sonar \
-v sonarqube-data:/opt/sonarqube/data \
-v sonarqube-extensions:/opt/sonarqube/extensions \
-v sonarqube-logs:/opt/sonarqube/logs \
sonarqube:community
`
![](https://i.imgur.com/Hugu04J.png)


### Jenkins

`docker volume create jenkins-home`

![](https://i.imgur.com/Hx9LnPA.png)

`
docker run -d --name jenkins \
--network homework-network \
-v jenkins-home:/var/jenkins-home \
jenkins/jenkins:lts-jdk11
`

![](https://i.imgur.com/FLQahni.png)

### Sonatype Nexus 3

`docker volume create --name nexus-data`

![](https://i.imgur.com/tY6mtTY.png)

`
--network homework-network \
-p 8081:8081 \
-v nexus-data:/nexus-data \
sonatype/nexus3:3.31.1
`
![](https://i.imgur.com/ZVkhbzn.png)

### Result 

![](https://i.imgur.com/ah4OwCn.png)


