@adrianBromley When I read your question it seems to me that you’re mixing up Dockerfile and Docker Compose — they serve very different purposes.
A Dockerfile tells docker build how to build an image. Think of it as the “install the app” step. It only runs once, during the build process. After that, the image is a fixed snapshot — it never re-runs the Dockerfile.
These images are typically pushed to a registry like Docker Hub, which acts as a central repository for container images. When you install something like Nextcloud AIO, you’re pulling a pre-built image from such a registry — you don’t build it yourself. The Dockerfile was already used by the developers to build the image before publishing it. That’s why you never see or interact with a Dockerfile when you simply run a container.
docker run takes that image and creates a container from it — a running instance of that image. The process that starts inside the container is defined by the ENTRYPOINT (or CMD) in the Dockerfile. For example, in an Nginx image, that’s where the Nginx server gets started.
When you run docker run, the Docker daemon also stores the container’s configuration (in files like config.v2.json) so it knows how to handle that container after a reboot. On restart, Docker simply restarts the container process from the image — it does not re-run the Dockerfile or rebuild anything. Any data written inside the container (but outside a volume) is preserved in the container’s writable layer.
Volumes are used for data that must survive even if the container is deleted and recreated — things like databases or uploaded files.
Now, Docker Compose is a convenience tool. Instead of typing long docker run commands with all their parameters on the command line, you define everything in a YAML file and run docker compose up. It bundles multiple containers, networks, and volumes into a single, reproducible configuration.
What might confuse you about Nextcloud AIO specifically: the AIO container itself acts as a kind of “Docker Compose with a web GUI”. It configures and starts the actual Nextcloud containers (database, web server, etc.) on your behalf. So you’re not writing a docker-compose.yml yourself — the AIO container manages that for you.