localhost ne fonctionne pas dans docker pour mac

J’utilise le dernier Docker pour mac. Je me heurte à cette étrange question. Je peux accéder à mon webapp via http://127.0.0.1/ mais pas http: // localhost / cependant je peux accéder à https: // localhost / (certi Donc, je ne suis pas sûr de ce qui ne va pas ici.

Ceci est mon docker composer.

version: "3" services: php: build: context: . container_name: php volumes: - .:/var/www/html - conf:/etc/apache2/sites-enabled ports: - "80:80" - "443:443" 

et c’est ma config Apache

  ServerAdmin webmaster@localhost DocumentRoot /var/www/html  Options Indexes FollowSymLinks AllowOverride All Require all granted  ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined    DocumentRoot /var/www/html  Options Indexes FollowSymLinks AllowOverride All Require all granted  SSLEngine on SSLCertificateFile /etc/apache2/certs/localhost.crt SSLCertificateKeyFile /etc/apache2/certs/localhost.key  SSLOptions +StdEnvVars   SSLOptions +StdEnvVars  BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined   

J’ai eu un problème similaire en accédant à localhost sur Mac en utilisant docker. J’ai posté mon expérience http://nileshgule.blogspot.sg/2017/12/docker-tip-workaround-for-accessing.html

Vous pouvez essayer avec docker.for.mac.localhost