This is the source code repository for https://www.practical-docker.com
https://github.com/marcelmaatkamp/practical-docker-episode-01-socks5-proxy
Opening and forwarding specific ports per docker container is ok for a few containers, the more ports you open the more it becomes a hasstle and totally not clear which ports map to which container.
A simple but very effective solution is to use a socks5 proxy. In this episode I will show how to install and use a socks5 proxy and what benefits it brings to use this solution which is that each container can be reached by its internal hostname which is the name of the container.
Docker containers used:
$ git clone &&\
cd &&\
docker-compose up -d
Install a proxy switcher in your favorite browser (see below) and goto http://gitlab/
!(images/practical-docker-gitlab.png)
The socks5 proxy container also comes with username/password authentication.
setting | value |
---|---|
Protocol | Socks-proxy |
Socks Protocol-server | localhost |
Socks Protocol-port | 1080 |
username | someuser |
password | somepass |
Beware: this is not available with Firefox and Google Chrome/Chromium because 'passwords are not transferred over a secure channel', see https://bugs.chromium.org/p/chromium/issues/detail?id=256785
Install the addon 'FoxProxy' https://addons.mozilla.org/en-US/firefox/addon/foxyproxy-standard/
And open http://gitlab/
On a Mac Safari open "Network Settings -> Proxies" and enable the Socks-proxy:
Open Safari and goto http://gitlab/
In these talks I will give practical tips and tricks on how to effectively use Docker as a valuable tool to solve various problems or just use it for fun projects with all kinds of hardware and software! See my YouTube Channel with all episodes for more information.