0
0

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 for mac で OSに設定した SOCKS proxy を利用して ssh サーバー経由で外部アクセスする ( #docker )

0
Last updated at Posted at 2019-11-07

Mac = host で SOCKS proxy を起動させておく

ssh -vND 8888 user@host

docker コンテナで proxy 接続を確認

host.docker.internal を利用

proxy利用時と非利用時でIPが変わっていたら成功

$ docker run -it alpine ash
/ # apk add curl
/ # curl  https://httpbin.org/ip
/ # https_proxy=socks5://host.docker.internal:8888 curl  https://httpbin.org/ip

参考

#docker で SOCKS proxy を利用して ssh サーバー経由の https 接続をする - Qiita

Networking features in Docker Desktop for Mac | Docker Documentation

I WANT TO CONNECT FROM A CONTAINER TO A SERVICE ON THE HOST
The host has a changing IP address (or none if you have no network access). From 18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host. This is for development purpose and will not work in a production environment outside of Docker Desktop for Mac.

The gateway is also reachable as gateway.docker.internal.

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?