Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

273
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda