I'm packaging and shipping a custom code base of Wordpress with a Dockerfile in to my private container registry.


FROM wordpress:latest
ADD . /var/www/html

Then on the deployment server I just use docker-compose.yml and grab my custom image. and also I'm mounting this needed directory to host.


  - .:/var/www/html

Container starts and runs without any hustle. However the problem is the code (files, directories) I ported earlier doesn't show on the deployment. Only the official wordpress:latest data are there.

What I'm missing here?

Another try

Then I tried something like this. Instead of directly ADD . /var/www/html/, I copied code base to another directory ADD . /app on build and on the deployment docker-compose.yml, I tried to cp -a /app/. /var/www/html with a command parameter. Command and cp works. However it happens before wordpress:latest script runs and it avoid coping official wordpress files, which I don't want. I expect some official files from wordpress:latest to be copied to the /var/www/html/ then my customer data to be copied from /app

Whats the missing ingredient here?

However in that case

  • 2
    Why are you both ADDing (copying) and mounting "." as /var/www/html? It sounds like your mount is failing - and that the ADD Is superfluous.
    – Jeremy
    Sep 17, 2018 at 10:16
  • @Jeremy Thanks for pointing that out. Yes, it seems overkill and I was hoping to see the copied correct code base on the host file system. However it seems no needed.
    – inckka
    Sep 18, 2018 at 5:56
  • As @Jeremy pointed out, its trivial to have a mounted volume in my case. however for better understanding of docker, I'm still clueless about the initial issue. Since the /var/www/html is copied when bundling my custom image, when mounting /var/www/html to current directory should show my above bundled files and dirs. For the latter issue. I was adding my custom ENTRYPOINT on the build Dockerfile which is wrong and it keeps the wordpress:latest ENRTYPOINT and CMD not running.
    – inckka
    Sep 18, 2018 at 7:23

1 Answer 1


Well after some research, it seems the initial issue was caused by the volume mount configuration in the host's docker-compose.yml

Even I put below line on build Dockerfile which copies the files to the given path

ADD . /var/www/html

Since the host's docker-compose.yml got line like below

    - .:/var/www/html  

The container mounting this directory as a new directory to it's Unix like filesystem. So it masks the underlying files. So on the file system its a new directory and doesn't represent the underlying files. Basically its empty. This Github issue confirms this.

Then it runs the wordpress:latest's docker-entrypoint.sh Which set /var/www/html as the working directory and if it doesn't contain index.php and wp-includes/version.php (obviously it doesn't due to above matter, directory is new) inside, it downloads and extract WordPress source to this directory. That's why after the mount, my old bundled data wasn't there.

So I was basically tried to do something which was not intended.

As @Jeremy commented,

as /var/www/html? It sounds like your mount is failing - and that the ADD Is superfluous

Another try Was totally wrong. Because I was adding a custom ENTRYPOINT script to my build Dockerfile, so it keeps ignoring the base image wordpress's ENTRYPOINT and CMD that's why it wasn't copy new source to the directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.