Installing NextCloud Service on Raspberry Pi with Docker

NextCloud
2 minutes read

We can create our own personal cloud by NextCloud. This can be done by installing Nextcloud on your raspberry pi. This blog is little different as we will be running nextcloud as a docker container instead of traditionally installing on the raspberry pi.

Let us collect all the required information for create a nextcloud application

Creating a directory on host system which we will share with the nextcloud server

mkdir /media/nas/NextCloud

Share this directory in the container in the folder

/NextCloudShare/

Therefore the run command attributes will be

--mount type=bind,source=/media/nas/NextCloud/,target=/NextCloudShare/

We will use the database created in the blog “Installing MariaDB server on Raspberry Pi by Docker” and have to get the required information for connection.

List all the docker networks

docker network

Note:We have to connect to the same docker network onto which the database have been connected.

--net=nextcloudDBMS

Database Name

-e MYSQL_DATABASE='Cloud-Database'\

Database Username

-e MYSQL_USER='nextcloud'\

Database Password

-e MYSQL_PASSWORD='Superman'\

Name of database container for linking

–link sql-nextcloud

Download the nextcloud image

docker pull nextcloud

List all the docker images

docker images

Now for running the nextcloud container we have two ways.

1.If this is the first installation then enter the following command and go to the setup page and fill in all the information.

docker run -p 4321:80\
--name cloud-service\
-v /media/nas/NextCloud:/NextCloudShare\
--link sql-nextcloud\
--net=nextcloudDBMS\
-d nextcloud

Now open you browser and enter the IP address of your raspberry pi with the above specified port number.

example:- 192.168.1.5:4321

The following web page will open up. Enter all your information by selecting MariaDB. After this your nextcloud will be ready. Hurrreeeeeee 🙂

Nextcloud-database-connection
NextCloud Registration Page

2. If you already have a database with data from the previous installation just run the following command and nextcloud will be up as it was before.

docker run -p 4321:80\
--name cloud-service\
--mount type=bind,source=/media/nas/NextCloud/,target=/NextCloudShare/\
--link sql-nextcloud\
--net=nextcloudDBMS\
-e MYSQL_DATABASE='Cloud-Database'\
-e MYSQL_USER='nextcloud'\
-e MYSQL_PASSWORD='Superman'\
-e MYSQL_HOST='33453154bd00'\
-d nextcloud

One Reply to “Installing NextCloud Service on Raspberry Pi with Docker”

  1. Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say fantastic blog!

Leave a Reply