guides: fix port in .net guide (#22269)

<!--Delete sections as needed -->

## Description

The default port changed from 80 to 8080 when we switched to a newer
version of .net in #21877.

https://learn.microsoft.com/en-us/dotnet/core/compatibility/containers/8.0/aspnet-port


https://deploy-preview-22269--docsdocker.netlify.app/guides/dotnet/develop/

https://deploy-preview-22269--docsdocker.netlify.app/guides/dotnet/deploy/

## Related issues or tickets

Closes #22265
Related to #22080
ENGDOCS-2492

## Reviews

<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->

- [ ] Technical review

---------

Signed-off-by: Craig <craig.osterhout@docker.com>
This commit is contained in:
Craig Osterhout 2025-03-17 15:33:50 -07:00 committed by GitHub
parent ae785fef86
commit 592b28729b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 9 deletions

View File

@ -64,7 +64,7 @@ spec:
name: server
imagePullPolicy: Always
ports:
- containerPort: 80
- containerPort: 8080
hostPort: 8080
protocol: TCP
resources: {}
@ -117,7 +117,7 @@ spec:
ports:
- name: "8080"
port: 8080
targetPort: 80
targetPort: 8080
nodePort: 30001
selector:
service: server

View File

@ -182,9 +182,9 @@ $ docker container ls
You should see output like the following.
```console
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb36e310aa7e docker-dotnet-server "dotnet myWebApp.dll" About a minute ago Up About a minute 0.0.0.0:8080->80/tcp docker-dotnet-server-1
39fdcf0aff7b postgres "docker-entrypoint.s…" About a minute ago Up About a minute (healthy) 5432/tcp docker-dotnet-db-1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb36e310aa7e docker-dotnet-server "dotnet myWebApp.dll" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp docker-dotnet-server-1
39fdcf0aff7b postgres "docker-entrypoint.s…" About a minute ago Up About a minute (healthy) 5432/tcp docker-dotnet-db-1
```
In the previous example, the container ID is `39fdcf0aff7b`. Run the following command to connect to the postgres database in the container. Replace the container ID with your own container ID.
@ -241,7 +241,7 @@ services:
context: .
target: final
ports:
- 8080:80
- 8080:8080
depends_on:
db:
condition: service_healthy
@ -337,14 +337,14 @@ ENTRYPOINT ["dotnet", "myWebApp.dll"]
The following is the updated `compose.yaml` file.
```yaml {hl_lines="5"}
```yaml {hl_lines=[5,15,16]}
services:
server:
build:
context: .
target: development
ports:
- 8080:80
- 8080:8080
depends_on:
db:
condition: service_healthy
@ -354,7 +354,6 @@ services:
path: .
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:80'
db:
image: postgres
restart: always