Answers: <p>Well after some research, it seems the initial issue was caused by the volume mount configuration in the host's docker-compose.yml</p>
  
  <p>Even I put below line on build <code>Dockerfile</code> which copies the files to the given path</p>
  
  <pre><code>ADD . /var/www/html
  </code></pre>
  
  <p>Since the host's docker-compose.yml got line like below</p>
  
  <pre><code>volumes:
      - .:/var/www/html  
  </code></pre>
  
  <p>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 <a href="https://github.com/moby/moby/issues/4361" rel="nofollow noreferrer">Github issue</a> confirms this. </p>
  
  <p>Then it runs the <code>wordpress:latest</code>'s <code>docker-entrypoint.sh</code>
  Which set <code>/var/www/html</code> as the working directory and if it doesn't contain <code>index.php</code> and <code>wp-includes/version.php</code> (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. </p>
  
  <p>So I was basically tried to do something which was not intended. </p>
  
  <p>As @Jeremy commented,  </p>
  
  <blockquote>
    <p>as /var/www/html? It sounds like your mount is failing - and that the
    ADD Is superfluous</p>
  </blockquote>
  
  <hr>
  
  <p><strong>Another try</strong> Was totally wrong. Because I was adding a custom <code>ENTRYPOINT</code> script to my build <code>Dockerfile</code>, so it keeps ignoring the base image <code>wordpress</code>'s <code>ENTRYPOINT</code> and <code>CMD</code> that's why it wasn't copy new source to the directory. </p>
  
Answers: CC BY-SA 4.0
Answers: 2018-09-18T09:05:35.237Z
Answers: 2018-09-18T09:05:35.237Z
Answers: inckka
Body: <p>I'm packaging and shipping a custom code base of Wordpress with a Dockerfile in to my private container registry.</p>
  <p>Dockerfile:</p>
  <pre><code>FROM wordpress:latest
  ADD . /var/www/html
  </code></pre>
  <p>Then on the deployment server I just use <code>docker-compose.yml</code> and grab my custom image.
  and also I'm mounting this needed directory to host.</p>
  <p>docker-compose.yml</p>
  <pre><code>volumes:
    - .:/var/www/html
  </code></pre>
  <p>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 <code>wordpress:latest</code> data are there.</p>
  <p>What I'm missing here?</p>
  <hr />
  <p><strong>Another try</strong></p>
  <p>Then I tried something like this. Instead of directly <code>ADD . /var/www/html/</code>, I copied code base to another directory <code>ADD . /app</code> on build and on the deployment docker-compose.yml, I tried to <code>cp -a /app/. /var/www/html</code> with a <code>command</code> parameter. Command and <code>cp</code> works. However it happens before <code>wordpress:latest</code> script runs and it avoid coping official wordpress files, which I don't want. I expect some official files from <code>wordpress:latest</code> to be copied to the <code>/var/www/html/</code> then my customer data to be copied from <code>/app</code></p>
  <p>Whats the missing ingredient here?</p>
  <p>However in that case</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-09-17T10:16:17.787Z
Comments: 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.
Comments: Jeremy
Comments: CC BY-SA 4.0
Comments: 2018-09-18T05:56:27.533Z
Comments: @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.
Comments: inckka
Comments: CC BY-SA 4.0
Comments: 2018-09-18T07:23:33.953Z
Comments: 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.
Comments: inckka
Tags: <docker><docker-compose><dockerfile>
Title: Built codebase doesnt appear after deploying
UserDisplayName: inckka
ThreadText: # Built codebase doesnt appear after deploying
  
  (Asked by: username_0 on 2018-09-17)
  
  I'm packaging and shipping a custom code base of Wordpress with a Dockerfile in to my private container registry.
  
  Dockerfile:
  
  ```
  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.
  
  docker-compose.yml
  
  ```
  volumes:
    - .:/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
  
  **Tags:** docker, docker-compose, dockerfile
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_0**: @username_1 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.  
  > **username_0**: As @username_1 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-09-18. Score: 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
  
  ```
  volumes:
      - .:/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](https://github.com/moby/moby/issues/4361) 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 @username_1 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.
  
  
  ---
  
  