fred @ Veröffentlicht am

When running a Docker container in some isolated environment (e.g. for testing purposes), one thing you often want to do is to call a service located in some other container running on your host system.

Without some sort of service discovery these are invisible to the container itself. What you need in this case is the IP address of the host system so that it can be reached from within the container. I myself recently had that problem when I locally needed to test how two services directly interact with one another.

Googling the issue I found out that it is highly sought after although the solution is stunningly simple. Get a list of your network interfaces in the shell of your choice:

1
2
3
ipconfig // on windows
iwconfig // linux
ifconfig // linux

The output should be somewhat similar to what you’re seeing in the picture above. Try to track down the docker network interdace et voila: here’s the IP you were looking for.

That being said: On Windows it’s most probably always 10.0.75.1.

Veröffentlicht am
fred @ Veröffentlicht am

In a normal production environment monitoring your application’s output inside a running container should be very straightforward. Logs are usually collected from stdout and made visible in Kibana and your metrics are safely pushed to some time-based storage  (such as Graphite) and then accessible via tools like Grafana.

So far goes the theory – and then there is real life. Remember this one dynamic machine you’re qa’ing on or a shadow instance that you quickly set up a week ago? And all over sudden you find yourself in the situation where you have to debug running code. „In Situ Debugging in k8s & docker Environments“ weiterlesen

Veröffentlicht am