mwaeckerlin / nextcloud

Docker Image for NextCloud
GNU General Public License v3.0
1 stars 0 forks source link

Docker Image for Nextcloud

Configuration

Examples

Real Live Example Proxy

Example use with volumes and MySQL database behind a reverse proxy:

appname=nextcloud
host=cloud.example.com
docker pull mwaeckerlin/nextcloud
docker pull mysql
docker run -d --restart unless-stopped --name ${appname}-mysql-volume mysql sleep infinity
docker run -d --restart unless-stopped --name ${appname}-volume mwaeckerlin/nextcloud sleep infinity
docker run -d --restart unless-stopped --name ${appname}-mysql -e MYSQL_ROOT_PASSWORD=$(pwgen 20 1) -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -e MYSQL_PASSWORD=$(pwgen 20 1) --volumes-from ${appname}-mysql-volume mysql

Behind a reverse proxy:

docker run -d --restart unless-stopped --name ${appname} -e HOST="${host}" -e UPLOAD_MAX_FILESIZE=16G -e MAX_INPUT_TIME=7200 -e ADMIN_PWD=$(pwgen 20 1) --volumes-from ${appname}-volume --link ${appname}-mysql:mysql mwaeckerlin/nextcloud
docker run -d -p 80:80 -p 443:443 [...] --link ${appname}:${host} mwaeckerlin/reverse-proxy

Or when exposing the port, e.g. to http://localhost:8000:

docker run -d --restart unless-stopped -p 8000:80 --name ${appname} -e HOST="${host}" -e UPLOAD_MAX_FILESIZE=16G -e MAX_INPUT_TIME=7200 -e ADMIN_PWD=$(pwgen 20 1) --volumes-from ${appname}-volume --link ${appname}-mysql:mysql mwaeckerlin/nextcloud

Check the logs:

docker logs -f ${appname}

It is initialied and ready, when you see in the logs:

#### READY ####

Simplest Call for Tests

docker rm -f test-nc-mysql
docker run -d --name test-nc-mysql -e MYSQL_ROOT_PASSWORD=$(pwgen 20 1) -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -e MYSQL_PASSWORD=ert456 mysql
docker run --rm -it -p 9000:80 --name test-nc -e ADMIN_PWD=ert456 --link test-nc-mysql:mysql mwaeckerlin/nextcloud bash
/start.sh

Admin Password

How to get the admin password depends, how you started. If you specified it with ADMIN_PWD on command line, you have several options:

Simply get the environment variable:

docker exec -it ${appname} env | grep ADMIN_PWD

Get it from docker inspect:

docker inspect ${appname} | grep ADMIN_PWD

Or use my backup toolset to get the full command line:

./docker-analysis.py ${appname}

But if the password was not set and is generated randomly, you only find it in the log of the first start, so do not forget it:

docker logs ${appname} | grep 'admin-password'