diff --git a/docs/installation/with-docker-rootless.md b/docs/installation/with-docker-rootless.md index 9b0621e8..d2bfc0e6 100644 --- a/docs/installation/with-docker-rootless.md +++ b/docs/installation/with-docker-rootless.md @@ -8,15 +8,19 @@ aliases: # Installation with Docker (rootless) -Gitea provides automatically updated Docker images within its Docker Hub organization. It is -possible to always use the latest stable tag or to use another service that handles updating -Docker images. +## Relation to rootful image -The rootless image uses Gitea internal SSH to provide Git protocol and doesn't support OpenSSH. +* Rootless image doesn't require "root" privilege on the host, while it may have stricter UID/GID requirement. +* Rootless image must use its bulitin SSH server, while the rootful one must its managed standalone OpenSSH server. +* The volume mapping and directory layout is different between them. -This reference setup guides users through the setup based on `docker-compose`, but the installation -of `docker-compose` is out of scope of this documentation. To install `docker-compose` itself, follow -the official [install instructions](https://docs.docker.com/compose/install/). +Except the differences above, the rootless image shares the same mechanism with rootful image, +including: port mapping, custimzation, upgrading, environment variables, etc. +Read more in "[Installation with Docker (rootful)](./with-docker.md)" + +ATTENTION: the rootful/rootless images are not compatible with the other. +If you have chosen one, you should always use the same one, +don't switch to the other one by changing the compose file's `image` value. ## Basics @@ -34,8 +38,6 @@ touch docker-compose.yml Then paste the following content into a file named `docker-compose.yml`: ```yaml -version: "2" - services: server: image: docker.gitea.com/gitea:@dockerVersion@-rootless @@ -56,116 +58,16 @@ Note that the volume should be owned by the user/group with the UID/GID specifie sudo chown 1000:1000 config/ data/ ``` -> If you don't give the volume correct permissions, the container may not start. +> If you don't give the volume correct permissions, the container may present the following errors in the logs: + +```sh +server-1 | 2026-03-11T12:57:50.794102045Z mkdir: can't create directory '/var/lib/gitea/git': Permission denied +server-1 | 2026-03-11T12:57:50.796198843Z /var/lib/gitea/git is not writable +server-1 | 2026-03-11T12:57:50.796235667Z docker setup failed +``` For a stable release you could use `:latest-rootless`, `:1-rootless` or specify a certain release like `:@dockerVersion@-rootless`, but if you'd like to use the latest development version then `:nightly-rootless` would be an appropriate tag. If you'd like to run the latest commit from a release branch you can use the `:1.x-nightly-rootless` tag, where x is the minor version of Gitea. (e.g. `:1.16-nightly-rootless`) -## Custom port - -To bind the integrated ssh and the webserver on a different port, adjust -the port section. It's common to just change the host port and keep the ports within -the container like they are. - -```diff -version: "2" - -services: - server: - image: docker.gitea.com/gitea:@dockerVersion@-rootless - restart: always - volumes: - - ./data:/var/lib/gitea - - ./config:/etc/gitea - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: -- - "3000:3000" -- - "2222:2222" -+ - "80:3000" -+ - "22:2222" -``` - -## MySQL database - -To start Gitea in combination with a MySQL database, apply these changes to the -`docker-compose.yml` file created above. - -```diff -version: "2" - -services: - server: - image: docker.gitea.com/gitea:@dockerVersion@-rootless -+ environment: -+ - GITEA__database__DB_TYPE=mysql -+ - GITEA__database__HOST=db:3306 -+ - GITEA__database__NAME=gitea -+ - GITEA__database__USER=gitea -+ - GITEA__database__PASSWD=gitea - restart: always - volumes: - - ./data:/var/lib/gitea - - ./config:/etc/gitea - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: - - "3000:3000" - - "2222:2222" -+ depends_on: -+ - db -+ -+ db: -+ image: docker.io/library/mysql:8 -+ restart: always -+ environment: -+ - MYSQL_ROOT_PASSWORD=gitea -+ - MYSQL_USER=gitea -+ - MYSQL_PASSWORD=gitea -+ - MYSQL_DATABASE=gitea -+ volumes: -+ - ./mysql:/var/lib/mysql -``` - -## PostgreSQL database - -To start Gitea in combination with a PostgreSQL database, apply these changes to -the `docker-compose.yml` file created above. - -```diff -version: "2" - -services: - server: - image: docker.gitea.com/gitea:@dockerVersion@-rootless - environment: -+ - GITEA__database__DB_TYPE=postgres -+ - GITEA__database__HOST=db:5432 -+ - GITEA__database__NAME=gitea -+ - GITEA__database__USER=gitea -+ - GITEA__database__PASSWD=gitea - restart: always - volumes: - - ./data:/var/lib/gitea - - ./config:/etc/gitea - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: - - "3000:3000" - - "2222:2222" -+ depends_on: -+ - db -+ -+ db: -+ image: docker.io/library/postgres:14 -+ restart: always -+ environment: -+ - POSTGRES_USER=gitea -+ - POSTGRES_PASSWORD=gitea -+ - POSTGRES_DB=gitea -+ volumes: -+ - ./postgres:/var/lib/postgresql/data -``` - ## Named volumes To use named volumes instead of host volumes, define and use the named volume @@ -174,8 +76,6 @@ create the required volume. You don't need to worry about permissions with named volumes; Docker will deal with that automatically. ```diff -version: "2" - +volumes: + gitea-data: + driver: local @@ -207,8 +107,6 @@ As an example to clone the host user `git` definition use the command `id -u git Please make sure that the mounted folders are writable by the user. ```diff -version: "2" - services: server: image: docker.gitea.com/gitea:@dockerVersion@-rootless @@ -223,94 +121,3 @@ services: - "3000:3000" - "2222:2222" ``` - -## Startup - -:::note -From July 2023 Compose V1 stopped receiving updates. It's also no longer available in new releases of Docker Desktop. - -Compose V2 is included with all currently supported versions of Docker Desktop. Please use V2 to do below operations. -::: - -To start this setup based on `docker-compose`, execute `docker-compose up -d`, -to launch Gitea in the background. Using `docker-compose ps` will show if Gitea -started properly. Logs can be viewed with `docker-compose logs`. - -To shut down the setup, execute `docker-compose down`. This will stop -and kill the containers. The volumes will still exist. - -:::note -If using a non-3000 port on http, change app.ini to match -`LOCAL_ROOT_URL = http://localhost:3000/`. -::: - -## Install - -After starting the Docker setup via `docker-compose`, Gitea should be available using a -favorite browser to finalize the installation. Visit http://server-ip:3000 and follow the -installation wizard. If the database was started with the `docker-compose` setup as -documented above, please note that `db` must be used as the database hostname. - -## Customization - -Customization files described [here](../administration/customizing-gitea.md) should -be placed in `/var/lib/gitea/custom` directory. If using host volumes, it's quite easy to access these -files; for named volumes, this is done through another container or by direct access at -`/var/lib/docker/volumes/gitea_gitea/_/var_lib_gitea`. The configuration file will be saved at -`/etc/gitea/app.ini` after the installation. - -## Upgrading - -:::warning -:exclamation::exclamation: **Make sure you have volumed data to somewhere outside Docker container** :exclamation::exclamation: -::: - -To upgrade your installation to the latest release: - -```bash -# Edit `docker-compose.yml` to update the version, if you have one specified -# Pull new images -docker-compose pull -# Start a new container, automatically removes old one -docker-compose up -d -``` - -## Upgrading from standard image - -- Backup your setup -- Change volume mountpoint from /data to /var/lib/gitea -- If you used a custom app.ini move it to a new volume mounted to /etc/gitea -- Rename folder (inside volume) gitea to custom -- Edit app.ini if needed - - Set START_SSH_SERVER = true -- Use image docker.gitea.com/gitea:@dockerVersion@-rootless - -## Managing Deployments With Environment Variables - -In addition to the environment variables above, any settings in `app.ini` can be set -or overridden with an environment variable of the form: `GITEA__
__`. -These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes. - -These environment variables can be passed to the docker container in `docker-compose.yml`. -The following example will enable a smtp mail server if the required env variables -`GITEA__mailer__FROM`, `GITEA__mailer__HOST`, `GITEA__mailer__PASSWD` are set on the host -or in a `.env` file in the same directory as `docker-compose.yml`. - -The settings can be also set or overridden with the content of a file by defining an environment variable of the form: -`GITEA__section_name__KEY_NAME__FILE` that points to a file. - -```bash -... -services: - server: - environment: - - GITEA__mailer__ENABLED=true - - GITEA__mailer__FROM=${GITEA__mailer__FROM:?GITEA__mailer__FROM not set} - - GITEA__mailer__PROTOCOL=smtp - - GITEA__mailer__HOST=${GITEA__mailer__HOST:?GITEA__mailer__HOST not set} - - GITEA__mailer__IS_TLS_ENABLED=true - - GITEA__mailer__USER=${GITEA__mailer__USER:-apikey} - - GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}""" -``` - -To set required TOKEN and SECRET values, consider using Gitea's built-in [generate utility functions](../administration/command-line.md#generate). diff --git a/docs/installation/with-docker.md b/docs/installation/with-docker.md index b77921db..78821415 100644 --- a/docs/installation/with-docker.md +++ b/docs/installation/with-docker.md @@ -6,15 +6,22 @@ aliases: - /en-us/install-with-docker --- -# Installation with Docker +# Installation with Docker (rootful) Gitea provides automatically updated Docker images within its Docker Hub organization. It is possible to always use the latest stable tag or to use another service that handles updating Docker images. -This reference setup guides users through the setup based on docker `compose`-plugin, but the installation -of the docker `compose`-plugin is out of scope of this documentation. To install the docker `compose`-plugin itself, follow -the official [install instructions](https://docs.docker.com/compose/install/). +This reference setup guides users through the setup based on `docker compose`. +Docker compose has been included in the Docker Engine since the shift to Compose v2. +If, for some reason, compose is not available on your system, follow the official [install instructions](https://docs.docker.com/compose/install/). + +This document targets for the default rootful image. For the rootless image, +see "[Installation with Docker (rootless)](./with-docker-rootless.md)" + +ATTENTION: the rootful/rootless images are not compatible with the other. +If you have chosen one, you should always use the same one, +don't switch to the other one by changing the compose file's `image` value. ## Basics @@ -217,13 +224,7 @@ MySQL or PostgreSQL containers will need to be created separately. ## Startup -:::note -From July 2023 Compose V1 stopped receiving updates. It's also no longer available in new releases of Docker Desktop. - -Compose V2 is included with all currently supported versions of Docker Desktop. Please use V2 to do below operations. -::: - -To start this setup based on the docker `compose`-plugin, execute `docker compose up -d`, +To start this setup based on `docker compose`, execute `docker compose up -d`, to launch Gitea in the background. Using `docker compose ps` will show if Gitea started properly. Logs can be viewed with `docker compose logs`. @@ -237,9 +238,9 @@ If using a non-3000 port on http, change app.ini to match ## Installation -After starting the Docker setup via the docker `compose`-plugin, Gitea should be available using a +After starting the Docker setup via `docker compose`, Gitea should be available using a favorite browser to finalize the installation. Visit http://server-ip:3000 and follow the -installation wizard. If the database was started with the docker `compose`-plugin setup as +installation wizard. If the database was started with the `docker compose` setup as documented above, please note that `db` must be used as the database hostname. ## Configure the user inside Gitea using environment variables @@ -277,8 +278,10 @@ docker compose up -d ## Managing Deployments With Environment Variables In addition to the environment variables above, any settings in `app.ini` can be set -or overridden with an environment variable of the form: `GITEA__
__`. -These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes. +or overridden with an environment variable of the form: `GITEA__section_name__KEY_NAME=value`. +These settings are applied each time the docker container starts by `environment-to-ini` command +(a warpper of `gitea config edit-ini`), and won't be passed into Gitea's sub-processes. +See `./gitea config edit-ini --help` for more details. These environment variables can be passed to the docker container in `docker-compose.yml`. The following example will enable an smtp mail server if the required env variables @@ -321,5 +324,6 @@ services: ``` ### SSH with multiple IP addresses + This assumes that the host machine has more than one reachable IP address: `192.168.1.1` (host) `192.168.1.2` (gitea) On the host machine, configure SSHD in `/etc/ssh/sshd_config` to listen on one IP address `ListenAddress 192.168.1.1`. In the compose file the SSH port forwarding then needs to be changed to `"192.168.1.2:22:22"`. The port forwarding needs to be adjusted similarily for all other forwarded ports to avoid problems with DNS. diff --git a/versioned_docs/version-1.25/installation/with-docker-rootless.md b/versioned_docs/version-1.25/installation/with-docker-rootless.md index 3aa67178..d2bfc0e6 100644 --- a/versioned_docs/version-1.25/installation/with-docker-rootless.md +++ b/versioned_docs/version-1.25/installation/with-docker-rootless.md @@ -8,15 +8,19 @@ aliases: # Installation with Docker (rootless) -Gitea provides automatically updated Docker images within its Docker Hub organization. It is -possible to always use the latest stable tag or to use another service that handles updating -Docker images. +## Relation to rootful image -The rootless image uses Gitea internal SSH to provide Git protocol and doesn't support OpenSSH. +* Rootless image doesn't require "root" privilege on the host, while it may have stricter UID/GID requirement. +* Rootless image must use its bulitin SSH server, while the rootful one must its managed standalone OpenSSH server. +* The volume mapping and directory layout is different between them. -This reference setup guides users through the setup based on `docker-compose`, but the installation -of `docker-compose` is out of scope of this documentation. To install `docker-compose` itself, follow -the official [install instructions](https://docs.docker.com/compose/install/). +Except the differences above, the rootless image shares the same mechanism with rootful image, +including: port mapping, custimzation, upgrading, environment variables, etc. +Read more in "[Installation with Docker (rootful)](./with-docker.md)" + +ATTENTION: the rootful/rootless images are not compatible with the other. +If you have chosen one, you should always use the same one, +don't switch to the other one by changing the compose file's `image` value. ## Basics @@ -34,8 +38,6 @@ touch docker-compose.yml Then paste the following content into a file named `docker-compose.yml`: ```yaml -version: "2" - services: server: image: docker.gitea.com/gitea:@dockerVersion@-rootless @@ -56,116 +58,16 @@ Note that the volume should be owned by the user/group with the UID/GID specifie sudo chown 1000:1000 config/ data/ ``` -> If you don't give the volume correct permissions, the container may not start. +> If you don't give the volume correct permissions, the container may present the following errors in the logs: + +```sh +server-1 | 2026-03-11T12:57:50.794102045Z mkdir: can't create directory '/var/lib/gitea/git': Permission denied +server-1 | 2026-03-11T12:57:50.796198843Z /var/lib/gitea/git is not writable +server-1 | 2026-03-11T12:57:50.796235667Z docker setup failed +``` For a stable release you could use `:latest-rootless`, `:1-rootless` or specify a certain release like `:@dockerVersion@-rootless`, but if you'd like to use the latest development version then `:nightly-rootless` would be an appropriate tag. If you'd like to run the latest commit from a release branch you can use the `:1.x-nightly-rootless` tag, where x is the minor version of Gitea. (e.g. `:1.16-nightly-rootless`) -## Custom port - -To bind the integrated ssh and the webserver on a different port, adjust -the port section. It's common to just change the host port and keep the ports within -the container like they are. - -```diff -version: "2" - -services: - server: - image: docker.gitea.com/gitea:@dockerVersion@-rootless - restart: always - volumes: - - ./data:/var/lib/gitea - - ./config:/etc/gitea - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: -- - "3000:3000" -- - "2222:2222" -+ - "80:3000" -+ - "22:2222" -``` - -## MySQL database - -To start Gitea in combination with a MySQL database, apply these changes to the -`docker-compose.yml` file created above. - -```diff -version: "2" - -services: - server: - image: docker.gitea.com/gitea:@dockerVersion@-rootless -+ environment: -+ - GITEA__database__DB_TYPE=mysql -+ - GITEA__database__HOST=db:3306 -+ - GITEA__database__NAME=gitea -+ - GITEA__database__USER=gitea -+ - GITEA__database__PASSWD=gitea - restart: always - volumes: - - ./data:/var/lib/gitea - - ./config:/etc/gitea - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: - - "3000:3000" - - "2222:2222" -+ depends_on: -+ - db -+ -+ db: -+ image: docker.io/library/mysql:8 -+ restart: always -+ environment: -+ - MYSQL_ROOT_PASSWORD=gitea -+ - MYSQL_USER=gitea -+ - MYSQL_PASSWORD=gitea -+ - MYSQL_DATABASE=gitea -+ volumes: -+ - ./mysql:/var/lib/mysql -``` - -## PostgreSQL database - -To start Gitea in combination with a PostgreSQL database, apply these changes to -the `docker-compose.yml` file created above. - -```diff -version: "2" - -services: - server: - image: docker.gitea.com/gitea:@dockerVersion@-rootless - environment: -+ - GITEA__database__DB_TYPE=postgres -+ - GITEA__database__HOST=db:5432 -+ - GITEA__database__NAME=gitea -+ - GITEA__database__USER=gitea -+ - GITEA__database__PASSWD=gitea - restart: always - volumes: - - ./data:/var/lib/gitea - - ./config:/etc/gitea - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: - - "3000:3000" - - "2222:2222" -+ depends_on: -+ - db -+ -+ db: -+ image: docker.io/library/postgres:14 -+ restart: always -+ environment: -+ - POSTGRES_USER=gitea -+ - POSTGRES_PASSWORD=gitea -+ - POSTGRES_DB=gitea -+ volumes: -+ - ./postgres:/var/lib/postgresql/data -``` - ## Named volumes To use named volumes instead of host volumes, define and use the named volume @@ -174,8 +76,6 @@ create the required volume. You don't need to worry about permissions with named volumes; Docker will deal with that automatically. ```diff -version: "2" - +volumes: + gitea-data: + driver: local @@ -207,8 +107,6 @@ As an example to clone the host user `git` definition use the command `id -u git Please make sure that the mounted folders are writable by the user. ```diff -version: "2" - services: server: image: docker.gitea.com/gitea:@dockerVersion@-rootless @@ -223,95 +121,3 @@ services: - "3000:3000" - "2222:2222" ``` - -## Startup - -:::note -From July 2023 Compose V1 stopped receiving updates. It's also no longer available in new releases of Docker Desktop. - -Compose V2 is included with all currently supported versions of Docker Desktop. Please use V2 to do below operations. -::: - -To start this setup based on `docker-compose`, execute `docker-compose up -d`, -to launch Gitea in the background. Using `docker-compose ps` will show if Gitea -started properly. Logs can be viewed with `docker-compose logs`. - -To shut down the setup, execute `docker-compose down`. This will stop -and kill the containers. The volumes will still exist. - -:::note -If using a non-3000 port on http, change app.ini to match -`LOCAL_ROOT_URL = http://localhost:3000/`. -::: - -## Install - -After starting the Docker setup via `docker-compose`, Gitea should be available using a -favorite browser to finalize the installation. Visit http://server-ip:3000 and follow the -installation wizard. If the database was started with the `docker-compose` setup as -documented above, please note that `db` must be used as the database hostname. - -## Customization - -Customization files described [here](../administration/customizing-gitea.md) should -be placed in `/var/lib/gitea/custom` directory. If using host volumes, it's quite easy to access these -files; for named volumes, this is done through another container or by direct access at -`/var/lib/docker/volumes/gitea_gitea/_/var_lib_gitea`. The configuration file will be saved at -`/etc/gitea/app.ini` after the installation. - -## Upgrading - -:::warning -:exclamation::exclamation: **Make sure you have volumed data to somewhere outside Docker container** :exclamation::exclamation: -::: - -To upgrade your installation to the latest release: - -```bash -# Edit `docker-compose.yml` to update the version, if you have one specified -# Pull new images -docker-compose pull -# Start a new container, automatically removes old one -docker-compose up -d -``` - -## Upgrading from standard image - -- Backup your setup -- Change volume mountpoint from /data to /var/lib/gitea -- If you used a custom app.ini move it to a new volume mounted to /etc/gitea -- Rename folder (inside volume) gitea to custom -- Edit app.ini if needed - - Set START_SSH_SERVER = true -- Use image docker.gitea.com/gitea:@dockerVersion@-rootless - -## Managing Deployments With Environment Variables - -In addition to the environment variables above, any settings in `app.ini` can be set -or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`. -These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes. -Full information [here](https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini). - -These environment variables can be passed to the docker container in `docker-compose.yml`. -The following example will enable a smtp mail server if the required env variables -`GITEA__mailer__FROM`, `GITEA__mailer__HOST`, `GITEA__mailer__PASSWD` are set on the host -or in a `.env` file in the same directory as `docker-compose.yml`. - -The settings can be also set or overridden with the content of a file by defining an environment variable of the form: -`GITEA__section_name__KEY_NAME__FILE` that points to a file. - -```bash -... -services: - server: - environment: - - GITEA__mailer__ENABLED=true - - GITEA__mailer__FROM=${GITEA__mailer__FROM:?GITEA__mailer__FROM not set} - - GITEA__mailer__PROTOCOL=smtp - - GITEA__mailer__HOST=${GITEA__mailer__HOST:?GITEA__mailer__HOST not set} - - GITEA__mailer__IS_TLS_ENABLED=true - - GITEA__mailer__USER=${GITEA__mailer__USER:-apikey} - - GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}""" -``` - -To set required TOKEN and SECRET values, consider using Gitea's built-in [generate utility functions](../administration/command-line.md#generate). diff --git a/versioned_docs/version-1.25/installation/with-docker.md b/versioned_docs/version-1.25/installation/with-docker.md index 82925f5b..78821415 100644 --- a/versioned_docs/version-1.25/installation/with-docker.md +++ b/versioned_docs/version-1.25/installation/with-docker.md @@ -6,15 +6,22 @@ aliases: - /en-us/install-with-docker --- -# Installation with Docker +# Installation with Docker (rootful) Gitea provides automatically updated Docker images within its Docker Hub organization. It is possible to always use the latest stable tag or to use another service that handles updating Docker images. -This reference setup guides users through the setup based on `docker-compose`, but the installation -of `docker-compose` is out of scope of this documentation. To install `docker-compose` itself, follow -the official [install instructions](https://docs.docker.com/compose/install/). +This reference setup guides users through the setup based on `docker compose`. +Docker compose has been included in the Docker Engine since the shift to Compose v2. +If, for some reason, compose is not available on your system, follow the official [install instructions](https://docs.docker.com/compose/install/). + +This document targets for the default rootful image. For the rootless image, +see "[Installation with Docker (rootless)](./with-docker-rootless.md)" + +ATTENTION: the rootful/rootless images are not compatible with the other. +If you have chosen one, you should always use the same one, +don't switch to the other one by changing the compose file's `image` value. ## Basics @@ -26,8 +33,6 @@ If you don't give the volume correct permissions, the container may not start. For a stable release you can use `:latest`, `:1` or specify a certain release like `:@dockerVersion@`, but if you'd like to use the latest development version of Gitea then you could use the `:nightly` tag. If you'd like to run the latest commit from a release branch you can use the `:1.x-nightly` tag, where x is the minor version of Gitea. (e.g. `:1.16-nightly`) ```yaml -version: "3" - networks: gitea: external: false @@ -58,8 +63,6 @@ the port section. It's common to just change the host port and keep the ports wi the container like they are. ```diff -version: "3" - networks: gitea: external: false @@ -93,8 +96,6 @@ To start Gitea in combination with a MySQL database, apply these changes to the `docker-compose.yml` file created above. ```diff -version: "3" - networks: gitea: external: false @@ -144,8 +145,6 @@ To start Gitea in combination with a PostgreSQL database, apply these changes to the `docker-compose.yml` file created above. ```diff -version: "3" - networks: gitea: external: false @@ -196,8 +195,6 @@ create the required volume. You don't need to worry about permissions with named volumes; Docker will deal with that automatically. ```diff -version: "3" - networks: gitea: external: false @@ -227,17 +224,11 @@ MySQL or PostgreSQL containers will need to be created separately. ## Startup -:::note -From July 2023 Compose V1 stopped receiving updates. It's also no longer available in new releases of Docker Desktop. +To start this setup based on `docker compose`, execute `docker compose up -d`, +to launch Gitea in the background. Using `docker compose ps` will show if Gitea +started properly. Logs can be viewed with `docker compose logs`. -Compose V2 is included with all currently supported versions of Docker Desktop. Please use V2 to do below operations. -::: - -To start this setup based on `docker-compose`, execute `docker-compose up -d`, -to launch Gitea in the background. Using `docker-compose ps` will show if Gitea -started properly. Logs can be viewed with `docker-compose logs`. - -To shut down the setup, execute `docker-compose down`. This will stop +To shut down the setup, execute `docker compose down`. This will stop and kill the containers. The volumes will still exist. :::note @@ -247,9 +238,9 @@ If using a non-3000 port on http, change app.ini to match ## Installation -After starting the Docker setup via `docker-compose`, Gitea should be available using a +After starting the Docker setup via `docker compose`, Gitea should be available using a favorite browser to finalize the installation. Visit http://server-ip:3000 and follow the -installation wizard. If the database was started with the `docker-compose` setup as +installation wizard. If the database was started with the `docker compose` setup as documented above, please note that `db` must be used as the database hostname. ## Configure the user inside Gitea using environment variables @@ -279,17 +270,18 @@ To upgrade your installation to the latest release: ```bash # Edit `docker-compose.yml` to update the version, if you have one specified # Pull new images -docker-compose pull +docker compose pull # Start a new container, automatically removes old one -docker-compose up -d +docker compose up -d ``` ## Managing Deployments With Environment Variables In addition to the environment variables above, any settings in `app.ini` can be set -or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`. -These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes. -Full information [here](https://github.com/go-gitea/gitea/blob/0d740a6a7231b254306d0b1513ff27e32646cd5e/contrib/environment-to-ini/README). +or overridden with an environment variable of the form: `GITEA__section_name__KEY_NAME=value`. +These settings are applied each time the docker container starts by `environment-to-ini` command +(a warpper of `gitea config edit-ini`), and won't be passed into Gitea's sub-processes. +See `./gitea config edit-ini --help` for more details. These environment variables can be passed to the docker container in `docker-compose.yml`. The following example will enable an smtp mail server if the required env variables @@ -332,5 +324,6 @@ services: ``` ### SSH with multiple IP addresses + This assumes that the host machine has more than one reachable IP address: `192.168.1.1` (host) `192.168.1.2` (gitea) On the host machine, configure SSHD in `/etc/ssh/sshd_config` to listen on one IP address `ListenAddress 192.168.1.1`. In the compose file the SSH port forwarding then needs to be changed to `"192.168.1.2:22:22"`. The port forwarding needs to be adjusted similarily for all other forwarded ports to avoid problems with DNS.