2020-03-18 19:55:23 +00:00
## Gitea with PostgreSQL
This example defines one of the base setups for Gitea. More details on how to customize the installation and the compose file can be found in [Gitea documentation ](https://docs.gitea.io/en-us/install-with-docker/ ).
Project structure:
```
.
2022-05-10 09:59:25 +00:00
├── compose.yaml
2020-03-18 19:55:23 +00:00
└── README.md
```
2022-05-10 09:59:25 +00:00
[_compose.yaml_ ](compose.yaml )
2020-03-18 19:55:23 +00:00
```
services:
gitea:
image: gitea/gitea:latest
ports:
2020-03-23 23:36:46 +00:00
- 3000:3000
2020-03-18 19:55:23 +00:00
...
db:
image: postgres:alpine
environment:
...
```
2022-05-10 09:59:25 +00:00
When deploying this setup, docker compose maps the gitea container port 3000 to
2020-03-23 23:36:46 +00:00
the same port of the host as specified in the compose file.
2020-03-18 19:55:23 +00:00
2022-05-10 09:59:25 +00:00
## Deploy with docker compose
2020-03-18 19:55:23 +00:00
```
2022-05-10 09:59:25 +00:00
$ docker compose up -d
2020-03-18 19:55:23 +00:00
Creating network "gitea-postgres_default" with the default driver
Creating gitea-postgres_db_1 ... done
Creating gitea-postgres_gitea_1 ... done
Attaching to gitea-postgres_db_1, gitea-postgres_gitea_1
....
Starting gitea-postgres_db_1 ... done
Starting gitea-postgres_gitea_1 ... done
```
## Expected result
Check containers are running and the port mapping:
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2020-03-23 23:36:46 +00:00
2f5624043da9 gitea/gitea:latest "/usr/bin/entrypoint…" 56 seconds ago Up 16 seconds 22/tcp, 0.0.0.0:3000->3000/tcp gitea-postgres_gitea_1
2020-03-18 19:55:23 +00:00
86acc768453e postgres:alpine "docker-entrypoint.s…" 57 seconds ago Up 17 seconds 5432/tcp gitea-postgres_db_1
```
2020-03-23 23:36:46 +00:00
Navigate to `http://localhost:3000` in your web browser to access the installed
2020-03-18 19:55:23 +00:00
Gitea service.
![page ](output.jpg )
Stop and remove the containers
```
2022-05-10 09:59:25 +00:00
$ docker compose down
2020-03-18 19:55:23 +00:00
```
To remove all Gitea data, delete the named volumes by passing the `-v` parameter:
```
2022-05-10 09:59:25 +00:00
$ docker compose down -v
2020-03-28 10:05:08 +00:00
```