LoginSignup
2
2

More than 5 years have passed since last update.

Docker Machineで構築した環境に実機端末でアクセスする 新

Last updated at Posted at 2017-09-16

http://qiita.com/horikeso/items/3431eacbfee564cbcc5f
こちらでコメントでngrokも良いという事なのでこちらを使用してdocker-machineの環境を公開してみました。変動IPやファイアーウォール等の面倒なことをしなくて良いのでだいぶ楽でした。

  • docker-machine(192.168.99.100)をローカルホストにポートフォワーディングする設定をコマンドプロンプトからしておく。
netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.0.0.1 connectport=80 connectaddress=192.168.99.100
netsh interface portproxy show v4tov4
ipv4 をリッスンする:         ipv4 に接続する:

Address         Port        Address         Port
--------------- ----------  --------------- ----------
127.0.0.1       80          192.168.99.100  80
  • https://ngrok.com/download
    からngrokのwindows番をダウンロードして解凍しておく。

  • ngrok.exeを実行するとコマンドプロンプトが開くのでその場で以下のコマンドを実行。

ngrok http 80
ngrok by @inconshreveable                                                                               (Ctrl+C to quit)

Session Status                online
Version                       2.2.8
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://6f33a4ec.ngrok.io -> localhost:80
Forwarding                    https://6f33a4ec.ngrok.io -> localhost:80

Connections                   ttl     opn     rt1     rt5     p50     p90
                              3       0       0.00    0.00    66.53   67.35

6f33a4ecの部分はngrokを実行する度に変わります。
ngrokを停止(ctrl+Cやコマンドプロントを閉じる)してアクセスすると

Tunnel 6f33a4ec.ngrok.io not found

となりました。

2
2
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
2
2