How can I register a route in IIS to my container Docker?

Asked

Viewed 99 times

2

I have a job HTTP which I am making available within a Docker container.

So far, for all my services HTTP i created a redirect rule (Rewrite URL) on IIS which allowed my services to be available at a different port than the standard HTTP (port 80). And also allowed my applications Web could request services without having to implement CORS.

My difficulty right now is in knowing how I can make a similar process for my Docker container. Once I register the containers in the IIS will not result, since they are not accessible by different machines from where they are hosted.

How can I access the services of my own containers and continue to have my redirect rules?

Additional information:

  • My IIS is not running in a container and at this point wanted to avoid putting it in a container
  • For now I’m just using a machine with Docker. This means that there is no swarms envovildos. Nor Kubernetes
  • The IIS runs on a different machine where the container runs.
  • The IIS can access the host instead of the container if necessary.
  • I don’t have any networks configured for the Docker at this time.
    1. IIS is also a container? ; 2. is a container on the same host? ; 3. is using swarm, Kubernetes, ...? ; 4. IIS is also in a container, how are the networks organized? ; 5. the IIS does not directly access the container, but would access the host, correct?
  • @Brunocésar I added the requested information

  • Are you publishing the host access port? Because if I understand correctly, only this will work, since IIS will have access to the Docker host. Something like -p 1234:1234 if you are starting the container by the same CLI.

  • @Brunocésar That’s what I saw too, but I was looking to see if there were other options. In my case I do just slightly different. I use the Expose and the -P The -P uppercase assigns a dynamic port to the host...

  • I don’t know if there’s any other way, I don’t think so, since the network the container is on is virtual, so by default only Docker himself and the host know it. It may even be accessible from other external networks, but I don’t see why. Something else is, as you well observed, -P will assign a dynamic port on the host, it may be that the route on IIS crashes.

  • 1

    No problem since I have a service that helps me update the route on IIS. I even made a Powershell script for this. If you want to answer can answer I give +1.

Show 1 more comment

1 answer

2


How are you simply using a host Docker and IIS is not a container/service, the solution would be to have your IIS access the host Docker.

Since the networks created by Docker are virtual, both the default as any other explicitly created, directly only the host and the Docker itself said to know it, which prevents, by default, the server hosting the IIS from having access to any network managed by Docker, but more easily to the host Docker.

Then publishing the doors for access through host - --publish , -p or --publish-all , -P, whereas using Docker’s CLI - would be the alternative for you to create the routes on your HTTP server.

When using swarm there are some alternatives like the routing mesh which facilitates access by resources outside the swarm.

  • Cool still did not know this mesh

Browser other questions tagged

You are not signed in. Login or sign up in order to post.