LoginSignup
17
10

More than 3 years have passed since last update.

localhost にアクセスできない【docker toolbox】

Last updated at Posted at 2019-06-07

よく忘れて時間を溶かすのでメモ。

アクセスできない理由

よくある docker 解説ページでは、ブラウザからhttp://localhost:8080にアクセスすると、コンテナのサービスが利用できるとあります。

ただし、docker toolbox は Virtualbox 由来の環境であるため、http://localhost:8080にアクセスしても hosts ファイルに設定をしない限りコンテナに到達できません。
(localhost = ホストPC ≠ docker toolbox の仮想マシン)

そこで、

http://192.168.99.100:8080

にアクセスすると、Virtualbox (= docker toolbox) 内のコンテナにアクセスできます。

これは、Virtualbox の default 仮想マシン内にすべてのコンテナを作成し、管理するという docker toolbox のつくりに由来すると思われます[要出典]。

包含関係のイメージ

ホスト側ブラウザ
  ↓
仮想マシン「default」(192.168.99.100)
  ↓
コンテナ (8080 ポート)
17
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
10