Iāve tried many different instructions including:
RUN sudo -u www-data /var/www/html/occ etc...
and:
RUN ["sudo -u www-data /var/www/html/occ", "etc..."]
and:
USER www-data
RUN /var/www/html/occ etc...
All of these result in a similar message that /var/www/html/occ canāt be found (regardless of user):
ERROR: Service ācoreā failed to build: OCI runtime create failed: container_linux.go:349: starting container process caused āexec: "sudo -u www-data /var/www/html/occ maintenance:install": stat sudo -u www-data /var/www/html/occ maintenance:install: no such file or directoryā: unknown
Could this be that occ is not in its place until the containerās first run?
Yes, Iāve tried it with and without php in front of occ in all scenarios.
Now the commands will work. This is how containers literally function, by segregating different services in Docker from the host machine via containers. Volumes are actually folders on the host machine. Images are what you pull to define the containers and volumes you end up running.
Thanks, just. My goal is to make a fine-tuned replicable Docker-fied NC instance where all apps and settings can be configured on docker-compose up -d. Since I cannot instruct RUN /var/www/html/occ ... in Dockerfile, am I correct in assuming that:
I will not be able to run maintenance:install during image/container creation?
My best bet is to script the nextcloud install/setup and run after container creation?
fyi # is what defines root privileges on a command when documenting it.
# ls -la
$ defines regular users privileges on a command when documenting it.
$ sudo ls -la
People donāt notate RUN or USER. Just fyi.
another quick thought: no need to link this thread, when we are already replying to this thread. You can use the " icon, or quote functionality, if you need to quote something from your earlier post in Discourse (this forum software).
Iāve been running NC on my home server, manually built in LXC for years. Iām just switching to Docker and need things to very specific and would like the install to be infinitely replicable by means of Docker config files or scripting (installing Nextcloud apps, etc.).
āRUNā is notation within a Dockerfile, the file that defines additional layers of a Docker image during creation (as in the title). It normally will allow one to run any command as it is at the command prompt. So RUN apt install foo is the cli equivalent of /bin/sh -c apt install foo. In this one situation however, occ is not found.
I seldom post to forums. Not even sure what I pressed. Noted.
if you just use the official nextcloud image with a FROM statement there is no nextcloud installed in it. nextcloud is installed during the first start of the container. (have a look at entrypoint.sh)