Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

272
Views
Docker does not copy over updated files when building

My dockerfile:

FROM nginx:1.15.8-alpine

#config
copy ./nginx.conf /etc/nginx/nginx.conf
copy ./html/ /usr/share/nginx/html/

How I run it:

docker rm -vf $(docker ps -a -q)
docker rmi -f $(docker images -a -q)
docker build --no-cache . -t netvis
docker run -it -p 8081:80 netvis

Hi!

When I update files in the html/ directory on the local machine and then run the build commands the files are not updated in the docker container.

I have been told that the solution to this problem is to use the --no-cache option when building, which didn't work and to run the two deletion commands before the build command which also didn't work.

I have also tried restarting docker and also running "docker system prune -a" which also didn't work.

Thanks for any help!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So, per my comments, using COPY:

# Latest version is v1.21.1
FROM nginx:1.21.1-alpine

COPY ./html/ /usr/share/nginx/html/

NOTE I just used html and left the config unchanged.

rm -rf ./html
mkdir ./html
echo '<html><body>Hello Freddie</body></html>' > ./html/index.html

docker build \
--tag=68856201:v1 \
--file=./Dockerfile \
.

docker run \
--interactive --tty --rm \
--publish=8081:80 \
68856201:v1

Then from another shell:

curl localhost:8081/index.html
<html><body>Hello Freddie</body></html>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!