mirror of
https://github.com/nextcloud/docker.git
synced 2025-07-27 17:08:05 +02:00
Compare commits
15 commits
e8934b0de2
...
ceb28bbc79
Author | SHA1 | Date | |
---|---|---|---|
|
ceb28bbc79 | ||
|
aaa667ad0d | ||
|
cb8afbbe60 | ||
|
090934d9b0 | ||
|
9b245ac4a1 | ||
|
24b6769682 | ||
|
7e188da4fa | ||
|
60f205abea | ||
|
e3dc1f3d62 | ||
|
9395077d11 | ||
|
abf51f1cd7 | ||
|
9b63f3e4dc | ||
|
7403dcda6b | ||
|
fb63647e7e | ||
|
0be52642ec |
10 changed files with 67 additions and 6 deletions
|
@ -23,6 +23,7 @@ services:
|
||||||
- 127.0.0.1:8080:80
|
- 127.0.0.1:8080:80
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_HOST=db
|
- MYSQL_HOST=db
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
|
@ -37,6 +38,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -21,6 +21,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_HOST=db
|
- MYSQL_HOST=db
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
|
@ -37,6 +38,7 @@ services:
|
||||||
- 127.0.0.1:8080:80
|
- 127.0.0.1:8080:80
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z,ro
|
- nextcloud:/var/www/html:z,ro
|
||||||
|
# NOTE: The `volumes` included here should match those of the `app` container (unless you know what you're doing)
|
||||||
depends_on:
|
depends_on:
|
||||||
- app
|
- app
|
||||||
|
|
||||||
|
@ -45,6 +47,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -18,6 +18,7 @@ services:
|
||||||
- 127.0.0.1:8080:80
|
- 127.0.0.1:8080:80
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_HOST=db
|
- POSTGRES_HOST=db
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
|
@ -32,6 +33,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -16,6 +16,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_HOST=db
|
- POSTGRES_HOST=db
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
|
@ -32,6 +33,7 @@ services:
|
||||||
- 127.0.0.1:8080:80
|
- 127.0.0.1:8080:80
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z,ro
|
- nextcloud:/var/www/html:z,ro
|
||||||
|
# NOTE: The `volumes` included here should match those of the `app` container (unless you know what you're doing)
|
||||||
depends_on:
|
depends_on:
|
||||||
- app
|
- app
|
||||||
|
|
||||||
|
@ -40,6 +42,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -21,6 +21,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- VIRTUAL_HOST=
|
- VIRTUAL_HOST=
|
||||||
- LETSENCRYPT_HOST=
|
- LETSENCRYPT_HOST=
|
||||||
|
@ -45,6 +46,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -21,6 +21,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_HOST=db
|
- MYSQL_HOST=db
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
|
@ -36,6 +37,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z,ro
|
- nextcloud:/var/www/html:z,ro
|
||||||
|
# NOTE: The `volumes` included here should match those of the `app` container (unless you know what you're doing)
|
||||||
environment:
|
environment:
|
||||||
- VIRTUAL_HOST=
|
- VIRTUAL_HOST=
|
||||||
- LETSENCRYPT_HOST=
|
- LETSENCRYPT_HOST=
|
||||||
|
@ -51,6 +53,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -16,6 +16,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- VIRTUAL_HOST=
|
- VIRTUAL_HOST=
|
||||||
- LETSENCRYPT_HOST=
|
- LETSENCRYPT_HOST=
|
||||||
|
@ -37,6 +38,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -18,6 +18,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_HOST=db
|
- POSTGRES_HOST=db
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
|
@ -33,6 +34,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z,ro
|
- nextcloud:/var/www/html:z,ro
|
||||||
|
# NOTE: The `volumes` included here should match those of the `app` container (unless you know what you're doing)
|
||||||
environment:
|
environment:
|
||||||
- VIRTUAL_HOST=
|
- VIRTUAL_HOST=
|
||||||
- LETSENCRYPT_HOST=
|
- LETSENCRYPT_HOST=
|
||||||
|
@ -48,6 +50,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html:z
|
- nextcloud:/var/www/html:z
|
||||||
|
# NOTE: The `volumes` config of the `cron` and `app` containers must match
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
29
README.md
29
README.md
|
@ -103,7 +103,8 @@ If mounting additional volumes under `/var/www/html`, you should consider:
|
||||||
You should note that data inside the main folder (`/var/www/html`) will be overridden/removed during installation and upgrades, unless listed in [upgrade.exclude](https://github.com/nextcloud/docker/blob/master/upgrade.exclude). The additional volumes officially supported are already in that list, but custom volumes will need to be added by you. We suggest mounting custom storage volumes outside of `/var/www/html` and if possible read-only so that making this adjustment is unnecessary. If you must do so, however, you may build a custom image with a modified `/upgrade.exclude` file that incorporates your custom volume(s).
|
You should note that data inside the main folder (`/var/www/html`) will be overridden/removed during installation and upgrades, unless listed in [upgrade.exclude](https://github.com/nextcloud/docker/blob/master/upgrade.exclude). The additional volumes officially supported are already in that list, but custom volumes will need to be added by you. We suggest mounting custom storage volumes outside of `/var/www/html` and if possible read-only so that making this adjustment is unnecessary. If you must do so, however, you may build a custom image with a modified `/upgrade.exclude` file that incorporates your custom volume(s).
|
||||||
|
|
||||||
|
|
||||||
## Using the Nextcloud command-line interface
|
## Using the Nextcloud command-line interface (`occ`)
|
||||||
|
|
||||||
To use the [Nextcloud command-line interface](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html) (aka. `occ` command):
|
To use the [Nextcloud command-line interface](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html) (aka. `occ` command):
|
||||||
```console
|
```console
|
||||||
$ docker exec --user www-data CONTAINER_ID php occ
|
$ docker exec --user www-data CONTAINER_ID php occ
|
||||||
|
@ -112,6 +113,23 @@ or for docker compose:
|
||||||
```console
|
```console
|
||||||
$ docker compose exec --user www-data app php occ
|
$ docker compose exec --user www-data app php occ
|
||||||
```
|
```
|
||||||
|
or even shorter:
|
||||||
|
```console
|
||||||
|
$ docker compose exec -u33 app ./occ
|
||||||
|
```
|
||||||
|
Note: substitute `82` for `33` if using the Alpine-based images.
|
||||||
|
|
||||||
|
## Viewing the Nextcloud configuration (`config.php`)
|
||||||
|
|
||||||
|
The image takes advantage of Nextcloud's [Multiple config.php support](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file) to inject auto configuration environment variables and set image specific config values.
|
||||||
|
|
||||||
|
This means that merely viewing your `config.php` will not give you an accurate view of your running config. Instead, you should use Nextcloud's [`occ config:list system` command](https://docs.nextcloud.com/server/latest/admin_manual/occ_command.html#config-commands-label) to get get a complete view of your merged configuration. This has the added benefit of automatically omitting sensitive values such as passwords and secrets from the output by default (e.g. useful for shared publicly or assisting others when troubleshooting or reporting a bug).
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker compose exec -u33 app ./occ config:list system
|
||||||
|
```
|
||||||
|
|
||||||
|
The `--private` flag can also be specified, in order to output all configuration values including passwords and secrets.
|
||||||
|
|
||||||
## Auto configuration via environment variables
|
## Auto configuration via environment variables
|
||||||
The Nextcloud image supports auto configuration via environment variables. You can preconfigure everything that is asked on the install page on first run. To enable auto configuration, set your database connection via the following environment variables. You must specify all of the environment variables for a given database or the database environment variables defaults to SQLITE. ONLY use one database type!
|
The Nextcloud image supports auto configuration via environment variables. You can preconfigure everything that is asked on the install page on first run. To enable auto configuration, set your database connection via the following environment variables. You must specify all of the environment variables for a given database or the database environment variables defaults to SQLITE. ONLY use one database type!
|
||||||
|
@ -631,6 +649,15 @@ docker exec container-name chown -R www-data:root /var/www/html
|
||||||
```
|
```
|
||||||
|
|
||||||
After changing the permissions, restart the container and the permission errors should disappear.
|
After changing the permissions, restart the container and the permission errors should disappear.
|
||||||
|
|
||||||
|
# Troubleshooting
|
||||||
|
|
||||||
|
The Nextcloud image entrypoint supports a debug (verbose) mode that can be toggled on via an environment variable. This can be used to troubleshoot container start-up, Nextcloud installation, entrypoint changes, etc.
|
||||||
|
|
||||||
|
- `IMAGE_DEBUG=1`
|
||||||
|
|
||||||
|
Note the container log will be highly verbose with this on!
|
||||||
|
|
||||||
# Help (Questions / Issues)
|
# Help (Questions / Issues)
|
||||||
|
|
||||||
**If you have any questions or problems while using the image, please ask for assistance on the Help Forum first (https://help.nextcloud.com)**.
|
**If you have any questions or problems while using the image, please ask for assistance on the Help Forum first (https://help.nextcloud.com)**.
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
if [ -n "${IMAGE_DEBUG+x}" ]; then
|
||||||
|
echo "**Image debugging enabled**"
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
# version_greater A B returns whether A > B
|
||||||
version_greater() {
|
version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
|
@ -165,10 +170,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
echo "Upgrading nextcloud from $installed_version ..."
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
fi
|
fi
|
||||||
|
rsync_options=''
|
||||||
|
if [ -n "${IMAGE_DEBUG+x}" ]; then
|
||||||
|
rsync_options='-vv'
|
||||||
|
fi
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
rsync_options="-rlDog --chown $user:$group"
|
rsync_options="$rsync_options -rlDog --chown $user:$group"
|
||||||
else
|
else
|
||||||
rsync_options="-rlD"
|
rsync_options="$rsync_options -rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -188,8 +197,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
install_options=''
|
||||||
|
if [ -n "${IMAGE_DEBUG+x}" ]; then
|
||||||
|
install_options='-v '
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
install_options=$install_options'-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
@ -227,9 +240,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
try=0
|
try=0
|
||||||
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
|
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
|
||||||
do
|
do
|
||||||
echo "Retrying install..."
|
echo "Nextcloud installation failed; will retry in 10s..."
|
||||||
try=$((try+1))
|
try=$((try+1))
|
||||||
sleep 10s
|
sleep 10s
|
||||||
|
echo "Retrying nextcloud install now... ($try of $max_retries attempts)"
|
||||||
done
|
done
|
||||||
if [ "$try" -gt "$max_retries" ]; then
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
echo "Installing of nextcloud failed!"
|
echo "Installing of nextcloud failed!"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue