Hello,
I have created two docker container on windows (running windows mode).
MSSQL-Server and an IIS container.
If I like to connect one of this container with 127.0.0.1:PORT it is not working. If I get the IP-Address with docker inspect and use this IP-Address it is working. (SQL Managment Studio accepts container_id as well)
Someone wrote that a connection on localhost is not working due to a bug in Windows…
So I have created my own network and set a static ip for my containers.
Everything is working fine so far.
Now I am able to stop and start the container as often as I want. IP stays the same.
When I restart window I am facing the problem that my containers won’t start anymore.
docker start mssql
tells me that my network with ID xxxxxxx is not found anymore.
Error response from daemon: network 9bb980abe928bd0c0a017fac3790944796bcb8ea544700892578c9304d2753e8 not found
Error: failed to start containers: mssql
To get rid of this error I have to call
docker network connect dockernet mssql
Now I can start my container again with docker start, but now everytime I start and stop I will get a random IP.
I don’t like to start with docker run, because this will mess up all my databases and I need to attach them again. And I don’t like to add my dockerfile everytime I added a new database.
So my qustion is: How can I have a static ip, even after rebbot windows?
If you restart the docker service or the entire PC the network_id will change.
When you try to start your container again
docker start mssql
You’ll get this error message
Error response from daemon: network c936575d156780bcf45ca43be09db27ec2a6ca0ac8fc65092b58090bfa7212c2 not found
Error: failed to start containers: mssql
creating network with transparent driver and assigning IP at docker run command is assigning IP that I have provided. But I can not access container with that IP.
I have the same issue as describe i mean identical scenario. However, this isn’t what I would call a true solution and is by no means ideal. I should be able to launch Docker Desktop and start not have to run a bunch of commands.
This is particularly detrimental to my situation since the systems I am setting up will be used by people who have no Docker experience and shouldn’t need to run commands. I really need an actual solution to this. Firstly, we need to answer the question is this a bug or by design?