1

I have a Docker running inside an Ubuntu-18.04 image (VMWare Player) which is hosted on a Windows PC. Docker has a container for Gitlab which I can access through localhost:4000 from my VM. The question is how can I access the very same Gitlab instance from my Windows PC? From my understanding there are two layers I need to connect. The first is the Docker with the VM host and the second is the VM host with the Windows host. I've tried creating a bridged connection between The Windows Host and the VM but I couldn't make it work. Please provide a detailed answer with steps if possible.

2 Answers2

2

OK problem solved thanks to PanosMR.

The solution for me was to set VM network as host-only. Then assign an Sub-net IP to the VM like 192.168.42.0 with a mask like 255.255.255.0.

After that I went to see which IP my VM was assigned to. The IP was 192.128.42.128. Then on docker inside my Ubuntu VM I had set the Gitlab container --publish IP at the very same VM's IP plus the port.

For example --publish 192.168.42.128:4000:80 and boom! When Gitlab container initiated I had access through my Windows PC on that IP.

That was the simplest solution I've ever saw and also the only legit.

0

If I remember well Virtualbox has a settings screen to configure port forward. Search google around that.

oat
  • 72
  • 3
  • Sorry but I do not run VB but VMWare Player. I did try a port forwarding but I still cannot access the gitlab on VMWare. – Vasilis Da Vitzi Apr 22 '20 at 17:16
  • Have you checked the Windows firewall? – oat Apr 22 '20 at 17:17
  • My firewall is down for this reason. Just to check if there is a problem with it. I created rules also allowing this port "from" and "to" just in case. – Vasilis Da Vitzi Apr 22 '20 at 17:21
  • You might need to try to change the vm network config: try NAT or bridged interfaces. Good luck. Also the vm ip is not 127.0.0.1. Check the ip. – oat Apr 22 '20 at 17:23
  • I am aware of all that. That is why I posted a question and asked for detailed steps. Thank you. – Vasilis Da Vitzi Apr 22 '20 at 17:33
  • Have you checked the Ubuntu firewall? You can do ```dmesg -w```, then make a request and see whether the dmesg prints any drop. Also you can see fw rules by `iptables -L -n -v` and `ip6tables -L -n -v` for ipv6. – oat Apr 22 '20 at 17:48