Cloud Cloud

Iva Horn

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

Memoji

Nextcloud Docker Container Commandline

February 4, 2026 • #Docker #Nextcloud #Shell #Snippet #Terminal

A snippet to quickly open a bash session as www-data in a Nextcloud Docker container.

As a Nextcloud desktop client developer I am working with Nextcloud deployments in form of local Docker containers on a daily basis. Too often I still have to look this up because I just cannot remember it.

a memoji

I also had this in various places where I scattered my code snippets over time but I thought it might be worth starting that as a public collection on my website. That leaves more freedom and independence than GitHub Gists, for example.

docker exec --interactive --tty --user www-data "$1" /bin/bash

This is the shortest way to interact with Nextcloud server’s commandline interface known as occ.

Note that the $1 is a placeholder to be replaced by a Docker container identifier or left as it is when you save that command in a shell script file which then substitutes it with the first argument provided.

a memoji