根据官网的介绍:
I cannot ping my containers
Docker for Mac can’t route traffic to containers.
(参见:https://docs.docker.com/docker-for-mac/networking/#httphttps-proxy-support)
解决办法是将container的80端口映射出来,运行
docker container run \
--rm \
--name wordpress \
--volume "/usr/local/var/www/Practice/dockerShare":/var/www/html \
-p 8080:80 \
php:5.6-apache
浏览器打开localhost:8080就可以访问到了。
网友评论