Files:Scan inside Docker

I tried to start
sudo -u www-data php occ files:scan
inside the official Docker Container. Unfortunately sudo is not installed and when using
su www-data php occ files:scan
I get a message, that the account is currently not available.

Any other Idea, starting the files:scan?

Hi,

two things you can do:

  1. Install sudo in the docker container (ask the container provider to install it by default?)
  2. Enable the www-data account (hint: /etc/passwd and /usr/sbin/nologin)

where Nr. 1 should be preferred.

Thank you, I tried both. Unfortunately the owncloud-docker container is so limited, that I can't install sudo nor can edit the mentioned files. But I found another solution.

I fortunately can answer my question myself:
On your docker-host, you can run the docker command

docker exec -it -u www-data bash

With this, you are logged in as www-data and directly can start the file-scan:

php occ files:scan --all

2 Likes

For those who read this later, you need to know the name of the image that the docker is running. Get this via:

% docker container ls
    CONTAINER ID    ....   NAMES
    08bd316d2cb1    ....   owncloud_owncloud_1
    b1a793332f7f    ....   owncloud_redis_1

Then run
docker exec -it -u www-data owncloud_owncloud_1 bash

1 Like

Even better would be to run (if you’re using the official docker image):

docker exec -it -u www-data owncloud_owncloud_1 entrypoint bash

To load the ownCloud settings set in the docker environment into the interactive bash you’re opening.

1 Like

Thank you badeoel this is a very cool hint !!!

1 Like