Merge pull request #406 from nextcloud/cleanup

Small cleanups
This commit is contained in:
Tilo Spannagel 2018-08-03 08:04:02 +02:00 committed by GitHub
commit 31878f1f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 116 additions and 116 deletions

View File

@ -1,7 +1,7 @@
# Examples section # Examples section
In this subfolders are some examples how to use the docker image. There are two sections: In this subfolders are some examples how to use the docker image. There are two sections:
* [`dockerfiles`](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles) * [`dockerfiles`](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles)
* [`docker-compose`](https://github.com/nextcloud/docker/tree/master/.examples/docker-compose) * [`docker-compose`](https://github.com/nextcloud/docker/tree/master/.examples/docker-compose)

View File

@ -16,7 +16,7 @@ services:
image: redis image: redis
restart: always restart: always
app: app:
build: ./app build: ./app
restart: always restart: always
ports: ports:

View File

@ -16,7 +16,7 @@ services:
image: redis image: redis
restart: always restart: always
app: app:
build: ./app build: ./app
restart: always restart: always
volumes: volumes:

View File

@ -12,7 +12,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:apache image: nextcloud:apache
restart: always restart: always
ports: ports:

View File

@ -12,7 +12,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:fpm image: nextcloud:fpm
restart: always restart: always
volumes: volumes:

View File

@ -9,7 +9,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:apache image: nextcloud:apache
restart: always restart: always
ports: ports:

View File

@ -9,7 +9,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:fpm image: nextcloud:fpm
restart: always restart: always
volumes: volumes:

View File

@ -12,7 +12,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:fpm image: nextcloud:fpm
restart: always restart: always
volumes: volumes:

View File

@ -16,7 +16,7 @@ services:
image: redis image: redis
restart: always restart: always
app: app:
build: ./app build: ./app
restart: always restart: always
volumes: volumes:

View File

@ -16,7 +16,7 @@ services:
image: redis image: redis
restart: always restart: always
app: app:
build: ./app build: ./app
restart: always restart: always
volumes: volumes:

View File

@ -12,7 +12,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:apache image: nextcloud:apache
restart: always restart: always
volumes: volumes:

View File

@ -12,7 +12,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:fpm image: nextcloud:fpm
restart: always restart: always
volumes: volumes:

View File

@ -9,7 +9,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:apache image: nextcloud:apache
restart: always restart: always
volumes: volumes:

View File

@ -9,7 +9,7 @@ services:
env_file: env_file:
- db.env - db.env
app: app:
image: nextcloud:fpm image: nextcloud:fpm
restart: always restart: always
volumes: volumes:

View File

@ -10,7 +10,7 @@ dirs=( "${dirs[@]%/}" )
for dir in "${dirs[@]}"; do for dir in "${dirs[@]}"; do
if [ -d "$dir/$VARIANT" ]; then if [ -d "$dir/$VARIANT" ]; then
( (
cd "$dir/$VARIANT" cd "$dir/$VARIANT"
sed -ri -e 's/^FROM .*/FROM '"$image"'/g' 'Dockerfile' sed -ri -e 's/^FROM .*/FROM '"$image"'/g' 'Dockerfile'
docker build -t "$image-$dir" . docker build -t "$image-$dir" .
~/official-images/test/run.sh "$image-$dir" ~/official-images/test/run.sh "$image-$dir"

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -29,7 +29,7 @@ Now you can access Nextcloud at http://localhost:8080/ from your host system.
## Using the fpm image ## Using the fpm image
To use the fpm image you need an additional web server that can proxy http-request to the fpm-port of the container. For fpm connection this container exposes port 9000. In most cases you might want use another container or your host as proxy. To use the fpm image you need an additional web server that can proxy http-request to the fpm-port of the container. For fpm connection this container exposes port 9000. In most cases you might want use another container or your host as proxy.
If you use your host you can address your Nextcloud container directly on port 9000. If you use another container, make sure that you add them to the same docker network (via `docker run --network <NAME> ...` or a `docker-compose` file). If you use your host you can address your Nextcloud container directly on port 9000. If you use another container, make sure that you add them to the same docker network (via `docker run --network <NAME> ...` or a `docker-compose` file).
In both cases you don't want to map the fpm port to you host. In both cases you don't want to map the fpm port to you host.
```console ```console
$ docker run -d nextcloud:fpm $ docker run -d nextcloud:fpm
@ -62,7 +62,7 @@ $ docker run -d \
mariadb mariadb
``` ```
If you want to get fine grained access to your individual files, you can mount additional volumes for data, config, your theme and custom apps. If you want to get fine grained access to your individual files, you can mount additional volumes for data, config, your theme and custom apps.
The `data`, `config` are stored in respective subfolders inside `/var/www/html/`. The apps are split into core `apps` (which are shipped with Nextcloud and you don't need to take care of) and a `custom_apps` folder. If you use a custom theme it would go into the `themes` subfolder. The `data`, `config` are stored in respective subfolders inside `/var/www/html/`. The apps are split into core `apps` (which are shipped with Nextcloud and you don't need to take care of) and a `custom_apps` folder. If you use a custom theme it would go into the `themes` subfolder.
Overview of the folders that can be mounted as volumes: Overview of the folders that can be mounted as volumes:
@ -101,7 +101,7 @@ __SQLITE_DATABASE__:
- `SQLITE_DATABASE` Name of the database using sqlite - `SQLITE_DATABASE` Name of the database using sqlite
__MYSQL/MariaDB__: __MYSQL/MariaDB__:
- `MYSQL_DATABASE` Name of the database using mysql / mariadb. - `MYSQL_DATABASE` Name of the database using mysql / mariadb.
- `MYSQL_USER` Username for the database using mysql / mariadb. - `MYSQL_USER` Username for the database using mysql / mariadb.
- `MYSQL_PASSWORD` Password for the database user using mysql / mariadb. - `MYSQL_PASSWORD` Password for the database user using mysql / mariadb.
- `MYSQL_HOST` Hostname of the database server using mysql / mariadb. - `MYSQL_HOST` Hostname of the database server using mysql / mariadb.
@ -124,12 +124,12 @@ If you want you can set the data directory and table prefix, otherwise default v
# Running this image with docker-compose # Running this image with docker-compose
The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for. The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for.
At first make sure you have chosen the right base image (fpm or apache) and added the features you wanted (see below). In every case you want to add a database container and docker volumes to get easy access to your persistent data. When you want to have your server reachable from the internet adding HTTPS-encryption is mandatory! See below for more information. At first make sure you have chosen the right base image (fpm or apache) and added the features you wanted (see below). In every case you want to add a database container and docker volumes to get easy access to your persistent data. When you want to have your server reachable from the internet adding HTTPS-encryption is mandatory! See below for more information.
## Base version - apache ## Base version - apache
This version will use the apache image and add a mariaDB container. The volumes are set to keep your data persistent. This setup provides **no ssl encryption** and is intended to run behind a proxy. This version will use the apache image and add a mariaDB container. The volumes are set to keep your data persistent. This setup provides **no ssl encryption** and is intended to run behind a proxy.
Make sure to set the variables `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` before you run this setup. Make sure to set the variables `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` before you run this setup.
@ -152,7 +152,7 @@ services:
- MYSQL_DATABASE=nextcloud - MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud - MYSQL_USER=nextcloud
app: app:
image: nextcloud image: nextcloud
ports: ports:
- 8080:80 - 8080:80
@ -169,7 +169,7 @@ Then run `docker-compose up -d`, now you can access Nextcloud at http://localhos
## Base version - FPM ## Base version - FPM
When using the FPM image you need another container that acts as web server on port 80 and proxies the requests to the Nextcloud container. In this example a simple nginx container is combined with the Nextcloud-fpm image and a MariaDB database container. The data is stored in docker volumes. The nginx container also need access to static files from your Nextcloud installation. It gets access to all the volumes mounted to Nextcloud via the `volumes_from` option.The configuration for nginx is stored in the configuration file `nginx.conf`, that is mounted into the container. An example can be found in the examples section [here](https://github.com/nextcloud/docker/tree/master/.examples). When using the FPM image you need another container that acts as web server on port 80 and proxies the requests to the Nextcloud container. In this example a simple nginx container is combined with the Nextcloud-fpm image and a MariaDB database container. The data is stored in docker volumes. The nginx container also need access to static files from your Nextcloud installation. It gets access to all the volumes mounted to Nextcloud via the `volumes_from` option.The configuration for nginx is stored in the configuration file `nginx.conf`, that is mounted into the container. An example can be found in the examples section [here](https://github.com/nextcloud/docker/tree/master/.examples).
As this setup does **not include encryption** it should to be run behind a proxy. As this setup does **not include encryption** it should to be run behind a proxy.
Make sure to set the variables `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` before you run this setup. Make sure to set the variables `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` before you run this setup.
@ -219,7 +219,7 @@ Then run `docker-compose up -d`, now you can access Nextcloud at http://localhos
Until here your Nextcloud is just available from you docker host. If you want you Nextcloud available from the internet adding SSL encryption is mandatory. Until here your Nextcloud is just available from you docker host. If you want you Nextcloud available from the internet adding SSL encryption is mandatory.
## HTTPS - SSL encryption ## HTTPS - SSL encryption
There are many different possibilities to introduce encryption depending on your setup. There are many different possibilities to introduce encryption depending on your setup.
We recommend using a reverse proxy in front of our Nextcloud installation. Your Nextcloud will only be reachable through the proxy, which encrypts all traffic to the clients. You can mount your manually generated certificates to the proxy or use a fully automated solution, which generates and renews the certificates for you. We recommend using a reverse proxy in front of our Nextcloud installation. Your Nextcloud will only be reachable through the proxy, which encrypts all traffic to the clients. You can mount your manually generated certificates to the proxy or use a fully automated solution, which generates and renews the certificates for you.
@ -229,7 +229,7 @@ In our [examples](https://github.com/nextcloud/docker/tree/master/.examples) sec
When you first access your Nextcloud, the setup wizard will appear and ask you to choose an administrator account, password and the database connection. For the database use `db` as host and `nextcloud` as table and user name. Also enter the password you chose in your `docker-compose.yml` file. When you first access your Nextcloud, the setup wizard will appear and ask you to choose an administrator account, password and the database connection. For the database use `db` as host and `nextcloud` as table and user name. Also enter the password you chose in your `docker-compose.yml` file.
# Update to a newer version # Update to a newer version
Updating the Nextcloud container is done by pulling the new image, throwing away the old container and starting the new one. Since all data is stored in volumes, nothing gets lost. The startup script will check for the version in your volume and the installed docker version. If it finds a mismatch, it automatically starts the upgrade process. Don't forget to add all the volumes to your new container, so it works as expected. Updating the Nextcloud container is done by pulling the new image, throwing away the old container and starting the new one. Since all data is stored in volumes, nothing gets lost. The startup script will check for the version in your volume and the installed docker version. If it finds a mismatch, it automatically starts the upgrade process. Don't forget to add all the volumes to your new container, so it works as expected.
```console ```console
$ docker pull nextcloud $ docker pull nextcloud
@ -257,7 +257,7 @@ FROM nextcloud:apache
RUN ... RUN ...
``` ```
The [examples folder](https://github.com/nextcloud/docker/blob/master/.examples) gives a few examples on how to add certain functionalities, like including the cron job, smb-support or imap-authentication. The [examples folder](https://github.com/nextcloud/docker/blob/master/.examples) gives a few examples on how to add certain functionalities, like including the cron job, smb-support or imap-authentication.
If you use your own Dockerfile you need to configure your docker-compose file accordingly. Switch out the `image` option with `build`. You have to specify the path to your Dockerfile. (in the example it's in the same directory next to the docker-compose file) If you use your own Dockerfile you need to configure your docker-compose file accordingly. Switch out the `image` option with `build`. You have to specify the path to your Dockerfile. (in the example it's in the same directory next to the docker-compose file)
@ -276,7 +276,7 @@ If you use your own Dockerfile you need to configure your docker-compose file ac
**Updating** your own derived image is also very simple. When a new version of the Nextcloud image is available run: **Updating** your own derived image is also very simple. When a new version of the Nextcloud image is available run:
```console ```console
docker build -t your-name --pull . docker build -t your-name --pull .
docker run -d your-name docker run -d your-name
``` ```
@ -299,10 +299,10 @@ docker-compose exec db sh -c "mysql -u USER -pPASSWORD nextcloud < /dmp"
docker-compose exec db rm /dmp docker-compose exec db rm /dmp
``` ```
3. Edit your config.php 3. Edit your config.php
1. Set database connection 1. Set database connection
```php ```php
'dbhost' => 'db:3306', 'dbhost' => 'db:3306',
``` ```
2. Make sure you have no configuration for the `apps_paths`. Delete lines like these 2. Make sure you have no configuration for the `apps_paths`. Delete lines like these
```diff ```diff
- "apps_paths" => array ( - "apps_paths" => array (
@ -316,7 +316,7 @@ docker-compose exec db rm /dmp
```php ```php
'datadirectory' => '/var/www/html/data', 'datadirectory' => '/var/www/html/data',
``` ```
4. Copy your data (nextcloud_app_1 is the name of your Nextcloud container): 4. Copy your data (nextcloud_app_1 is the name of your Nextcloud container):
```console ```console
@ -328,10 +328,10 @@ docker cp ./config/config.php nextcloud_app_1:/var/www/html/config
docker-compose exec app chown -R www-data:www-data /var/www/html/config docker-compose exec app chown -R www-data:www-data /var/www/html/config
``` ```
5. Copy only the custom apps you use (or simply redownload them from the web interface): 5. Copy only the custom apps you use (or simply redownload them from the web interface):
```console ```console
docker cp ./apps/ nextcloud_data:/var/www/html/custom_apps docker cp ./apps/ nextcloud_data:/var/www/html/custom_apps
docker-compose exec app chown -R www-data:www-data /var/www/html/custom_apps docker-compose exec app chown -R www-data:www-data /var/www/html/custom_apps
``` ```
# Questions / Issues # Questions / Issues
If you got any questions or problems using the image, please visit our [Github Repository](https://github.com/nextcloud/docker) and write an issue. If you got any questions or problems using the image, please visit our [Github Repository](https://github.com/nextcloud/docker) and write an issue.

View File

@ -3,7 +3,7 @@ set -eu
# 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" ]
} }
# return true if specified directory is empty # return true if specified directory is empty
@ -12,11 +12,11 @@ directory_empty() {
} }
run_as() { run_as() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
su - www-data -s /bin/sh -c "$1" su - www-data -s /bin/sh -c "$1"
else else
sh -c "$1" sh -c "$1"
fi fi
} }
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -37,9 +37,9 @@ if version_greater "$image_version" "$installed_version"; then
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
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root" rsync_options="-rlDog --chown www-data:root"
else else
rsync_options="-rlD" rsync_options="-rlD"
fi fi
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/

View File

@ -60,8 +60,8 @@ function create_variant() {
# Create the version+variant directory with a Dockerfile. # Create the version+variant directory with a Dockerfile.
mkdir -p "$dir" mkdir -p "$dir"
template="Dockerfile-${base[$variant]}.template" template="Dockerfile-${base[$variant]}.template"
echo "# DO NOT EDIT: created by update.sh from $template" > "$dir/Dockerfile" echo "# DO NOT EDIT: created by update.sh from $template" > "$dir/Dockerfile"
cat "$template" >> "$dir/Dockerfile" cat "$template" >> "$dir/Dockerfile"
echo "updating $fullversion [$1] $variant" echo "updating $fullversion [$1] $variant"
@ -110,7 +110,7 @@ for version in "${versions[@]}"; do
if version_greater_or_equal "$version" "$min_version"; then if version_greater_or_equal "$version" "$min_version"; then
for variant in "${variants[@]}"; do for variant in "${variants[@]}"; do
create_variant "$version" "https:\/\/download.nextcloud.com\/server\/releases" create_variant "$version" "https:\/\/download.nextcloud.com\/server\/releases"
done done
fi fi
@ -129,7 +129,7 @@ for version in "${versions_rc[@]}"; do
if ! check_released "$fullversion"; then if ! check_released "$fullversion"; then
for variant in "${variants[@]}"; do for variant in "${variants[@]}"; do
create_variant "$version-rc" "https:\/\/download.nextcloud.com\/server\/prereleases" create_variant "$version-rc" "https:\/\/download.nextcloud.com\/server\/prereleases"
done done
fi fi
@ -149,7 +149,7 @@ for version in "${versions_beta[@]}"; do
if ! check_rc_released "$fullversion"; then if ! check_rc_released "$fullversion"; then
for variant in "${variants[@]}"; do for variant in "${variants[@]}"; do
create_variant "$version-beta" "https:\/\/download.nextcloud.com\/server\/prereleases" create_variant "$version-beta" "https:\/\/download.nextcloud.com\/server\/prereleases"
done done
fi fi