Skip to main content

Forgejo

Use these steps to run Forgejo with Docker Compose.

Create the Compose File​

Create a docker-compose.yml file with the Forgejo service:

networks:
forgejo:
external: false

services:
server:
image: codeberg.org/forgejo/forgejo:15
container_name: forgejo
environment:
- USER_UID=${USER_UID}
- USER_GID=${USER_GID}
restart: always
networks:
- forgejo
volumes:
- ./forgejo:/data
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"

Create the Environment File​

Create a .env file in the same directory as docker-compose.yml:

USER_UID=1000
USER_GID=1000

Start Forgejo​

Run Docker Compose from the directory containing both files:

docker compose up -d

Forgejo will be available at http://localhost:3000.

SSH access is exposed on host port 222.

Reverse Proxy / HTTPS​

If you need public HTTPS access, put Forgejo behind a reverse proxy like Nginx Proxy Manager. SSH access on port 222 remains separate from the HTTP reverse proxy.