Gitea with Docker Compose
Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD In the project's words: Gitea repository on GitHub (description) checked 2026-09-29
Runs on: amd64, arm64, riscv64 from each image's registry manifest, checked 2026-09-29; a CPU counts only if every image has a build for it. Image by image
Add Gitea to the builder to use your own domain and combine it with other apps in one file.
What Gitea needs
Only figures Gitea's own documentation publishes, each linked to the page it is on. Where the project gives no number, this page does not invent one.
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | not stated | 1 GB |
| Gitea's docs: "2 CPU cores and 1GB RAM is typically sufficient for small teams/projects." Source: Gitea docs: What is Gitea? (system requirements) checked 2026-09-29 | ||
| CPU | not stated | 2 cores |
| The same sentence: 2 CPU cores for small teams and projects. Source: Gitea docs: What is Gitea? (system requirements) checked 2026-09-29 | ||
| Disk | The project publishes no figure | |
Which hardware Gitea has images for
Read from each image's manifest list in its registry (anonymous, read-only) when this page was built. An app counts for a CPU only if every one of its images lists it.
With SQLite, the default
- x86-64 PC or NAS (
linux/amd64): every image has a build. - Raspberry Pi 4/5, 64-bit OS (
linux/arm64): every image has a build. - Raspberry Pi 3 or Zero 2 W, 32-bit OS (
linux/arm/v7): no image forserver. No image for this hardware; the builder leaves the app out.
| Service | Image | Platforms in the manifest | Digest | Registry | Checked |
|---|---|---|---|---|---|
server | docker.gitea.com/gitea:1.27.3 | amd64, arm64, riscv64 | sha256:87a67ee09d3ae0d1df5fda5dcda3e2a1f9236a45b0a59025d6e00e46adc43bef | docker.gitea.com | 2026-09-29 |
With PostgreSQL
- x86-64 PC or NAS (
linux/amd64): every image has a build. - Raspberry Pi 4/5, 64-bit OS (
linux/arm64): every image has a build. - Raspberry Pi 3 or Zero 2 W, 32-bit OS (
linux/arm/v7): no image forserver. No image for this hardware; the builder leaves the app out.
| Service | Image | Platforms in the manifest | Digest | Registry | Checked |
|---|---|---|---|---|---|
server | docker.gitea.com/gitea:1.27.3 | amd64, arm64, riscv64 | sha256:87a67ee09d3ae0d1df5fda5dcda3e2a1f9236a45b0a59025d6e00e46adc43bef | docker.gitea.com | 2026-09-29 |
db | postgres:18 | amd64, arm/v5, arm/v7, arm64, 386, ppc64le, riscv64, s390x | sha256:5a5a84b19854a9ffaa54082c166ff4ec27473a361e496e5ea167f298f2da9722 | registry-1.docker.io | 2026-09-25 |
Git over SSH
The file below publishes only Caddy's ports, so Gitea clones and pushes over HTTPS. Turn Git over SSH on and the compose file publishes Gitea's SSH port beside Caddy, as the project's own example does (222:22), and sets the two settings Gitea uses to print the SSH clone address. Every line is quoted from Gitea's docs or its image's files.
Before the first push
- Firewall: Port 222/tcp must reach this server from wherever you push: open it in your VPS provider's firewall, or forward it on your router at home. A ufw rule does not close it, because Docker routes a published port before ufw sees it: “When you publish a container's ports using Docker, traffic to and from that container gets diverted before it goes through the ufw firewall settings.” Docker docs: Packet filtering and firewalls, Docker and ufw checked 2026-10-09
- Your key: Gitea's docs have no page on adding a key; its FAQ only names the step: “Ensure the public and private ssh keys are added to the correct Gitea user.” Gitea docs: FAQ (SSHD vs built-in SSH, SSH issues) checked 2026-10-09
- In Gitea's settings the tab, the button and the field are labelled (Gitea's own English strings): “"settings.ssh_gpg_keys": "SSH / GPG Keys"” “"settings.add_key": "Add Key"” “"settings.key_content": "Content"” Gitea v1.27.3: options/locale/locale_en-US.json (the settings page's English labels) checked 2026-10-09
- Clone address: Gitea then prints the SSH address on each repository page with the user git, your SSH_DOMAIN and the port; it uses the ssh:// form whenever the port is not 22: “USE_COMPAT_SSH_URI: false: Force ssh:// clone url instead of scp-style uri when default SSH port is used.” Gitea docs: Configuration Cheat Sheet (ROOT_URL, DISABLE_SSH) checked 2026-10-09 “USER: git: The username of the user that runs Gitea within the container.” Gitea docs: Installation with Docker (docker-compose.yml, GITEA__section__KEY variables) checked 2026-10-09
ssh://git@gitea.example.org:222/<user>/<repo>.git - Test it: Gitea's FAQ, to check that the key works, and the reply it expects: “First, make sure you can access Gitea via SSH.” “Hi there, You've successfully authenticated, but Gitea does not provide shell access.” Gitea docs: FAQ (SSHD vs built-in SSH, SSH issues) checked 2026-10-09
- Not built here: sharing the server's own port 22 and its sshd with Gitea (the "SSH passthrough" setups). Gitea's FAQ on the two kinds of SSH server: “SSHD is the built-in SSH server on most Unix systems. Gitea also provides its own SSH server, for usage when SSHD is not available.” Gitea docs: FAQ (SSHD vs built-in SSH, SSH issues) checked 2026-10-09
docker-compose.yml
Gitea runs on SQLite unless told otherwise; its Docker page shows PostgreSQL as a db service added to the file. Choose before the first start: Gitea's backup page recommends picking the final database type at the first installation, because converting later (gitea dump --database postgres, then importing the SQL) is "not well-tested". Source: Gitea docs: Installation with Docker (PostgreSQL database section) checked 2026-09-30; Gitea docs: Backup and Restore (consistency, pg_dump and psql, converting database types) checked 2026-09-30
With SQLite, the default
This is exactly what the builder writes for Gitea alone on example.org: the official definition with its published ports removed and Caddy added in front.
# docker-compose.yml built at dankhost.com for: Gitea # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Only Caddy publishes ports. Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- Gitea (gitea.example.org) ---- # Source: https://docs.gitea.com/installation/install-with-docker (checked 2026-09-29) # Source: https://docs.gitea.com/administration/reverse-proxies (checked 2026-09-29) # Source: https://docs.gitea.com/administration/config-cheat-sheet (checked 2026-09-29) # Changed: Removed the documented '3000:3000' port; Caddy reaches gitea-server:3000 on the proxy network, which replaces the documented gitea network. # Removed the documented '222:22' SSH port, because in this file only Caddy publishes ports. Git works over HTTPS, and GITEA__server__DISABLE_SSH is true so Gitea stops offering SSH clone addresses that would not work. # Added GITEA__server__ROOT_URL, set to https://gitea.example.org/, in the documented GITEA__section__KEY form; the reverse-proxy page says to set ROOT_URL to the public address. # Uses the documented default SQLite database. The docs' PostgreSQL variant is on dankhost.com/app/gitea/ (the SQLite / PostgreSQL switch above the compose file); their MySQL variant is not offered. The documented container_name 'gitea' becomes gitea-server. gitea-server: image: "docker.gitea.com/gitea:1.27.3" container_name: "gitea-server" environment: USER_UID: "1000" USER_GID: "1000" GITEA__server__ROOT_URL: "https://gitea.example.org/" GITEA__server__DISABLE_SSH: "true" restart: "always" volumes: - "./gitea/gitea:/data" - "/etc/timezone:/etc/timezone:ro" - "/etc/localtime:/etc/localtime:ro" networks: proxy: {} networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" volumes: caddy-data: caddy-config:
With PostgreSQL
This is what the builder's code writes for Gitea alone on example.org from the project's PostgreSQL setup (the builder on the front page still writes the SQLite version, so copy this one from here): the official definition with its published ports removed and Caddy added in front. Every ${VARIABLE} is defined in the .env below.
# docker-compose.yml built at dankhost.com for: Gitea # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Only Caddy publishes ports. Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- Gitea (gitea.example.org) ---- # Source: https://docs.gitea.com/installation/install-with-docker (checked 2026-09-30) # Source: https://docs.gitea.com/administration/reverse-proxies (checked 2026-09-29) # Source: https://docs.gitea.com/administration/config-cheat-sheet (checked 2026-09-29) # Source: https://docs.gitea.com/installation/database-prep (checked 2026-09-30) # Source: https://hub.docker.com/_/postgres (checked 2026-09-30) # Source: https://github.com/docker-library/postgres/blob/master/18/bookworm/docker-entrypoint.sh (checked 2026-09-30) # Changed: Removed the documented '3000:3000' port; Caddy reaches gitea-server:3000 on the proxy network, which replaces the documented gitea network. # Removed the documented '222:22' SSH port, because in this file only Caddy publishes ports. Git works over HTTPS, and GITEA__server__DISABLE_SSH is true so Gitea stops offering SSH clone addresses that would not work. # Added GITEA__server__ROOT_URL, set to https://gitea.example.org/, in the documented GITEA__section__KEY form; the reverse-proxy page says to set ROOT_URL to the public address. # Uses the PostgreSQL variant from the 'PostgreSQL database' section of the same docs page: the five GITEA__database__ variables on server, depends_on db, and a db service running PostgreSQL 18, the major version the docs pin on purpose (written postgres:18, the short name of the docs' docker.io/library/postgres:18: the same image). The documented container_name 'gitea' becomes gitea-server. # The documented password 'gitea' (in GITEA__database__PASSWD and POSTGRES_PASSWORD) is replaced by DB_PASSWORD, a random secret in .env; the documented user and database name, gitea, are kept. # The docs mount ./postgres at /var/lib/postgresql/data. From 18 on, the postgres image keeps its data in /var/lib/postgresql/18/docker and declares its volume at /var/lib/postgresql, and its start script stops with 'Error: in 18+, these Docker images are configured to store database data in a format which is compatible with "pg_ctlcluster"' when a new container has a mount at /var/lib/postgresql/data. So the mount here is ./postgres:/var/lib/postgresql, as the image's docs say for 18 and later. # db sits only on the internal network it shares with server, publishes no port and is not on the proxy network; server reaches it as db:5432, the address the docs use. gitea-server: image: "docker.gitea.com/gitea:1.27.3" container_name: "gitea-server" environment: USER_UID: "1000" USER_GID: "1000" GITEA__database__DB_TYPE: "postgres" GITEA__database__HOST: "db:5432" GITEA__database__NAME: "gitea" GITEA__database__USER: "gitea" GITEA__database__PASSWD: "${GITEA_DB_PASSWORD}" GITEA__server__ROOT_URL: "https://gitea.example.org/" GITEA__server__DISABLE_SSH: "true" restart: "always" volumes: - "./gitea/gitea:/data" - "/etc/timezone:/etc/timezone:ro" - "/etc/localtime:/etc/localtime:ro" depends_on: - "gitea-db" networks: proxy: {} gitea-backend: aliases: - "server" gitea-db: image: "postgres:18" container_name: "gitea-db" restart: "always" environment: POSTGRES_USER: "gitea" POSTGRES_PASSWORD: "${GITEA_DB_PASSWORD}" POSTGRES_DB: "gitea" volumes: - "./gitea/postgres:/var/lib/postgresql" networks: gitea-backend: aliases: - "db" networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" gitea-backend: internal: true volumes: caddy-data: caddy-config:
With SQLite, the default
With Git over SSH on
The same file with Gitea's SSH port published beside Caddy and labelled # PORT OUTSIDE THE PROXY, GITEA__server__DISABLE_SSH, GITEA__server__SSH_DOMAIN and GITEA__server__SSH_PORT set. Everything else is the off file, as the builder writes it for Gitea alone on example.org.
# docker-compose.yml built at dankhost.com for: Gitea # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Caddy publishes 80 and 443. The only other published ports, each labelled where # it is written: 222/tcp (Gitea: Git over SSH). # Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- Gitea (gitea.example.org) ---- # Source: https://docs.gitea.com/installation/install-with-docker (checked 2026-09-29) # Source: https://docs.gitea.com/administration/reverse-proxies (checked 2026-09-29) # Source: https://docs.gitea.com/administration/config-cheat-sheet (checked 2026-09-29) # Source: https://docs.gitea.com/installation/install-with-docker-rootless (checked 2026-10-09) # Source: https://github.com/go-gitea/gitea/blob/v1.27.3/docker/root/etc/s6/openssh/setup (checked 2026-10-09) # Source: https://github.com/go-gitea/gitea/blob/v1.27.3/docker/root/etc/templates/sshd_config (checked 2026-10-09) # Changed: Removed the documented '3000:3000' port; Caddy reaches gitea-server:3000 on the proxy network, which replaces the documented gitea network. # Git over SSH on (dankhost.com/app/gitea/): the documented '222:22' SSH port is published beside Caddy's 80 and 443. GITEA__server__DISABLE_SSH is false, and GITEA__server__SSH_DOMAIN and GITEA__server__SSH_PORT (from the cheat sheet) make the SSH clone address Gitea prints match this file. # Added GITEA__server__ROOT_URL, set to https://gitea.example.org/, in the documented GITEA__section__KEY form; the reverse-proxy page says to set ROOT_URL to the public address. # Uses the documented default SQLite database. The docs' PostgreSQL variant is on dankhost.com/app/gitea/ (the SQLite / PostgreSQL switch above the compose file); their MySQL variant is not offered. The documented container_name 'gitea' becomes gitea-server. # PORT OUTSIDE THE PROXY 222/tcp: Git over SSH, so you can clone and push with your SSH key. The container's own SSH server listens on 22, the right-hand side; SSH is not HTTP, so it cannot go through the proxy. gitea-server: image: "docker.gitea.com/gitea:1.27.3" container_name: "gitea-server" environment: USER_UID: "1000" USER_GID: "1000" GITEA__server__ROOT_URL: "https://gitea.example.org/" GITEA__server__DISABLE_SSH: "false" GITEA__server__SSH_DOMAIN: "gitea.example.org" GITEA__server__SSH_PORT: "222" restart: "always" volumes: - "./gitea/gitea:/data" - "/etc/timezone:/etc/timezone:ro" - "/etc/localtime:/etc/localtime:ro" ports: - "222:22" # Git over SSH networks: proxy: {} networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" volumes: caddy-data: caddy-config:
With PostgreSQL
With Git over SSH on
The same file with Gitea's SSH port published beside Caddy and labelled # PORT OUTSIDE THE PROXY, GITEA__server__DISABLE_SSH, GITEA__server__SSH_DOMAIN and GITEA__server__SSH_PORT set. Everything else is the off file, as the builder writes it for Gitea alone on example.org.
# docker-compose.yml built at dankhost.com for: Gitea # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Caddy publishes 80 and 443. The only other published ports, each labelled where # it is written: 222/tcp (Gitea: Git over SSH). # Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- Gitea (gitea.example.org) ---- # Source: https://docs.gitea.com/installation/install-with-docker (checked 2026-09-30) # Source: https://docs.gitea.com/administration/reverse-proxies (checked 2026-09-29) # Source: https://docs.gitea.com/administration/config-cheat-sheet (checked 2026-09-29) # Source: https://docs.gitea.com/installation/database-prep (checked 2026-09-30) # Source: https://hub.docker.com/_/postgres (checked 2026-09-30) # Source: https://github.com/docker-library/postgres/blob/master/18/bookworm/docker-entrypoint.sh (checked 2026-09-30) # Source: https://docs.gitea.com/installation/install-with-docker-rootless (checked 2026-10-09) # Source: https://github.com/go-gitea/gitea/blob/v1.27.3/docker/root/etc/s6/openssh/setup (checked 2026-10-09) # Source: https://github.com/go-gitea/gitea/blob/v1.27.3/docker/root/etc/templates/sshd_config (checked 2026-10-09) # Changed: Removed the documented '3000:3000' port; Caddy reaches gitea-server:3000 on the proxy network, which replaces the documented gitea network. # Git over SSH on (dankhost.com/app/gitea/): the documented '222:22' SSH port is published beside Caddy's 80 and 443. GITEA__server__DISABLE_SSH is false, and GITEA__server__SSH_DOMAIN and GITEA__server__SSH_PORT (from the cheat sheet) make the SSH clone address Gitea prints match this file. # Added GITEA__server__ROOT_URL, set to https://gitea.example.org/, in the documented GITEA__section__KEY form; the reverse-proxy page says to set ROOT_URL to the public address. # Uses the PostgreSQL variant from the 'PostgreSQL database' section of the same docs page: the five GITEA__database__ variables on server, depends_on db, and a db service running PostgreSQL 18, the major version the docs pin on purpose (written postgres:18, the short name of the docs' docker.io/library/postgres:18: the same image). The documented container_name 'gitea' becomes gitea-server. # The documented password 'gitea' (in GITEA__database__PASSWD and POSTGRES_PASSWORD) is replaced by DB_PASSWORD, a random secret in .env; the documented user and database name, gitea, are kept. # The docs mount ./postgres at /var/lib/postgresql/data. From 18 on, the postgres image keeps its data in /var/lib/postgresql/18/docker and declares its volume at /var/lib/postgresql, and its start script stops with 'Error: in 18+, these Docker images are configured to store database data in a format which is compatible with "pg_ctlcluster"' when a new container has a mount at /var/lib/postgresql/data. So the mount here is ./postgres:/var/lib/postgresql, as the image's docs say for 18 and later. # db sits only on the internal network it shares with server, publishes no port and is not on the proxy network; server reaches it as db:5432, the address the docs use. # PORT OUTSIDE THE PROXY 222/tcp: Git over SSH, so you can clone and push with your SSH key. The container's own SSH server listens on 22, the right-hand side; SSH is not HTTP, so it cannot go through the proxy. gitea-server: image: "docker.gitea.com/gitea:1.27.3" container_name: "gitea-server" environment: USER_UID: "1000" USER_GID: "1000" GITEA__database__DB_TYPE: "postgres" GITEA__database__HOST: "db:5432" GITEA__database__NAME: "gitea" GITEA__database__USER: "gitea" GITEA__database__PASSWD: "${GITEA_DB_PASSWORD}" GITEA__server__ROOT_URL: "https://gitea.example.org/" GITEA__server__DISABLE_SSH: "false" GITEA__server__SSH_DOMAIN: "gitea.example.org" GITEA__server__SSH_PORT: "222" restart: "always" volumes: - "./gitea/gitea:/data" - "/etc/timezone:/etc/timezone:ro" - "/etc/localtime:/etc/localtime:ro" depends_on: - "gitea-db" ports: - "222:22" # Git over SSH networks: proxy: {} gitea-backend: aliases: - "server" gitea-db: image: "postgres:18" container_name: "gitea-db" restart: "always" environment: POSTGRES_USER: "gitea" POSTGRES_PASSWORD: "${GITEA_DB_PASSWORD}" POSTGRES_DB: "gitea" volumes: - "./gitea/postgres:/var/lib/postgresql" networks: gitea-backend: aliases: - "db" networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" gitea-backend: internal: true volumes: caddy-data: caddy-config:
"222:22": “- "222:22"” Gitea docs: Installation with Docker (docker-compose.yml, GITEA__section__KEY variables) checked 2026-10-09GITEA__server__DISABLE_SSH: "false": set to false, its documented default, instead of removed: the off file set it to true, and Gitea writes these variables into app.ini at every start, so a removed one would leave true there: “DISABLE_SSH: false: Disable SSH feature when it’s not available.” Gitea docs: Configuration Cheat Sheet (ROOT_URL, DISABLE_SSH) checked 2026-10-09 “These settings are applied each time the docker container starts by environment-to-ini command (a warpper of gitea config edit-ini)” Gitea docs: Installation with Docker (docker-compose.yml, GITEA__section__KEY variables) checked 2026-10-09GITEA__server__SSH_DOMAIN: "gitea.example.org": the host name in the SSH clone address (the same host as ROOT_URL here, written out so the address does not depend on it): “SSH_DOMAIN: empty: Domain name to be exposed in clone URL, defaults to the domain part of ROOT_URL” Gitea docs: Configuration Cheat Sheet (ROOT_URL, DISABLE_SSH) checked 2026-10-09GITEA__server__SSH_PORT: "222": the port in that address, the host port of the mapping: “SSH_PORT: 22: SSH port displayed in clone URL.” Gitea docs: Configuration Cheat Sheet (ROOT_URL, DISABLE_SSH) checked 2026-10-09- The variable names: “any settings in app.ini can be set or overridden with an environment variable of the form: GITEA__section_name__KEY_NAME=value.” Gitea docs: Installation with Docker (docker-compose.yml, GITEA__section__KEY variables) checked 2026-10-09 All three keys sit under “Server (server)” in Gitea docs: Configuration Cheat Sheet (ROOT_URL, DISABLE_SSH) checked 2026-10-09.
- Gitea's standard image runs OpenSSH inside the container, and its start script takes the port from the plain SSH_PORT / SSH_LISTEN_PORT variables, not from GITEA__server__SSH_PORT, so it keeps listening on 22, the right-hand side of the mapping. Do not add a plain SSH_PORT: it would move that server off 22. “Rootless image must use its bulitin SSH server, while the rootful one must its managed standalone OpenSSH server.” Gitea docs: Installation with Docker (rootless) checked 2026-10-09 “SSH_PORT=${SSH_PORT:-"22"} \” “SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-"${SSH_PORT}"} \” Gitea v1.27.3: docker/root/etc/s6/openssh/setup (the image's sshd start script) checked 2026-10-09 “Port ${SSH_LISTEN_PORT}” Gitea v1.27.3: docker/root/etc/templates/sshd_config checked 2026-10-09
Caddyfile save as caddy/Caddyfile
Caddy gets and renews the HTTPS certificate for gitea.example.org by itself once the DNS record points at your server and ports 80 and 443 reach it.
# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.
# Gitea
gitea.example.org {
reverse_proxy gitea-server:3000
}
.env
With SQLite, the default
Gitea needs no secret here; the builder adds nothing you have to fill in by hand.
# .env for Gitea, from dankhost.com/app/gitea/. Nothing here is secret. # Keep this file private (chmod 600). # None of the chosen apps needs a variable here.
With PostgreSQL
The secret is left blank here on purpose: a password printed on a public page is the same for everyone who copies it. Fill it with random letters and digits as in How to run it.
# .env for Gitea, from dankhost.com/app/gitea/. Fill the blank secret before starting. # Keep this file private (chmod 600). # Gitea # 32 random letters and digits, for example from: tr -dc A-Za-z0-9 </dev/urandom | head -c 32 GITEA_DB_PASSWORD=
Changes from the official file
Besides prefixing every service, container, volume, folder and variable with gitea (so any set of apps can share one file), these are all the differences from what the project documents:
With SQLite, the default
- Removed the documented '3000:3000' port; Caddy reaches gitea-server:3000 on the proxy network, which replaces the documented gitea network.
- Removed the documented '222:22' SSH port, because in this file only Caddy publishes ports. Git works over HTTPS, and GITEA__server__DISABLE_SSH is true so Gitea stops offering SSH clone addresses that would not work.
- Git over SSH on (dankhost.com/app/gitea/): the documented '222:22' SSH port is published beside Caddy's 80 and 443. GITEA__server__DISABLE_SSH is false, and GITEA__server__SSH_DOMAIN and GITEA__server__SSH_PORT (from the cheat sheet) make the SSH clone address Gitea prints match this file.
- Added GITEA__server__ROOT_URL, set to https://gitea.example.org/, in the documented GITEA__section__KEY form; the reverse-proxy page says to set ROOT_URL to the public address.
- Uses the documented default SQLite database. The docs' PostgreSQL variant is on dankhost.com/app/gitea/ (the SQLite / PostgreSQL switch above the compose file); their MySQL variant is not offered. The documented container_name 'gitea' becomes gitea-server.
Notes for Gitea behind the proxy
- Git over SSH is off in this file, so clone and push over HTTPS: git clone https://gitea.example.org/<user>/<repo>.git, with your Gitea user name and password or an access token. The Git over SSH switch at the top of the page gives the file with the SSH port.
- Git over SSH is on: add your SSH key in Gitea and clone with the ssh:// address Gitea prints, as under Git over SSH at the top of the page. Cloning over HTTPS keeps working too.
- The first visit opens Gitea's installation wizard, and it is open to whoever gets there first: open the address straight away, keep SQLite3, check that the base URL reads https://gitea.example.org/, and create the administrator account on that page.
- The docs: the volume must be owned by the UID/GID in USER_UID/USER_GID (1000 here) or the container may not start. Run id -u and id -g and change both values if yours differ.
- The docs mount /etc/timezone and /etc/localtime from the host. Some Linux systems (Fedora, Arch) have no /etc/timezone: remove that line there.
- Pinned to 1.27.3, the release the docs' example uses. Their tag list: :1 follows every 1.x release, :latest the newest.
With PostgreSQL
- Removed the documented '3000:3000' port; Caddy reaches gitea-server:3000 on the proxy network, which replaces the documented gitea network.
- Removed the documented '222:22' SSH port, because in this file only Caddy publishes ports. Git works over HTTPS, and GITEA__server__DISABLE_SSH is true so Gitea stops offering SSH clone addresses that would not work.
- Git over SSH on (dankhost.com/app/gitea/): the documented '222:22' SSH port is published beside Caddy's 80 and 443. GITEA__server__DISABLE_SSH is false, and GITEA__server__SSH_DOMAIN and GITEA__server__SSH_PORT (from the cheat sheet) make the SSH clone address Gitea prints match this file.
- Added GITEA__server__ROOT_URL, set to https://gitea.example.org/, in the documented GITEA__section__KEY form; the reverse-proxy page says to set ROOT_URL to the public address.
- Uses the PostgreSQL variant from the 'PostgreSQL database' section of the same docs page: the five GITEA__database__ variables on server, depends_on db, and a db service running PostgreSQL 18, the major version the docs pin on purpose (written postgres:18, the short name of the docs' docker.io/library/postgres:18: the same image). The documented container_name 'gitea' becomes gitea-server.
- The documented password 'gitea' (in GITEA__database__PASSWD and POSTGRES_PASSWORD) is replaced by DB_PASSWORD, a random secret in .env; the documented user and database name, gitea, are kept.
- The docs mount ./postgres at /var/lib/postgresql/data. From 18 on, the postgres image keeps its data in /var/lib/postgresql/18/docker and declares its volume at /var/lib/postgresql, and its start script stops with 'Error: in 18+, these Docker images are configured to store database data in a format which is compatible with "pg_ctlcluster"' when a new container has a mount at /var/lib/postgresql/data. So the mount here is ./postgres:/var/lib/postgresql, as the image's docs say for 18 and later.
- db sits only on the internal network it shares with server, publishes no port and is not on the proxy network; server reaches it as db:5432, the address the docs use.
Notes for Gitea behind the proxy
- Git over SSH is off in this file, so clone and push over HTTPS: git clone https://gitea.example.org/<user>/<repo>.git, with your Gitea user name and password or an access token. The Git over SSH switch at the top of the page gives the file with the SSH port.
- Git over SSH is on: add your SSH key in Gitea and clone with the ssh:// address Gitea prints, as under Git over SSH at the top of the page. Cloning over HTTPS keeps working too.
- The first visit opens Gitea's installation wizard, and it is open to whoever gets there first: open the address straight away. Its database fields come from the GITEA__database__ variables (PostgreSQL, db:5432, gitea), so leave them as they are; check that the base URL reads https://gitea.example.org/ and create the administrator account on that page.
- The docs: the volume must be owned by the UID/GID in USER_UID/USER_GID (1000 here) or the container may not start. Run id -u and id -g and change both values if yours differ.
- The docs mount /etc/timezone and /etc/localtime from the host. Some Linux systems (Fedora, Arch) have no /etc/timezone: remove that line there.
- Pinned to 1.27.3, the release the docs' example uses. Their tag list: :1 follows every 1.x release, :latest the newest.
How to run it
With SQLite, the default
- At your DNS provider, add an A record named
giteaon your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it. - Save the three files in one folder:
docker-compose.ymland.envside by side, the Caddyfile at./caddy/Caddyfile. Replaceexample.orgwith your domain in the Caddyfile, the compose file and the .env, or let the builder do it. - Nothing in
.envneeds filling in;chmod 600 .envall the same. - Start it:
docker compose up -d docker compose logs -f caddy # watch the certificate arrive
- Open the new address (
gitea.plus your domain) in a browser and follow the notes above.
With PostgreSQL
- At your DNS provider, add an A record named
giteaon your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it. - Save the three files in one folder:
docker-compose.ymland.envside by side, the Caddyfile at./caddy/Caddyfile. Replaceexample.orgwith your domain in the Caddyfile, the compose file and the .env. - Fill the blank
GITEA_DB_PASSWORDin.env. On the server,tr -dc A-Za-z0-9 </dev/urandom | head -c 32prints 32 random letters and digits. Thenchmod 600 .env. - Start it:
docker compose up -d docker compose logs -f caddy # watch the certificate arrive
- Open the new address (
gitea.plus your domain) in a browser and follow the notes above.
Back it up
With SQLite, the default
Gitea's backup page: to be consistent, Gitea "must be shutdown during backup". In this compose everything (app.ini, the SQLite database, the repositories and uploads) is in one folder.
Below is the BACKUP.md the builder writes next to the compose file above: which of its folders and volumes hold data, what to copy with which container stopped, and a restore check. Pick more apps in the builder and it covers them all in one file.
# BACKUP.md built at dankhost.com for: Gitea
What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.
The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.
Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.
## Before you start
BACKUP=/mnt/backup/selfhost # change this: a disk or machine other than this server's system disk
mkdir -p "$BACKUP"
## Every time: the three stack files
tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy
.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.
## Caddy (the reverse proxy)
Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.
- caddy-data (named volume, /data in caddy)
BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.
Copy (Caddy keeps serving while you copy):
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data
Restore check:
tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"
Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)
## Gitea
Gitea's backup page: to be consistent, Gitea "must be shutdown during backup". In this compose everything (app.ini, the SQLite database, the repositories and uploads) is in one folder.
What this compose mounts:
- ./gitea/gitea (/data in gitea-server)
BACK UP: Gitea's whole /data: app.ini with the instance's secret keys, the SQLite database, the git repositories and uploaded files.
Gitea also has gitea dump, which zips files and database. With Docker the page says to run it as the user in app.ini's RUN_USER (git in this image) from inside its --tempdir, where the zip is written. To make one as well, run this before step 1; the zip lands in ./gitea/gitea and so goes into the copy:
docker compose exec -u git -w /data gitea-server bash -c '/usr/local/bin/gitea dump -c /data/gitea/conf/app.ini --tempdir /data'
1. Stop gitea-server. Gitea's backup page: a backup taken while Gitea runs can hold a repository and a database from different moments.
docker compose stop gitea-server
2. Copy while gitea-server is stopped:
tar czf "$BACKUP/gitea-gitea.tar.gz" ./gitea/gitea
3. Start it again:
docker compose start gitea-server
Restore check:
tar tzf "$BACKUP/gitea-gitea.tar.gz" > /dev/null && echo OK
Put a copy back (with gitea-server stopped):
tar xzf "$BACKUP/gitea-gitea.tar.gz" # recreates ./gitea/gitea; move the old folder aside first
Stop it, put ./gitea/gitea back, start it. The page then suggests checking the instance:
docker compose exec -u git gitea-server gitea doctor check
Sources:
- Gitea docs: Backup and Restore (consistency, gitea dump with Docker): https://docs.gitea.com/administration/backup-and-restore (checked 2026-09-29)
With PostgreSQL
Gitea's backup page: to be consistent, Gitea "must be shutdown during backup", and for PostgreSQL it gives pg_dump -U $USER $DATABASE > gitea-db.sql. With PostgreSQL the database is in its own container: stop Gitea, dump the database, then copy ./gitea.
Below is the BACKUP.md for the PostgreSQL version of the compose file above, written by the same code as the builder's: which of its folders and volumes hold data, the dump command the project documents, rewritten for this file's service names, what to copy with which container stopped, and a restore check.
# BACKUP.md built at dankhost.com for: Gitea
What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.
The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.
Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.
## Before you start
BACKUP=/mnt/backup/selfhost # change this: a disk or machine other than this server's system disk
mkdir -p "$BACKUP"
## Every time: the three stack files
tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy
.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.
## Caddy (the reverse proxy)
Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.
- caddy-data (named volume, /data in caddy)
BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.
Copy (Caddy keeps serving while you copy):
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data
Restore check:
tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"
Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)
## Gitea
Gitea's backup page: to be consistent, Gitea "must be shutdown during backup", and for PostgreSQL it gives pg_dump -U $USER $DATABASE > gitea-db.sql. With PostgreSQL the database is in its own container: stop Gitea, dump the database, then copy ./gitea.
What this compose mounts:
- ./gitea/gitea (/data in gitea-server)
BACK UP: Gitea's /data: app.ini with the instance's secret keys and database settings, the git repositories and uploaded files. The database itself is in PostgreSQL.
- ./gitea/postgres (/var/lib/postgresql in gitea-db)
COVERED BY THE COMMAND BELOW: PostgreSQL's data files; the pg_dump below is the copy to keep. Copy this folder itself only with db stopped.
1. Stop gitea-server. Gitea's backup page: a backup taken while Gitea runs can hold a repository and a database from different moments. The database keeps running for the dump.
docker compose stop gitea-server
2. Database dump for gitea-db:
docker compose exec -T gitea-db pg_dump -U gitea gitea > "$BACKUP/gitea-db.sql"
The page's pg_dump -U $USER $DATABASE, run inside the database container with this file's user and database, both gitea. The page says admins may prefer this native dump to the SQL inside gitea dump's zip, which has open issues that may cause problems on restore.
3. Copy while gitea-server is stopped:
tar czf "$BACKUP/gitea-gitea.tar.gz" ./gitea/gitea
4. Start it again:
docker compose start gitea-server
Restore check:
grep -c 'PostgreSQL database dump complete' "$BACKUP/gitea-db.sql" # 1 means pg_dump finished
tar tzf "$BACKUP/gitea-gitea.tar.gz" > /dev/null && echo OK
Put a copy back (with gitea-server stopped):
tar xzf "$BACKUP/gitea-gitea.tar.gz" # recreates ./gitea/gitea; move the old folder aside first
The page restores with psql -U $USER -d $DATABASE < gitea-db.sql, into an empty database. Stop everything, put ./gitea/gitea back and move ./gitea/postgres aside; then start only db (on first start it creates an empty gitea database), load the dump, and start the rest:
docker compose up -d gitea-db
until docker compose exec -T gitea-db pg_isready -h 127.0.0.1 -U gitea; do sleep 2; done # waits until the first-start setup is over
docker compose exec -T gitea-db psql -U gitea -d gitea --set ON_ERROR_STOP=on < "$BACKUP/gitea-db.sql"
docker compose up -d
The page then suggests checking the instance:
docker compose exec -u git gitea-server gitea doctor check
Sources:
- Gitea docs: Backup and Restore (consistency, pg_dump and psql, converting database types): https://docs.gitea.com/administration/backup-and-restore (checked 2026-09-30)
- PostgreSQL docs: pg_dump: https://www.postgresql.org/docs/current/app-pgdump.html (checked 2026-09-30)
Update it
With SQLite, the default
What docker compose pull does depends only on how each image line in the compose file above is tagged. For Gitea as this page writes it:
| Service | Image | How it is pinned | What docker compose pull does |
|---|---|---|---|
caddy | caddy:2 | Major version only (tag 2) | Takes the newest image tagged 2: minor and patch releases of 2, never 3. A new major version needs a tag edit. |
gitea-server | docker.gitea.com/gitea:1.27.3 | Exact version (tag 1.27.3) | Does not move: stays on 1.27.3 until you edit the tag (a publisher may re-push the same version on a rebuilt base). |
What Gitea's docs say about updating
Gitea's upgrade page: read the changelog for breaking changes, clear any deprecated-setting warnings shown at the top of Site Administration (Gitea may refuse to start on the next version otherwise), stop Gitea, back up, then start the new image. Gitea migrates its database on start, which can take a while on a large one.
- This file pins docker.gitea.com/gitea:1.27.3, so docker compose pull changes nothing: to update, first edit the tag to the new version.
- Within the same first two numbers (1.27.x) Gitea keeps the same database structure, so you can move up and, at your own risk, back. Moving to a new minor version (1.27 to 1.28) upgrades the database and the old version cannot use it; only the backup gets you back.
The steps
- Back up first, as in Back it up above. An update can migrate Gitea's data on its first start; the copy is the way back.
gitea-serveris pinned to an exact version (see the table), so a pull alone changes nothing there: to update Gitea, first edit its tag indocker-compose.ymlto the version you want.- Download the new images. Running containers are not touched yet:
docker compose pull
- Recreate the containers whose image changed. Volumes and bind-mounted folders stay as they are:
docker compose up -d
- Watch Gitea start (Ctrl+C stops following the log, not the app):
docker compose logs -f gitea-server
- Optional: remove the old images the pull left without a tag. This covers every stack on the machine, not only this one:
docker image prune
With PostgreSQL
What docker compose pull does depends only on how each image line in the compose file above is tagged. For Gitea as this page writes it:
| Service | Image | How it is pinned | What docker compose pull does |
|---|---|---|---|
caddy | caddy:2 | Major version only (tag 2) | Takes the newest image tagged 2: minor and patch releases of 2, never 3. A new major version needs a tag edit. |
gitea-server | docker.gitea.com/gitea:1.27.3 | Exact version (tag 1.27.3) | Does not move: stays on 1.27.3 until you edit the tag (a publisher may re-push the same version on a rebuilt base). |
gitea-db database | postgres:18 | Major version only (tag 18) | Takes the newest image tagged 18: minor and patch releases of 18, never 19. A new major version needs a tag edit. |
Do not raise the major version of gitea-db by editing its tag. Keep its tag, 18, as it is when you update Gitea.
PostgreSQL's docs: a new major version may change how data is stored on disk, so a data folder written by an older major version will not start under a newer one (the server refuses it). Moving needs a dump and restore (pg_dumpall, then load the dump into the new version) or pg_upgrade. Minor releases of the same major version never change the storage format. Source: PostgreSQL docs: Upgrading a PostgreSQL Cluster checked 2026-09-30
What Gitea's docs say about updating
Gitea's upgrade page: read the changelog for breaking changes, clear any deprecated-setting warnings shown at the top of Site Administration (Gitea may refuse to start on the next version otherwise), stop Gitea, back up, then start the new image. Gitea migrates its database on start, which can take a while on a large one.
- This file pins docker.gitea.com/gitea:1.27.3, so docker compose pull changes nothing: to update, first edit the tag to the new version.
- Within the same first two numbers (1.27.x) Gitea keeps the same database structure, so you can move up and, at your own risk, back. Moving to a new minor version (1.27 to 1.28) upgrades the database and the old version cannot use it; only the backup gets you back.
- Gitea and PostgreSQL are updated separately, one tag at a time. The db tag, postgres:18, takes every 18.x release on docker compose pull; PostgreSQL says minor releases never change the storage format, so that is safe.
- Gitea's Docker page pins the major version on purpose: PostgreSQL does not upgrade its data folder by itself, and a newer major version needs pg_upgrade or a dump and restore (PostgreSQL's Upgrading a PostgreSQL Cluster page). The 19 image would even refuse to start while the 18 data is in the folder. With this file: stop Gitea, dump, stop db and move its folder aside, edit the db tag, start db alone, load the dump, start the rest:
docker compose stop gitea-server docker compose exec -T gitea-db pg_dump -U gitea gitea > gitea-pg18.sql docker compose stop gitea-db && mv gitea/postgres gitea/postgres-18 docker compose up -d gitea-db # after editing the tag until docker compose exec -T gitea-db pg_isready -h 127.0.0.1 -U gitea; do sleep 2; done # waits until the first-start setup is over docker compose exec -T gitea-db psql -U gitea -d gitea --set ON_ERROR_STOP=on < gitea-pg18.sql docker compose up -d
- Keep gitea/postgres-18 until Gitea has run well for a while: putting it back with the old tag is the way back.
The steps
- Back up first, as in Back it up above. An update can migrate Gitea's data on its first start and its database with it; the copy is the way back.
gitea-serveris pinned to an exact version (see the table), so a pull alone changes nothing there: to update Gitea, first edit its tag indocker-compose.ymlto the version you want.- Download the new images. Running containers are not touched yet:
docker compose pull
- Recreate the containers whose image changed. Volumes and bind-mounted folders stay as they are:
docker compose up -d
- Watch Gitea start (Ctrl+C stops following the log, not the app):
docker compose logs -f gitea-server
- Optional: remove the old images the pull left without a tag. This covers every stack on the machine, not only this one:
docker image prune
Locked out? Reset the admin password
Sets a new password with Gitea's admin CLI, run as the git user with the config file named, as Gitea's Docker examples do. The Forgot Password link only works once a mail service is set up.
- List the admin users if you need the exact name: Source: Gitea docs: Gitea Command Line (admin user list, admin user change-password) read 2026-10-03; Gitea docs: Backup and Restore, Using Docker (docker exec --user git, -c /data/gitea/conf/app.ini) read 2026-10-03; Gitea docs: FAQ, How can a user's password be changed read 2026-10-03
docker compose exec --user git gitea-server gitea -c /data/gitea/conf/app.ini admin user list --admin
- Change the password. Gitea makes the user pick a new one at the next login unless you add --must-change-password=false. Source: Gitea docs: Gitea Command Line (admin user list, admin user change-password) read 2026-10-03; Gitea docs: Backup and Restore, Using Docker (docker exec --user git, -c /data/gitea/conf/app.ini) read 2026-10-03
docker compose exec --user git gitea-server gitea -c /data/gitea/conf/app.ini admin user change-password --username '<admin user>' --password '<new password>'
Sources
Every page below was fetched on the date shown.
- Gitea repository on GitHub (description) checked 2026-09-29 (what it does)
- Gitea docs: What is Gitea? (system requirements) checked 2026-09-29 (hardware requirements)
- Gitea docs: Installation with Docker (docker-compose.yml, GITEA__section__KEY variables) checked 2026-09-29 (compose definition and proxy settings, PostgreSQL version, PostgreSQL update notes, Git over SSH)
- Gitea docs: Reverse Proxies (ROOT_URL, nginx example, client_max_body_size 512M) checked 2026-09-29 (compose definition and proxy settings, PostgreSQL version)
- Gitea docs: Configuration Cheat Sheet (ROOT_URL, DISABLE_SSH) checked 2026-09-29 (compose definition and proxy settings, PostgreSQL version, Git over SSH)
- Caddy docs: Keep Caddy running (Docker Compose section) checked 2026-09-23 (Caddy)
- Vaultwarden wiki: Caddy with HTTP challenge (uses the caddy:2 image) checked 2026-09-23 (Caddy)
- Gitea docs: Backup and Restore (consistency, gitea dump with Docker) checked 2026-09-29 (backup plan, PostgreSQL version, PostgreSQL backup plan)
- Caddy docs: Conventions, Data directory checked 2026-09-24 (backup plan)
- Docker docs: Volumes, Back up, restore, or migrate data volumes checked 2026-09-24 (backup plan)
- Gitea docs: Upgrade from an old Gitea checked 2026-09-30 (update notes, PostgreSQL update notes)
- Docker docs: docker compose pull checked 2026-09-30 (update steps)
- Docker docs: docker compose up (recreates changed containers, keeps volumes) checked 2026-09-30 (update steps)
- Docker docs: docker image prune checked 2026-09-30 (update steps)
- Gitea docs: Database Preparation (PostgreSQL >= 12) checked 2026-09-30 (PostgreSQL version)
- Docker Official Image postgres: POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, PGDATA (changed in 18) checked 2026-09-30 (PostgreSQL version)
- postgres image source: docker-entrypoint.sh for 18 (refuses a mount at /var/lib/postgresql/data) checked 2026-09-30 (PostgreSQL version)
- PostgreSQL docs: pg_dump checked 2026-09-30 (PostgreSQL backup plan)
- PostgreSQL docs: Upgrading a PostgreSQL Cluster checked 2026-09-30 (PostgreSQL update notes, database upgrade)
- Gitea docs: Installation with Docker (rootless) checked 2026-10-09 (Git over SSH)
- Gitea docs: FAQ (SSHD vs built-in SSH, SSH issues) checked 2026-10-09 (Git over SSH)
- Gitea v1.27.3: options/locale/locale_en-US.json (the settings page's English labels) checked 2026-10-09 (Git over SSH)
- Gitea v1.27.3: docker/root/etc/s6/openssh/setup (the image's sshd start script) checked 2026-10-09 (Git over SSH)
- Gitea v1.27.3: docker/root/etc/templates/sshd_config checked 2026-10-09 (Git over SSH)
- Docker docs: Packet filtering and firewalls, Docker and ufw checked 2026-10-09 (Git over SSH)