mirror of https://github.com/docker/docs.git
update dotnet guide (#18810)
* update dotnet guide --------- Signed-off-by: Craig Osterhout <craig.osterhout@docker.com> Co-authored-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
0bc7234ba9
commit
2d08689e49
|
@ -182,17 +182,37 @@ 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 run the `psql` command inside your database container and insert a record into the database. Replace the container ID with your own container ID.
|
||||
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.
|
||||
|
||||
```console
|
||||
$ docker exec 39fdcf0aff7b psql -d example -U postgres -c "INSERT INTO \"Students\" (\"ID\", \"LastName\", \"FirstMidName\", \"EnrollmentDate\") VALUES (DEFAULT, 'Whale', 'Moby', '2013-03-20');"
|
||||
$ docker exec -it 39fdcf0aff7b bash
|
||||
```
|
||||
|
||||
Then run the following command to connect to the database.
|
||||
|
||||
```console
|
||||
postgres@39fdcf0aff7b:/$ psql -d example -U postgres
|
||||
```
|
||||
|
||||
And finally, insert a record into the database.
|
||||
|
||||
```console
|
||||
example=# INSERT INTO "Students" ("ID", "LastName", "FirstMidName", "EnrollmentDate") VALUES (DEFAULT, 'Whale', 'Moby', '2013-03-20');
|
||||
```
|
||||
|
||||
You should see output like the following.
|
||||
|
||||
```console
|
||||
INSERT 0 1
|
||||
```
|
||||
|
||||
Close the database connection and exit the container shell by running `exit` twice.
|
||||
|
||||
```console
|
||||
example=# exit
|
||||
postgres@39fdcf0aff7b:/$ exit
|
||||
```
|
||||
|
||||
## Verify that data persists in the database
|
||||
|
||||
Open a browser and view the application at [http://localhost:8080](http://localhost:8080). You should see a simple web application with the text `Student name is Whale Moby`.
|
||||
|
|
Loading…
Reference in New Issue