I'm trying to create an Nginx/PHP FPM setup with docker compose and am having issues with the version 3 volumes syntax/changes.
My Dockerfile
:
FROM php:7-fpm
VOLUME /var/www/html
My docker-compose.yml
:
version: "3"
services:
php:
build: .
volumes:
- ./html:/var/www/html
web:
image: nginx
links:
- php
ports:
- "8888:80"
volumes:
- php:/var/www/html
- ./default.conf:/etc/nginx/conf.d/default.conf
volumes:
php:
When I add an index.php
file into ./html
, I can view that by going to http://localhost:8888, but any static files (like CSS) return a 404 because Nginx cannot find those in its container (/var/www/html
is empty on the nginx container). With version 3 docker compose files do not have volumes_from
anymore, which is basically what I'm trying to replicate.
How can I get this to work with version 3?