Update Dotnet Containerization Docs (#19867)

* Update Dotnet Containerization Docs

This is a condensed version of the two separate commands to connect to the docker container and to log into postgres.

* Update exit commands
This commit is contained in:
JP Bulman 2024-04-24 17:10:05 -04:00 committed by GitHub
parent 685cb30093
commit 34bc2ff861
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 10 deletions

View File

@ -182,16 +182,10 @@ cb36e310aa7e docker-dotnet-server "dotnet myWebApp.dll" About a minute ag
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 start a bash shell in the postgres container. Replace the container ID with your own container ID.
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.
```console
$ docker exec -it 39fdcf0aff7b bash
```
Then run the following command to connect to the database.
```console
postgres@39fdcf0aff7b:/$ psql -d example -U postgres
$ docker exec -it 39fdcf0aff7b psql -d example -U postgres
```
And finally, insert a record into the database.
@ -206,11 +200,10 @@ You should see output like the following.
INSERT 0 1
```
Close the database connection and exit the container shell by running `exit` twice.
Close the database connection and exit the container shell by running `exit`.
```console
example=# exit
postgres@39fdcf0aff7b:/$ exit
```
## Verify that data persists in the database