patterndockerMinor
Built codebase doesnt appear after deploying
Viewed 0 times
afterbuiltdeployingdoesntappearcodebase
Problem
I'm packaging and shipping a custom code base of Wordpress with a Dockerfile in to my private container registry.
Dockerfile:
Then on the deployment server I just use
and also I'm mounting this needed directory to host.
docker-compose.yml
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
What I'm missing here?
Another try
Then I tried something like this. Instead of directly
Whats the missing ingredient here?
However in that case
Dockerfile:
FROM wordpress:latest
ADD . /var/www/htmlThen 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/htmlContainer 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 /appWhats the missing ingredient here?
However in that case
Solution
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
Since the host's docker-compose.yml got line like below
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
Which set
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
Even I put below line on build
Dockerfile which copies the files to the given pathADD . /var/www/htmlSince the host's docker-compose.yml got line like below
volumes:
- .:/var/www/htmlThe 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.shWhich 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.Code Snippets
ADD . /var/www/htmlvolumes:
- .:/var/www/htmlContext
StackExchange DevOps Q#4987, answer score: 1
Revisions (0)
No revisions yet.