The binding did not work for me until I switched from Internal Virtual Switch to External Virtual Switch and while switching I were getting the following error:
[Window Title]
Virtual Switch Manager for MY-MACHINE
[Main Instruction]
Error applying Virtual Switch Properties changes
[Content]
Failed while adding virtual Ethernet switch connections.
[Expanded Information]
External Ethernet adapter 'Realtek PCIe GBE Family Controller' is already bound to the Microsoft Virtual Switch protocol.
until I switched Hyper-V Extensible Virtual Switch off on my network adapter properties page (after I created External Virtual Switch it switched on back):
Now I have Ubuntu 18.04 on a Hyper-V machine with the following Virtual Switch:
And after running Oracle Database with the following command:
sudo docker run -d -it --rm --name oracle12se -v /home/oracle/oradata12:/opt/oracle/oradata -p 1522:1521 -p 5502:5500 -m 4G oracle/database-se:12.2.0.1
I have the following iptables configuration on Ubuntu:
sudo iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- 0.0.0.0/0 0.0.0.0/0
DOCKER-ISOLATION-STAGE-1 all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
DOCKER all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (1 references)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 172.17.0.2 tcp dpt:5500
ACCEPT tcp -- 0.0.0.0/0 172.17.0.2 tcp dpt:1521
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- 0.0.0.0/0 0.0.0.0/0
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0
sudo iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DOCKER all -- 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 172.17.0.0/16 0.0.0.0/0
MASQUERADE tcp -- 172.17.0.2 172.17.0.2 tcp dpt:5500
MASQUERADE tcp -- 172.17.0.2 172.17.0.2 tcp dpt:1521
Chain DOCKER (2 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5502 to:172.17.0.2:5500
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1522 to:172.17.0.2:1521
and I am able to connect to the Oracle Database from the local network.
Thank you so much