Running commands as user 33 in Nextcloud container

I’m working on running some manual commands on my Nextcloud container, which is the official iXsystems Nextcloud app.

I can get to the CLI for the container from the TrueNAS UI, no problem.

When I run the command:

php -f /var/www/html/occ user:resetpassword admin

I get an error message:

Console has to be executed with the user that owns the file config/config.php
Current user id: 0
Owner id of config.php: 33
Try adding 'sudo -u #33' to the beginning of the command (without the single quotes)
If running with 'docker exec' try adding the option '-u 33' to the docker command (without the single quotes)

sudo is not installed / found on the container. What’s the proper way to run the command as the user 33 / www-data ?

Thank you!

Have you tried the docker exec suggestion in the error message?

# docker exec
/bin/sh: 1: docker: not found
# 

I’m running that from inside the container - if it’s supposed to be run from outside, the instructions aren’t clear on how to do that.

You run that on the host, not inside the docker container.

Got it, thank you - still learning Docker, I am used to Jails / CORE.

Next challenge:

TrueNAS% sudo docker exec -u 33 nextcloud php -f /var/www/html/occ user:resetpassword admin
Error response from daemon: No such container: nextcloud
TrueNAS%

I can clearly see the name of the stack and the container in it are “nextcloud” - do I need to pass another parameter to get connected to the container?

That looks good, but you’ve reached the limit of the help I can offer. I haven’t swapped to Electric Eel myself so I don’t know the naming scheme of the docker containers. A guess would be that they call it something like ix-nextcloud. But that’s just a guess.

Perhaps someone else can help you out.

1 Like

This!

I have some container named ix-%container%-app-1 or ix-%container%-%container%-1 too… Kinda confusing :laughing:

1 Like

You got me where I needed - thank you.

sudo docker ps -a

gave me a list of containers. From there, I was able to see the name of the container as:

ix-nextcloud-nextcloud-1

That’s what I needed!

1 Like

… I spoke too soon. I am able to run the command, but I can’t respond to prompts from the occ command (such as putting in the password).

I know the name of the Container now - is there a way to connect to the console of that Container, in an interactive way? The Docker equivalent of iocage console ?

Add the -it flag to the docker exec command. It should give you an interactive terminal.

Perfect, thank you! That got me the interaction I needed.

1 Like