📝 Fix compose example to follow conventions 📝

- Add x-logging anchor with json-file driver
- Add pull_policy: always
- Add logging: *default-logging
- Add network block (gitea / external: false)
- Switch environment from list to map format
- Add CONTAINER_NAME to environment
- Use HOSTNAME: ${BASE_HOST_NAME:-...} pattern
- Switch volumes from absolute paths to ./volumes relative paths
- Bind ports to 172.17.0.1 (not 0.0.0.0)
- Add cgroupns_mode: private
- Add port comment at top of file
- README.md: bring compose example into line with dockerfile_conventions.md

README.md
This commit is contained in:
2026-06-05 13:42:50 -04:00
parent 958439b9ee
commit ddc318052c
+28 -9
View File
@@ -36,31 +36,50 @@ docker run -d \
### via docker compose
```yaml
# nginx proxy address - http://172.17.0.1:80
x-logging: &default-logging
driver: json-file
options:
max-size: "5m"
max-file: "1"
services:
gitea:
image: casjaysdevdocker/gitea:latest
pull_policy: always
container_name: casjaysdevdocker-gitea-latest
hostname: git.example.com
domainname: example.com
privileged: true
tty: true
restart: always
logging: *default-logging
cgroupns_mode: private
cap_add:
- CHOWN
- SYS_TIME
- SYS_ADMIN
environment:
- TZ=America/New_York
- HOSTNAME=git.example.com
- GITEA_PROTO=http
- DATABASE_DIR_SQLITE=/data/db/sqlite
TZ: ${TZ:-America/New_York}
CONTAINER_NAME: casjaysdevdocker-gitea-latest
HOSTNAME: ${BASE_HOST_NAME:-git.example.com}
GITEA_PROTO: http
DATABASE_DIR_SQLITE: /data/db/sqlite
volumes:
- /srv/docker/gitea/data:/data:z
- /srv/docker/gitea/config:/config:z
- /srv/docker/databases/sqlite/gitea:/data/db/sqlite:z
- ./volumes/data:/data:z
- ./volumes/config:/config:z
- ./volumes/db/sqlite:/data/db/sqlite:z
ports:
- 80:80
- 22:22
- "172.17.0.1:80:80"
- "172.17.0.1:22:22"
networks:
- gitea
networks:
gitea:
name: gitea
external: false
```
### Environment variables