$ docker ps # prints all running containers
$ docker ps -a # prints all containers
$ docker ps -q # prints IDs of running containers
$ docker start ID/name
$ docker stop ID/name
$ docker rm ID/name
$ docker run <image>
$ docker run --name <container_name> <image>
$ docker run -d --name <container_name> <image>
$ docker logs -f <container_name>
$ docker exec <container_name> <target>
$ docker exec -it <container_name> /bin/bash
$ docker run -d --name mongo_catalog -p 27017:27017 mongo
$ docker exec -it mongo_catalog /bin/bash
% mongosh
> show dbs
> use <db>
> db.<collection>.find({})
> db.<collection>.insertOne({name: 'John', surname: 'Doe'})
> db.<collection>.updateOne({name: 'John'}, { $set: { updated: true } })
> db.<collection>.deleteOne({name: 'John'})
Services/CatalogCatalog.APIWebstore/Services/Catalog5000, if not, set in launchSettings.json
$ curl localhost:5000
# no response, but note no error code!
$ curl localhost:5000/weatherforecast
# json response, use jq
Swashbuckle.AspNetCoreSwashbuckle.AspNetCore.SwaggerSwashbuckle.AspNetCore.SwaggerGenSwashbuckle.AspNetCore.SwaggerUIProgram.cs:
```cs
—
| builder.Services.AddAuthorization();
| app.UseSwagger(); |
localhost:5000/swagger
applicationUrl to auto-open Swagger in launchSettingsCatalog.API.httpWeatherForecast.csProgram.cs
WeatherForecast remnantsMongoDB.DriverCatalog.API/Entities
Product.csCatalog.API/Data
ICatalogContext.csCatalogContext.csCatalogContextSeed.csCatalog.API/Repositories
IProductRepository.csProductRepository.csCatalog.API/Controllers
CatalogController.cs| builder.Services.AddScoped<ICatalogContext, CatalogContext>(); |
| builder.Services.AddScoped<IProductRepository, ProductRepository>(); |
appsettings.Development:
```cs
| {
| “Logging”: {
| “LogLevel”: {
| “Default”: “Information”,
| “Microsoft.AspNetCore”: “Warning”
| }
| },
| “DatabaseSettings” : { |
| “ConnectionString”: “mongodb://localhost:27017” |
Овај садржај је заштићен лиценцом Creative
Commons Attribution-NonCommercial 3.0 Unported License.