I am trying to get an MVC Core Web application to work with Identity Server and Docker. Here are the steps I have taken:
1) Download the quickstart: https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev
Run the project and see it working as expected. Now try adding Docker to the equation:
2) Open the solution. Right click on: IdentityServerWithAspNetIdentity and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
3) Right click on MVCClient and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
4) Change Docker-compose.override.yml to this (note that I only changed the ports for each service from 80 to 5002:80 and 5000:80):
version: '3.4'
services:
mvcclient:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5002:80"
identityserverwithaspnetidentity:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5000:80"
5) Try running the project to see what happens. When I attempt to access: Home/Secure; instead of being forwarded to the login webpage; I see this error: 'Unable to obtain configuration from:http://localhost:5000/.well-known/openid-configuration'.
I believe this is because the Docker container cannot see localhost:5000. Therefore after reading through a few blog posts; I try this:
6) Open startup in the MVCClient and change this:
options.Authority = "http://localhost:5000";
to this:
options.Authority = "http://identityserverwithaspnetidentity:80";
However, I just see a DNS error (404 I believe). What do I need to do to get Identity Server working with an MVC web app in this case?
So far I have looked here: How can I use IdentityServer4 from inside and outside a docker machine? and here: Identity Server 4 and docker. However the answers have not helped so far.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…