Docker Community Forums

Share and learn in the Docker community.

I need to access a Windows container the same way from inside a swarm as from my host

(Sebagomez) #1

As mentioned in the subject a have a very simple prototyping environment in mu Windows 10 host where I need to compose two containers.
This is my docker-compose.yaml file

version: '3.3'
	image: microsoft/aspnetcore:1.1
	container_name: web
	- 5555:80
	- db
	image: microsoft/mssql-server-linux:rc1
	container_name: db
	- 1533:1433
	- "MSSQL_SA_PASSWORD=MyAdminPwd2017"
	- "MSSQL_PID=Developer"

The thing is I need to access my db container from both inside the swarm (the web container) and from the localhost, and the file where that is configured is shared via a volume. Is there a way I can set that in my compose file? maybe thru a different network?

Hope I made myself clear.

(Michael Friis) #2

If you run this compose file, the database should be available on the container IP on port 1433. You can find the container IP like this:

docker inspect --format "{{.NetworkSettings.Networks.nat.IPAddress}}" <container-id>

(Sebagomez) #3

Exactly, and that’s not what I want. I can find an app running on a Linux container typing localhost: but I cannot do that with Windows Containers. I have to get the inside IP address and target that one, I can not use the one from the host, like I do with Linux containers.