'Docker COPY failed but no error during the build

I try to push my index.html and styles.css files in my docker images. Here is my Dockerfile :

My directory :

Project
 - Dockerfile
 - index.html
 - styles.css

My Dockerfile :

FROM nginx:latest

COPY index.html /usr/share/nginx/html/
COPY styles.css /usr/share/nginx/html/

The output :

Step 1/3 : FROM nginx:latest
latest: Pulling from library/nginx
Digest: sha256:2275af0f20d71b293916f1958f8497f987b8d8fd8113df54635f2a5915002bf1
Status: Downloaded newer image for nginx:latest
 ---> 12766a6745ee
Step 2/3 : COPY index.html /usr/share/nginx/html/
 ---> 84fcd9b1e41f
Step 3/3 : COPY styles.css /usr/share/nginx/html/
 ---> 01a4fec8be28

But when I check on my container:

[tim@localhost Project ]$ sudo docker exec -it my_image bash
root@1495069379ec:/# ls
bin  boot  dev  docker-entrypoint.d  docker-entrypoint.sh  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@1495069379ec:/# cd /usr/share/nginx/html
root@1495069379ec:/usr/share/nginx/html# ls
50x.html  index.html

I don't understand why my files are not on the /usr/share/nginx/html/ directory while the copy command seems to work...

There is some one to explain ?

Thanks a lot !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source