1

I'm currently in the process of learning Docker (using it on Windows and Linux). There is one thing I cannot understand, and I think it is better explained with an example.

I run a MySQL container expose ports and then I connect to it via MySQL client such as MySQL Workbench. On Linux/Ubuntu I am able to connect to the DB running inside a container via its IP address, which I obtain by running "docker inspect CONTAINER_NAME". This makes perfect sense to me, and this is how I would connect to a database running on a server.

However, on Windows this approach doesn't work. I actually have to connect to localhost instead of the container's IP address. I understand that this has something to do with the fact that on Windows containers are running inside a Linux VM, but in this case I should be using the VM's IP address to connect to it.

Why does this work the way it works? I struggle to understand it (I'm still a junior developer), and I would rather understand how it works than just memorise commands/IP addresses for different OSes.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jeremi
  • 1,314
  • 3
  • 16
  • 40
  • SuperUser.com would be a better place to ask. This has nothing to do with your programming, it's a question about the way Docker works. – Barmar Apr 21 '18 at 21:32

0 Answers0