Sudo not installed in docker container
In order to run occ one needs sudo -u www-data occ, as recommended by the script itself.
However, sudo is not installed in the docker container.
To install sudo, one first must apt update && apt install sudo.
Are there any considerations to having sudo pre-installed, or not pre-installed in the container?
as workaround, you don't need sudo, You can run on host this command:
docker exec -u <user> -it <container> bash
then you will be in shell with selected user
That does indeed work, even with the user's shell being disabled! Thank you for that pointer :)
in the case of mine, the user did not exist outside the docker container but you could get the userid (for www-data) from inside the docker and use it to connect as such: docker exec -u 33 -it nextcloud bash
Sudo should not be installed in containers (it would be an extreme edge case for it to be needed). Any extra software is a potential maintenance/security issue. Running docker exec with the www-data user (or userid) is the correct solution.
Ideally the container wouldn't be running as the root user, but that is a different issue.