.. | ||
docker-compose | ||
dockerfiles | ||
README.md |
Examples section
In this subfolders are some examples how to use the docker image. There are two sections:
The dockerfiles
are derived images, that add or alter certain functionalities of the default docker images. In the docker-compose
subfolder are examples for deployment of the application, including database, redis, collabora and other services.
Dockerfiles
The Dockerfiles use the default images as base image and build on top of it.
Example | Description |
---|---|
cron | uses supervisor to run the cron job inside the container (so no extra container is needed). |
imap | adds dependencies required to authenticate users via imap |
smb | adds dependencies required to use smb shares |
full | adds dependencies for ALL optional packages and cron functionality via supervisor (as in the cron example Dockerfile). |
full
The full
Dockerfile example adds dependencies for all optional packages suggested by nextcloud that may be needed for some features (e.g. Video Preview Generation), as stated in the Administration Manual.
NOTE: The Dockerfile does not install the LibreOffice package (line is commented), because it would increase the generated Image size by approximately 500 MB. In order to install it, simply uncomment the 14th line of the Dockerfile.
The required steps for each optional/recommended package that is not already in the Nextcloud image are listed here, so that the Dockerfile can easily be modified to only install the needed extra packages. Simply remove the steps for the unwanted packages from the Dockerfile.
PHP Module bz2
docker-php-ext-install bz2
PHP Module imagick
apt install libmagickwand-dev
pecl install imagick
docker-php-ext-enable imagick
PHP Module imap
apt install libc-client-dev libkrb5-dev
docker-php-ext-configure imap --with-kerberos --with-imap-ssl
docker-php-ext-install imap
PHP Module gmp
apt install libgmp3-dev
docker-php-ext-install gmp
PHP Module smbclient
apt install smbclient libsmbclient-dev
pecl install smbclient
docker-php-ext-enable smbclient
ffmpeg
echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
apt install ffmpeg
LibreOffice
apt install LibreOffice
CRON via supervisor
apt install supervisor cron
mkdir /var/log/supervisord /var/run/supervisord
echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -
The following Dockerfile commands are also necessary for a sucessfull cron installation:
COPY supervisord.conf /etc/supervisor/supervisord.conf
CMD ["/usr/bin/supervisord"]
docker-compose
In docker-compose
additional services are bundled to create a complete nextcloud installation. The examples are designed to run out-of-the-box.
Before running the examples you have to modify the db.env
and docker-compose.yml
file and fill in your custom information.
The docker-compose examples make heavily use of dereived Dockerfiles to add configuration files into the containers. This way they should also work on remote docker systems as Docker for Windows. When running docker-compose on the same host as the docker daemon, another possibility would be to simply mount the files in the volumes section in the docker-compose.yml
file.
insecure
This example should only be used for testing on the local network because it uses a unencrypted http connection. When you want to have your server reachable from the internet adding HTTPS-encryption is mandatory! For this use one of the with-nginx-proxy examples.
To use this example complete the following steps:
- if you use mariadb or mysql choose a root password for the database in
docker-compose.yml
behindMYSQL_ROOT_PASSWORD=
- choose a password for the database user nextcloud in
db.env
behindMYSQL_PASSWORD=
(for mariadb/mysql) orPOSTGRES_PASSWORD=
(for postgres) - run
docker-compose build --pull
to pull the most recent base images and build the custom dockerfiles - start nextcloud with
docker-compose up -d
If you want to update your installation to a newer version of nextcloud, repeat the steps 3 and 4.
with-nginx-proxy
The nginx proxy adds a proxy layer between nextcloud and the internet. The proxy is designed to serve multiple sites on the same host machine. The advantage in adding this layer is the ability to add a container for Let's Encrypt certificate handling. This combination of the jwilder/nginx-proxy and jrcs/docker-letsencrypt-nginx-proxy-companion containers creates a fully automated https encryption of the nextcloud installation without worrying about certificate generation, validation or renewal.
To use this example complete the following steps:
- open
docker-compose.yml
- insert your nextcloud domain behind
VIRTUAL_HOST=
andLETSENCRYPT_HOST=
- enter a valid email behind
LETSENCRYPT_EMAIL=
- if you use mariadb or mysql choose a root password for the database behind
MYSQL_ROOT_PASSWORD=
- insert your nextcloud domain behind
- choose a password for the database user nextcloud in
db.env
behindMYSQL_PASSWORD=
(for mariadb/mysql) orPOSTGRES_PASSWORD=
(for postgres) - run
docker-compose build --pull
to pull the most recent base images and build the custom dockerfiles - start nextcloud with
docker-compose up -d
If you want to update your installation to a newer version of nextcloud, repeat the steps 3 and 4.