Answer the question
In order to leave comments, you need to log in
How to run docker with proxy and network interfaces?
How do I run docker with my network interfaces so that I can further customize the routing? I need to be able to access the Internet through docker.
We deploy the server, openvpn on it, docker on it with its own networks and connection to proxy servers. User 1 connects to vpn server and is routed through docker1 by firewall. Thus, the user accesses the network through proxy 1. And so for the nth number of users, there may of course be simpler solutions without the use of specialized software and microtics, which I was previously advised to "Try"
version: "3.9"
services:
prixy_debian_vpn_user_11:
container_name: prixy_debian_vpn_user_11
image: debian:11
environment:
HTTP_PROXY: 'http://vpn:[email protected]:1111'
HTTPS_PROXY: 'http://vpn:[email protected]:2222'
NO_PROXY: 'localhost'
networks:
back:
ipv4_address: 172.16.238.2
services:
prixy_debian_vpn_user_22:
container_name: prixy_debian_vpn_user_22
image: debian:11
environment:
HTTP_PROXY: 'http://vpn:[email protected]:3333'
HTTPS_PROXY: 'http://vpn:[email protected]:4444'
NO_PROXY: 'localhost'
networks:
back:
ipv4_address: 172.16.238.3
networks:
#Internal-only network for proper nginx proxying and ssh
back:
driver: bridge
internal: false
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
- gateway: 172.16.238.1
#External network actually
default:
driver: bridge
WARNING: Some networks were defined but are not used by any service: back
Answer the question
In order to leave comments, you need to log in
this is an external interface that is bridged with the main interface of the server that looks at the Internet.
ports
more details directive ) network_mode: host
). networks:
back:
name: back
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
gateway: 172.16.238.1
driver_opts:
com.docker.network.bridge.name: back
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question