1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Docker exposeプラグインでngrokが払い出したURLを取得する

Last updated at Posted at 2020-12-21

Docker exposeプラグインは最終的にclip-exposeというコンテナを立てるのだが、残念ながら4040ポートをフォワーディングしないのでlocalhost:4040でURLを取得できない。

clip-exposeコンテナのIPを調べてhttp://[コンテナのIP]:4040/api/tunnelsとすればURLを含んだjsonファイルを取得できるのだが、docker exposeコマンドを使うたびにIPが変わるようなのでいちいち調べたのでは意味がないので調べたところ、

参考:How to get IP address of running docker container

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id

これでコンテナのIPが取得できるようなので、

curl http://$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' clip-expose):404
0/api/tunnels

とすればURLを含んだjsonファイルが取得できる模様。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?