clean-docker / Magento2

Docker Image to Magento 2 local development in Mac, Linux and Windows
https://hub.docker.com/r/rafaelcgstz/magento2/
MIT License
444 stars 251 forks source link

Ignoring pub/media/ causes images to 404 #64

Open GLips opened 6 years ago

GLips commented 6 years ago

On the mac branch, the docker-sync.yml explicitly ignores pub/media/*. That's causing all media files to be invisible to the apache container, and therefore they can't be served on my development site. I see that was done to prevent too many files from syncing constantly, but what's the workaround to get media images loading?

GLips commented 6 years ago

I've added the following to my docker-compose.yml, which works for the time being but feels a bit wrong:

volumes:
  - elc-sync:/var/www/html:nocopy
  - ./src/pub/media:/var/www/html/pub/media # Added this to mount media as a volume without using docker-sync.
  - ~/.composer:/var/www/.composer
  - ~/.npm:/var/www/.npm