Dockerfile Copy not working for Nextcloud container

Viewed 307

I'm trying to deploy a Nextcloud container, where the config is copied from the local directory to the container. I'm not getting any error when building or running the container, and I can see the steps are successfully executed per the terminal. Regardless, the copied file simply is not in the container. What's going on here?

Dockerfile:

FROM nextcloud:latest

# Copy local config
COPY ./config.php /var/www/html/config

All the evidence: Local file COPY not working

Thanks!

1 Answers

The file is copied but is being deleted later.

This is a very typical scenario, and in this cases, the best you can do is to see what happens in the parent image nextcloud:latest once the container starts.

In nextcloud's Dockerfile you can see

ENTRYPOINT ["/entrypoint.sh"]

if we open entrypoint.sh in the line 100 you can see clearly that the content of /var/www/html/config is modified

You can maybe do any of these options

  • Copy the file to a different temporary location, and create your own entrypoint (you can copy-paste from the original one to hit the ground running, or you can try to figure out a fancier solution)

  • Or also you can copy the file after creating and running the container

    docker cp config.php copytest:/var/www/html/config
    
Related