9

You can connect to Docker containers directly via IP in Linux, but not on Mac/Windows (no implementation for the docker0 bridged network adapter).

You can map ports locally, but if you have the same service running, it needs different ports. Furthermore if you run your tests in a container on Jenkins, and you let it launch other containers, it has to connect via IP address because it can't get access to exposed host ports. Also you can't run concurrent tests if you expose host ports.

My boss wanted me to change the tests so it maps the host port and changes from connecting to the IP to localhost if a certain environment variable was present. That's a horrible idea. Tests should be tests and not run differently on different environments. There's no point in having tests otherwise!

Finally found a solution where someone made a container that routed traffic to docker containers via a set of tun adapters and openvpn. It's kinda sad Docker hasn't implemented this natively for Mac/Windows yet.

Comments
  • 3
    Containers are built into the kernel on linux. On the others, or at least windows, it's an after thought
  • 1
    One in million differences between the Unix clone that powers the web, most smartphones and NASA, aaaaand the sad fucked up minix version that installs searchbars for you every time you click yes on the antivirus close button.
  • 1
    @stereohisteria and that hidden minix version that's installed on ever Intel motherboard produced in the past ten+ years
  • 0
    Please, tell me what is this container you discovered to route traffic in a MacOS machine. This morning i was searching for something that could do this :)
Add Comment