Open altano opened 4 years ago
This seems strange. My nginx Dockerfile copies all sorts of files include nginx.conf, entrypoint.sh, and other files. Are you sure you're not missing file logo.png
at app/logo.png
I’m sure the image is present side-by-side with the zip file. Did you specify an “app” sub directory for a reason?
Can you try that exact Dockerfile I pasted with a PNG image? I’m curious if I’m imagining things :)
Lastly: are you using Docker Machine?
I'm using docker-machine with aws. With docker-compose, I put each service in its own subdir along with its docker file and associated files. And your example works for me.
docker-compose build app
Building app
Step 1/2 : FROM nginx:alpine
alpine: Pulling from library/nginx
cbdbe7a5bc2a: Pull complete
c554c602ff32: Pull complete
Digest: sha256:763e7f0188e378fef0c761854552c70bbd817555dc4de029681a2e972e25e30e
Status: Downloaded newer image for nginx:alpine
---> 89ec9da68213
Step 2/2 : COPY logo.png /usr/share/nginx/html/
---> 39d336b3e732
Successfully built 39d336b3e732
Successfully tagged demo_app:latest
cnguyen@stretch:~/work/docker/demo$ ls *
docker-compose.yml
app:
Dockerfile logo.png
cnguyen@stretch:~/work/docker/demo$ cat docker-compose.yml
version: '3.3'
services:
app:
build:
context: ./app
dockerfile: Dockerfile
cnguyen@stretch:~/work/docker/demo$ cat app/Dockerfile
FROM nginx:alpine
COPY logo.png /usr/share/nginx/html/
docker-machine ssh awsdemo "sudo docker image ls demo_app"
REPOSITORY TAG IMAGE ID CREATED SIZE
demo_app latest 39d336b3e732 8 minutes ago 19.9MB
Dockerfile:
results in:
While Dockerfile:
builds successfully.