docker-library / httpd

Docker Official Image packaging for Apache HTTP Server
https://httpd.apache.org
Apache License 2.0
310 stars 345 forks source link

Volume mounts do not work on m1 #221

Closed b-hayes closed 10 months ago

b-hayes commented 2 years ago

PROBLEM Using the command from the docker hub page: docker run -dit --name my-apache-app -p 8080:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4

And then vising the URL I see "It works!" instead of seeing my own files. I can exec into the container and infact see that my files were not mounted.

After wasting hours trying to figure out what I had done wrong I walked over to my PC and ran the exact same command on Ubuntu in WSLv2 and saw that my files were mounted correctly.

Ive seen this same issue in other images This might be a common issue for docker itself as I believe I encountered issues with volume mounts before. An example of where this happened before: I had just got a new m1 mac and our MySQL containers for our projects would not run at all. It was working fine for everyone else (including others on older m1 airs) but when I run the projects on the new m1 mysql would immediately shut down unless I stopped using volume mounts wich isn't a viable solution.

Solution for the example above. Changing the image from mysql/mysql-server:latest to mysql:8.0-oracle made the issue go away.

Switching back n forth between images cleanly building them with no-cache and wiping the MySQL data folder each time proved that the oracle image worked when the server image didn't.

So perhaps something in that oracle image might be helpful to get this image and others working?

Some other information that might help: I don't know if any of this will be relevant but I know on windows funky things could happen if you had lots of Virtualization software installed it could affect other things even if they were not running.

tianon commented 2 years ago

Changing image from from mysql/mysql-server:latest to mysql:8.0-oracle made ht eissue go away.

I'm not sure what either of these have to do with httpd, but either/any way, this doesn't sound like something the image could be responsible for. :sweat_smile:

b-hayes commented 2 years ago

I never said http was responsible for it at all. Its related because its seems to have the same problem as httpd.

I basically said this:

There is a widespread issue with volume mounts on m1 macs and changes to the image could be a solution given that example.

If I encounter this issue again on other images I'll report it there too. Perhaps someone maintaining one of these affected images might discover the root of the problem.

I'll edit my post to make it a bit easier to read hope that helps.

tianon commented 10 months ago

Closing in favor of https://github.com/docker/for-mac/issues/6219