Nextcloud using podman behind a firewall - joefidler/joefidler.github.io GitHub Wiki
Run a containerized Nextcloud behind your routers firewall using Podman. Uses Nextcloud's built-in web-server and does not support HTTPS secured sessions, but it is an quick, easier way to start getting familiar with Nextcloud. Do not expose this setup outside your network's firewall or use it for anything requiring security or high volume traffic.
Firewalld redirect ports
This is explored more here but basically we use the hosts firewall to direct port 80 to 8000. This step is optional (it's more for convenience) - if you don't want to do it simply use http://servers-ip-address:8000 when connecting to Nextcloud.
forward-ports:
port=80:proto=tcp:toport=8000:toaddr=
Create a pod for Nextcloud and the database
podman pod create --hostname nextcloud_pod --name nextcloud_pod -p 8000:80
Create the Mariadb database
podman run --name mariadb \
--pod nextcloud_pod \
-v db:/var/lib/mysql:Z \
-e MYSQL_USER="nextcloud" \
-e MYSQL_PASSWORD="sql-password" \
-e MYSQL_ROOT_PASSWORD="sql-root-password" \
-e MYSQL_DATABASE="nextcloud" \
-d --restart=always \
docker.io/library/mariadb:latest
Create the Nextcloud instance
podman run --name nextcloud \
--pod nextcloud_pod \
-v html:/var/www/html:z \
-d --restart=always \
-e MYSQL_HOST="127.0.0.1" \
-e MYSQL_USER="nextcloud" \
-e MYSQL_PASSWORD="sql-password" \
-e MYSQL_DATABASE="nextcloud" \
docker.io/library/nextcloud:latest
Confirm all is good
podman pod list gives a list of your pods
podman ps gives a list of your active containers and their IDs
podman volume list gives a list of the podman managed volumes
podman logs CONTAINER_ID gives the logs of a container if needed
Connect to your Nextcloud
First start can take a few moments to get done. Your Nextcloud logs should show that it's "ready for connections" when it's ready.
In a browser go to http://your-server-ip-address and you should see a page to setup the admin login.
You are now ready to setup user accounts, apps and remote connect devices. Have fun !
Going forward
- You can start (or stop) Nextcloud using the pod command
podman pod start nextcloud_pod
- Monitoring health and activity
http://your-server-ip/settings/admin/serverinfo
- Updating the Nextcloud version. When running in a version updates are normally done by updating the container image.
$ podman pull nextcloud (defaults to latest container image)
$ podman ps (confirm container names or ID- I have assumed the names we used before)
$ podman stop nextcloud (stop the container)
$ podman rm nextcloud (scary but it's the container not the data)
$ podman run nextcloud - use the full command above to create the new instance
$ podman ps (confirm we are running again)