Nextcloud - Docker Setup
Requirements
- Docker - install instructions here - https://docs.docker.com/engine/install/ubuntu/
- Docker Compose - This can be installed on Linux by running 'sudo apt install docker-compose'
Steps to follow
- Create folder using follow
mkdir nextcloud
- Use the command
ls
to verify the folder was created - Move inside the folder nextcloud using the command
cd nextcloud
- Create a docker-compose.yaml file by running the following command
sudo nano docker-compose.yaml
Docker Compose Command
version: '2'
volumes:
nextcloud:
db:
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD= <DELETE THIS AND ENTER PASSWORD HERE>
- MYSQL_PASSWORD= <DELETE THIS AND ENTER PASSWORD HERE>
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud
restart: always
ports:
- 8080:80
links:
- db
volumes:
- nextcloud:/var/www/html
environment:
- MYSQL_PASSWORD= <DELETE THIS AND ENTER PASSWORD HERE>
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
Above is the code required to deploy NextCloud to , this will standup two containers. One container is the MySQL Database and the other is Nextcloud itself.
- Copy and paste the code above into the
docker-compose.yaml
file. - You need to make sure that your don't change the DATABASE or USER values, (these are on lines 17 and 18 as well as lines 31 and 32). If you do change them you need to make sure they match on both line 17 and 18 as well as line 31 and 32.
- What happens here is that when you stand these containers up, Nextcloud should automatically mount to the Database, if you are asked for the Database details in the Nextcloud setup then something went wrong.
- Make sure you updated the values in the code above, so lines 15,16,28,30 need to be updated.
- It's compulsory to change lines 15, 16 and 30.
- You can technically leave line 13 and 28 which is setting up your storage location for MySQL and Nextcloud containers but it's best practice to have these stored somewhere dedicated.
- Once you have the compose file setup, run 'sudo docker-compose up -d'
- Containers will be setup and created.
- In a browser visit server-local-ip-address:8080
No Comments