191 lines
8.1 KiB
Markdown
Raw Normal View History

2016-06-16 12:54:04 +02:00
## wonderfall/nextcloud
2016-09-23 19:42:04 +02:00
[![](https://images.microbadger.com/badges/version/wonderfall/nextcloud.svg)](http://microbadger.com/images/wonderfall/nextcloud "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/wonderfall/nextcloud.svg)](http://microbadger.com/images/wonderfall/nextcloud "Get your own image badge on microbadger.com")
2016-08-21 15:52:20 +02:00
2016-09-28 21:24:25 +02:00
![](https://s32.postimg.org/69nev7aol/Nextcloud_logo.png)
2016-09-28 21:25:23 +02:00
:warning: [It has been reported](https://github.com/Wonderfall/dockerfiles/issues/37) that his image might not work well with old versions of aufs. Please update aufs to 4.x or later, or use overlay/btrfs as a replacement.
2016-09-28 21:24:25 +02:00
:warning: HTTP port has recently changed, it's now **8888**. You will have to modify your reverse proxy settings.
2016-06-16 12:54:04 +02:00
2016-10-12 10:39:15 +02:00
### Features
2016-09-23 19:42:04 +02:00
- Based on Alpine Linux.
- Bundled with nginx and PHP 7.
2016-10-12 10:23:28 +02:00
- Automatic installation using environment variables.
2016-09-23 19:42:04 +02:00
- Package integrity and authenticity checked during building process.
- Data and apps persistence.
- OPCache & APCu already configured.
- system cron task running.
2016-07-30 19:26:07 +02:00
- MySQL, PostgreSQL (server not built-in) and sqlite3 support.
- Redis, FTP, SMB, LDAP support.
2016-09-23 19:42:04 +02:00
- GNU Libiconv for php iconv extension (avoiding errors with some apps).
2016-09-23 19:44:42 +02:00
- No root processes. Never.
2016-09-23 19:42:04 +02:00
- Environment variables provided (see below).
2016-06-16 12:54:04 +02:00
2016-10-12 10:39:15 +02:00
### Tags
2016-07-01 12:11:22 +02:00
- **latest** : latest stable version.
2016-08-25 14:58:15 +02:00
- **10.0** : latest 10.0.x version (stable)
- **9.0** : latest 9.0.x version. (old stable) (unmaintained by this project)
2016-07-02 19:01:33 +02:00
- **daily** : latest code (daily build).
2016-07-01 12:11:22 +02:00
2016-09-23 19:42:04 +02:00
Other tags than `daily` are built weekly. For security reasons, you should occasionally update the container, even if you have the latest version of Nextcloud.
2016-10-12 10:39:15 +02:00
### Build-time variables
2016-06-16 12:54:04 +02:00
- **NEXTCLOUD_VERSION** : version of nextcloud
2016-09-23 19:42:04 +02:00
- **GNU_LIBICONV_VERSION** : version of GNU Libiconv
- **GPG_nextcloud** : signing key fingerprint
2016-06-16 12:54:04 +02:00
2016-10-12 10:39:15 +02:00
### Environment variables
2016-06-16 12:54:04 +02:00
- **UID** : nextcloud user id *(default : 991)*
- **GID** : nextcloud group id *(default : 991)*
- **UPLOAD_MAX_SIZE** : maximum upload size *(default : 10G)*
- **APC_SHM_SIZE** : apc memory size *(default : 128M)*
2016-09-19 13:20:26 +02:00
- **OPCACHE_MEM_SIZE** : opcache memory size in megabytes *(default : 128)*
2016-09-23 19:42:04 +02:00
- **CRON_PERIOD** : time interval between two cron tasks *(default : 15m)*
- **TZ** : The log timezone *(default : Europe/Berlin)*
- **ADMIN_USER** : Username of the administrator user *(default : admin)*
- **ADMIN_PASSWORD** : Password of the administrator user *(default : admin)*
- **DB_TYPE** : Database type (sqlite3, mysql or pgsql) *(default : sqlite3)*
- **DB_NAME** : Name of database *(default : none)*
- **DB_USER** : Username for database *(default : none)*
- **DB_PASSWORD** : Password for database user *(default : none)*
- **DB_HOST** : Database host *(default : none)*
2016-06-16 12:54:04 +02:00
2016-10-12 10:39:15 +02:00
### Port
- **8888** : HTTP Nextcloud port.
2016-07-02 19:01:33 +02:00
2016-10-12 10:39:15 +02:00
### Volumes
2016-07-02 19:01:33 +02:00
- **/data** : Nextcloud data.
- **/config** : config.php location.
- **/apps2** : Nextcloud downloaded apps.
2016-10-12 10:39:15 +02:00
### Database
2016-09-23 19:42:04 +02:00
Basically, you can use a database instance running on the host or any other machine. An easier solution is to use an external database container. I suggest you to use MariaDB, which is a reliable database server. You can use the official `mariadb` image available on Docker Hub to create a database container, which must be linked to the Nextcloud container. PostgreSQL can also be used as well.
2016-07-02 19:01:33 +02:00
2016-10-12 10:39:15 +02:00
### Setup
2016-09-23 19:42:04 +02:00
Pull the image and create a container. `/mnt` can be anywhere on your host, this is just an example. Change MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD values (mariadb). You may also want to change UID and GID (nextcloud).
2016-07-02 19:01:33 +02:00
````
docker pull wonderfall/nextcloud && docker pull mariadb:10
docker run -d --name db_nextcloud -v /mnt/nextcloud/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=supersecretpassword -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -e MYSQL_PASSWORD=supersecretpassword mariadb:10
2016-10-12 10:23:28 +02:00
docker run -d --name nextcloud --link db_nextcloud:db_nextcloud -e UID=1000 -e GID=1000 -e DB_TYPE=mysql -e DB_NAME=nextcloud -e DB_USER=nextcloud -e DB_PASSWORD=supersecretpassword -e DB_HOST=db_nextcloud -v /mnt/nextcloud/data:/data -v /mnt/nextcloud/config:/config -v /mnt/nextcloud/apps:/apps2 wonderfall/nextcloud
2016-07-02 19:01:33 +02:00
```
2016-06-16 12:54:04 +02:00
2016-09-23 19:42:04 +02:00
**Below you can find a docker-compose file, which is very useful!**
2016-07-02 19:01:33 +02:00
2016-10-12 10:23:28 +02:00
Now you have to use a **reverse proxy** in order to access to your container through Internet, steps and details are available at the end of the README.md. And that's it! You already configured Nextcloud, so there's no setup page.
2016-07-02 19:01:33 +02:00
2016-10-12 10:39:15 +02:00
### Configure
2016-07-02 19:01:33 +02:00
In the admin panel, you should switch from `AJAX cron` to `cron` (system cron).
2016-06-16 12:54:04 +02:00
2016-10-12 10:39:15 +02:00
### Update
2016-07-02 19:01:33 +02:00
Pull a newer image, then recreate the container :
2016-06-16 12:54:04 +02:00
```
2016-07-02 19:01:33 +02:00
docker pull wonderfall/nextcloud
docker rm nextcloud
docker run -d --name nextcloud --link db_nextcloud:db_nextcloud -e UID=1000 -e GID=1000 -v /mnt/nextcloud/data:/data -v /mnt/nextcloud/config:/config -v /mnt/nextcloud/apps:/apps2 wonderfall/nextcloud
2016-06-16 12:54:04 +02:00
```
2016-07-02 19:01:33 +02:00
If Nextcloud performed a full upgrade, your apps could be disabled. Enable them again.
2016-10-12 10:39:15 +02:00
### Docker-compose
2016-07-02 19:01:33 +02:00
I advise you to use [docker-compose](https://docs.docker.com/compose/), which is a great tool for managing containers. You can create a `docker-compose.yml` with the following content (which must be adapted to your needs) and then run `docker-compose up -d nextcloud-db`, wait some 15 seconds for the database to come up, then run everything with `docker-compose up -d`, that's it! On subsequent runs, a single `docker-compose up -d` is sufficient!
2016-06-16 17:03:55 +02:00
2016-10-12 10:39:15 +02:00
#### Docker-compose file V2
2016-06-16 12:54:04 +02:00
```
version: '2'
volumes:
nextcloud-db-data:
nextcloud-data:
nextcloud-config:
nextcloud-apps:
services:
nextcloud-db:
image: mariadb
volumes:
- nextcloud-db-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=1234
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=foo5678
nextcloud:
image: wonderfall/nextcloud
environment:
- UID=1000
- GID=1000
- UPLOAD_MAX_SIZE=10G
- APC_SHM_SIZE=128M
- OPCACHE_MEM_SIZE=128
- CRON_PERIOD=15m
- TZ=Europe/Berlin
- ADMIN_USER=admin
- ADMIN_PASSWORD=admin
- DB_TYPE=mysql
- DB_NAME=nextcloud
- DB_USER=nextcloud
- DB_PASSWORD=foo5678
- DB_HOST=nextcloud-db
depends_on:
- nextcloud-db
volumes:
- nextcloud-data:/data
- nextcloud-config:/config
- nextcloud-apps:/apps2
ports:
- 8888:8888
2016-06-16 12:54:04 +02:00
```
2016-10-12 10:39:15 +02:00
#### Docker-compose file V1
```
nextcloud:
image: wonderfall/nextcloud
links:
- nextcloud-db:db_nextcloud-db
environment:
- UID=1000
- GID=1000
- UPLOAD_MAX_SIZE=10G
- APC_SHM_SIZE=128M
- OPCACHE_MEM_SIZE=128
- CRON_PERIOD=15m
- TZ=Europe/Berlin
- ADMIN_USER=admin
- ADMIN_PASSWORD=admin
- DB_TYPE=mysql
- DB_NAME=nextcloud
- DB_USER=nextcloud
- DB_PASSWORD=supersecretpassword
- DB_HOST=nextcloud-db
volumes:
- /mnt/nextcloud/data:/data
- /mnt/nextcloud/config:/config
- /mnt/nextcloud/apps:/apps2
nextcloud-db:
image: mariadb:10
volumes:
- /mnt/nextcloud/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=supersecretpassword
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=supersecretpassword
```
2016-07-02 19:01:33 +02:00
You can update everything with `docker-compose pull` followed by `docker-compose up -d`.
2016-06-16 12:54:04 +02:00
2016-10-12 10:39:15 +02:00
### Reverse proxy
2016-09-23 19:42:04 +02:00
If you're using nginx, there are two possibilites :
- nginx is on the host : get the Nextcloud container IP address with `docker inspect nextcloud | grep IPAddress\" | head -n1 | grep -Eo "[0-9.]+" `. But whenever the container is restarted or recreated, its IP address can change.
2016-07-02 19:01:33 +02:00
2016-09-23 19:42:04 +02:00
- nginx is in a container, things are easier : https://github.com/hardware/mailserver/wiki/Reverse-proxy-configuration (example). If you don't get it : **nextcloud is linked to nginx** (like containers) so you can use `proxy_pass http://nextcloud:8888`. If you're interested, I provide a nginx image available on Docker Hub : `wonderfall/nginx`.
2016-06-16 12:54:04 +02:00
2016-09-23 19:42:04 +02:00
Headers are already sent by the container, including HSTS, so there's no need to add them again. **It is strongly recommended to use Nextcloud through an encrypted connection (HTTPS).** [Let's Encrypt](https://letsencrypt.org/) provides free SSL/TLS certificates (trustworthy!).