Docker Community Forums

Share and learn in the Docker community.

How can I access the docker containers from my laptop connected via vpn to the docker host?

[1]
I configure my bip and my pools with (daemon.json) :
{
“bip”: “192.168.10.10/24”,
“default-address-pools”:[
{“base”:“192.168.15.0/22”,“size”:22}
]
}

[2]
My docker-host has this config

docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.10.10 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 fe80::42:e8ff:feb4:ecd1 prefixlen 64 scopeid 0x20
ether 02:42:e8:b4:ec:d1 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5 bytes 526 (526.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 fe80::1ec1:deff:fe33:fa8e prefixlen 64 scopeid 0x20
ether 1c:c1:de:33:fa:8e txqueuelen 1000 (Ethernet)
RX packets 257404060 bytes 286601527218 (286.6 GB)
RX errors 0 dropped 9 overruns 0 frame 0
TX packets 184751340 bytes 97435832809 (97.4 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 17

[3]
I had created a bridge network with

#>docker network create --subnet=192.168.15.0/24 --gateway=192.168.15.1 ntwkr_docker

br-994c03c496a9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.15.1 netmask 255.255.255.0 broadcast 192.168.15.255
inet6 fe80::42:8aff:fed1:9006 prefixlen 64 scopeid 0x20
ether 02:42:8a:d1:90:06 txqueuelen 0 (Ethernet)
RX packets 1273049 bytes 262703049 (262.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 752946 bytes 132361327 (132.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[4]
I have a bunch of containers created in this docker network, with fixed IPs, like this:
(all from docker-compose.yml)

version: '3.3'
networks:
  netdocker:
    external:
      name: ntwkr_docker
services:
  mysrv01:
    container_name: my-srv01
    image: localhost:5000/my-image-01
    networks:
      netdocker:
        ipv4_address: 192.168.15.30
    ports:
      - "18989:80"
...

[5]
at work, with my notebook connected to the company’s network, I access all services with :
http://[host-ip]:[port-service] from a web browser.

[6]
from home, connected to the company through a VPN, I want to connect directly to the containers sub-net, but I don’t access the docker-network.

for example:

I have PostgreSQL running in the 192.168.15.55 container, but the VPN does not allow me to “see” anything on the 192.168.15.X network - in the containers subnet.
I can ping docker-DNS at 192.168.15.1

How can I access the docker subnet’s containers / services?
What do I need to change or configure in the docker?