###前提・実現したいこと
Docker上で立てたWebサーバにアクセスしたいのですが,ブラウザからアクセスできません.curlコマンドを打つと結果が返ってくるので,Webサーバ側には問題ないと思っているのですが,解決に至りません.
実行環境
- ホストOS: mac el capitan
- Docker: Version 17.06.1-ce-mac24
- Dockerのイメージ: nginx公式のもの
行った作業
コンテナの立ち上げ
$ docker run -d -p 8080:80 --rm --name webserver nginx
実行されている状態で,localhost:8080にブラウザでアクセスしましたが,The page cannot be displayed,502で接続できません.
curlコマンドを使って,
$ curl localhost:8080
とすると,以下のような結果が返ります.
<!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
ブラウザにプロキシ設定は入ってませんか?
