Portrait

Iva Horn

Notes from a software engineer for iPhone, iPad and Mac apps.

Easy Nextcloud Test Container

December 18, 2024 • #Docker #Nextcloud

How to quickly and easily spin up a Docker container with Nextcloud for testing core features quickly.

This is more of a quick note to write down what I cannot remember by myself. I am using Docker nearly daily in some way but not enough in the way that I would remember all the command line arguments. Occassionally, I just want to have a temporary, isolated and fresh Nextcloud deployment because I need to check some feature or functionality. Mostly to attempt reproduction of issues reported by others. Or to have a clean backend to test a client against.

For completeness: I assume you have Docker installed and that you have cloned the szaimen/nextcloud-easy-test repository somewhere on your device.

Usually I go with the following terminal command in the repository directory.

docker run \
    --rm \
    --env SERVER_BRANCH=v30.0.2 \
    --publish 8443:443 \
    --name nextcloud-easy-test-1 \
    ghcr.io/szaimen/nextcloud-easy-test:latest

This launches the container and logs are streamed to the console until you quit it with ⌃+C (control-C).

The --rm causes the container to be deleted after it has been shut down.

The SERVER_BRANCH environment variable can be used to define specific branches or tags of Nextcloud to use.

The --publish connects the container port 443 with the host port 8443.

The --name argument gives the container a name it can be referenced and easily recognized by. It might not be necessary at all, though.

With distinct container names and port mappings it also is easy to have multiple containers running parallel. In the end, this is a very convenient and easy setup.