Difference between revisions of "Docker"

From MgmtWiki
Jump to: navigation, search
m (Handling Data Files)
(Containers)
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Full Title or Meme==
 
==Full Title or Meme==
[[Docker]] is a system for building, deploying and running complex images of a program with its runtime.
+
[[Docker]] is a system for building, deploying and running complex images of a program with its runtime environment.
 +
 
 
==Context==
 
==Context==
 
*With the rise of cloud computing the need arose to give users an easy way to create a run-time package that could be sent to any cloud Platform as a Service provider (PaaS) with complete interoperability.
 
*With the rise of cloud computing the need arose to give users an easy way to create a run-time package that could be sent to any cloud Platform as a Service provider (PaaS) with complete interoperability.
Line 22: Line 23:
 
# Unpack the image into a "bundle". This flattens the layers into a single filesystem.
 
# Unpack the image into a "bundle". This flattens the layers into a single filesystem.
 
# Run the container from the bundle
 
# Run the container from the bundle
===Windows Subsystem for Windows===
+
===Windows Subsystem for Linux===
 
* WSL is available on Widows 10 version 2004
 
* WSL is available on Widows 10 version 2004
 +
* Wiki page on [[Docker Container with Visual Studio Code]]
 
* [https://adamtheautomator.com/windows-subsystem-for-linux/ A good guide for using WSL.]
 
* [https://adamtheautomator.com/windows-subsystem-for-linux/ A good guide for using WSL.]
 
* To migrate from WSL to WSL2 key: Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
 
* To migrate from WSL to WSL2 key: Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Line 29: Line 31:
 
  Online        : True
 
  Online        : True
 
  RestartNeeded : False
 
  RestartNeeded : False
 +
* For Ubuntu the hard disk image can be found on a location similar to: C:\Users\rp_to\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
  
 
===Networking===
 
===Networking===
Line 36: Line 39:
 
* To list all networks key: docker network ls
 
* To list all networks key: docker network ls
 
* To see details about a network key: docker network inspect {network number from above list}
 
* To see details about a network key: docker network inspect {network number from above list}
 +
 +
===Container===
 +
lifecycle
 +
# containers start as images, images are built by using the instructions in the dockerfile.
 +
# run a container to start it, and then exec commands on containers that are already running (commonly just exec bash on a container to get a prompt inside its environment to poke around)
 +
# docker-compose is a tool to manage containers, or groups of containers. to run containers with docker-compose run, just as with docker run an image, but most of the parameters pass to docker run would be specified in the docker-compose.yml file
 +
#  docker-compose run wil only start a single container in a compose file. so docker-compose up is more often used to start all the containers in the compose file. docker-compose up will also build any images it needs to start the containers it's been asked to start
 +
# docker-compose exec <container> allows commands on the already running containers, and use docker-compose as a way to address the container names without having to figure out what the automatic name it was given was.
 +
# a good pattern is to  just use docker-compose commands, there's not a whole lot to do with docker itself this way. docker-compose is just a syntax tool to help run docker commands
  
 
===Orchestration===
 
===Orchestration===
Line 44: Line 56:
 
===Services and Swarms===
 
===Services and Swarms===
 
*Docker-compose introduces the concept of services.
 
*Docker-compose introduces the concept of services.
* [https://stackoverflow.com/questions/43408493/what-is-the-difference-between-docker-service-and-docker-container#:~:text=docker%20service%20create%20is%20used,a%20template%20when%20instantiating%20tasks. What is the difference between Docker Service and Docker Container?] <blockquote>Docker services can be sued when the master node is configured with Docker swarm so that docker containers will run in a distributed environment and it can be easily managed.</blockquote>
+
* [https://stackoverflow.com/questions/43408493/what-is-the-difference-between-docker-service-and-docker-container#:~:text=docker%20service%20create%20is%20used,a%20template%20when%20instantiating%20tasks. What is the difference between Docker Service and Docker Container?] <blockquote>Docker services can be used when the master node is configured with Docker swarm so that docker containers will run in a distributed environment and it can be easily managed.</blockquote>
 
* Docker run (used to create a standalone container): The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command. That is, docker run is equivalent to the API /containers/create then /containers/(id)/start source: https://docs.docker.com/engine/reference/commandline/run/#parent-command
 
* Docker run (used to create a standalone container): The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command. That is, docker run is equivalent to the API /containers/create then /containers/(id)/start source: https://docs.docker.com/engine/reference/commandline/run/#parent-command
 
* Docker service: Docker service will be the image for a microservice within the context of some larger application. Examples of services might include an HTTP server, a database, or any other type of executable program that you wish to run in a distributed environment. When you create a service, you specify which container image to use and which commands to execute inside running containers. source: https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/#services-tasks-and-containers You also define options for the service including:
 
* Docker service: Docker service will be the image for a microservice within the context of some larger application. Examples of services might include an HTTP server, a database, or any other type of executable program that you wish to run in a distributed environment. When you create a service, you specify which container image to use and which commands to execute inside running containers. source: https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/#services-tasks-and-containers You also define options for the service including:
Line 65: Line 77:
 
* [https://docs.microsoft.com/en-us/aspnet/core/security/docker-https?view=aspnetcore-5.0 use of HTTPS with Docker images in ASP.NET].
 
* [https://docs.microsoft.com/en-us/aspnet/core/security/docker-https?view=aspnetcore-5.0 use of HTTPS with Docker images in ASP.NET].
 
* [https://stackoverflow.com/questions/60100829/mac-verify-failure-certification-exception-while-docker-compose-up-prevents-as mac verify error = Certificate Exception]
 
* [https://stackoverflow.com/questions/60100829/mac-verify-failure-certification-exception-while-docker-compose-up-prevents-as mac verify error = Certificate Exception]
 +
* See wiki page on [[Let's Encrypt]] for instructions on renewing certificate
  
===Troubleshoot Containers in Linux===  
+
===Troubleshoot in Docker on Linux===  
 
* [https://stackoverflow.com/questions/54279514/how-to-stop-running-container-if-error-response-from-daemon-is-cannot-kill-con How to stop a running Container] Cannot kill --  permission denied (suggestion that apparmor is blocking).
 
* [https://stackoverflow.com/questions/54279514/how-to-stop-running-container-if-error-response-from-daemon-is-cannot-kill-con How to stop a running Container] Cannot kill --  permission denied (suggestion that apparmor is blocking).
 +
* [https://www.telerik.com/blogs/troubleshooting-an-aspnet-core-app-running-in-docker Troubleshooting an ASP.NET Core App Running in Docker] deals with configuration environments in Development and Production. One place where errors like "dbPath is nul" can occur because the upsetting.{env}.json is not correctly spell. Not that the file naming convention in Linux is case sensitive and in Windows it is not.  This means that if the env = "development" and the file name is upsettings.Development.json, the configuration will be correctly retrieved in Windows, but not in Linux.
  
 
==Practices==
 
==Practices==
Line 78: Line 92:
 
* [https://www.docker.com/blog/deploy-dockerized-apps-without-being-a-devops-guru/ Deploying Dockerized .NET Apps Without Being a DevOps Guru] 2019-08-13 Docker blog
 
* [https://www.docker.com/blog/deploy-dockerized-apps-without-being-a-devops-guru/ Deploying Dockerized .NET Apps Without Being a DevOps Guru] 2019-08-13 Docker blog
 
* [https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories How To Use Rsync to Sync Local and Remote Directories] 2020-11-18 DigitalOcean
 
* [https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories How To Use Rsync to Sync Local and Remote Directories] 2020-11-18 DigitalOcean
 +
 +
===Token===
 +
When password is requested on website download or pull - must use token instead
 +
*Step 1: Generate a Personal Access Token
 +
Log in to your GitHub account.
 +
 +
Go to Settings → Developer settings → Personal access tokens → Tokens (classic).
 +
 +
Click Generate new token.
 +
 +
Give it a descriptive name (e.g., Server Deployment).
 +
 +
Select the scopes you need:
 +
 +
For pushing/pulling code: check repo.
 +
 +
For automation: you might also add workflow if using GitHub Actions.
 +
 +
Generate and copy the token. You won’t see it again, so store it securely. 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
 +
 +
===Fetching changes from Github===
 +
Download a repo from Github (cloning)
 +
# Go to GitHub repo, click on green button "Code", copy the link that displays. For example:
 +
https://github.com/TomCJones/RegistryDemo.git
 +
# Open Terminal.
 +
# Change the current working directory to the location where you want the cloned directory.
 +
# Type git clone, and then paste the URL you copied earlier.
 +
Update a repo from GitHub
 +
git fetch origin
 +
git reset --hard origin/master
 +
 +
git clean -f
 +
to remove local files that might have been added but no longer needed
 +
git clean -n -f
 +
To see what files will be removed (without actually removing them):
  
 
===Handling Data Files===
 
===Handling Data Files===
Line 90: Line 139:
 
Note that tokens are only good for a day!
 
Note that tokens are only good for a day!
 
</pre>
 
</pre>
* [https://stackoverflow.com/questions/4604663/download-single-files-from-github Download single files from GitHub] from stoackoverflow.
+
* [https://stackoverflow.com/questions/4604663/download-single-files-from-github Download single files from GitHub] from stackoverflow.
  
 
===Troubleshooting on Windows===
 
===Troubleshooting on Windows===
Line 108: Line 157:
 
# Logs
 
# Logs
 
# Files
 
# Files
 +
 +
==example refresh 2025-09-18===
 +
root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git stash
 +
Saved working directory and index state WIP on master: 3670e26 added challenge/response table for let's encrypt
 +
root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git pull
 +
Username for 'https://github.com': tomcjones
 +
Password for 'https://tomcjones@github.com':
 +
remote: Invalid username or token. Password authentication is not supported for Git operations.
 +
fatal: Authentication failed for 'https://github.com/TomCJones/TrustRegistry5/'
 +
root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git pull
 +
Username for 'https://github.com': tomcjones
 +
Password for 'https://tomcjones@github.com':
 +
remote: Enumerating objects: 63, done.
 +
remote: Counting objects: 100% (63/63), done.
 +
remote: Compressing objects: 100% (25/25), done.
 +
remote: Total 42 (delta 32), reused 24 (delta 17), pack-reused 0 (from 0)
 +
Unpacking objects: 100% (42/42), 9.55 KiB | 543.00 KiB/s, done.
 +
From https://github.com/TomCJones/TrustRegistry5
 +
  3670e26..339e651  master    -> origin/master
 +
Updating 3670e26..339e651
 +
Fast-forward
 +
TrustRegistry/Controllers/ViController.cs                        |  11 +++
 +
TrustRegistry/TrustRegistry.csproj                              |  17 ++++-
 +
TrustRegistry/Views/Home/About.cshtml                            |  11 +--
 +
TrustRegistry/Views/Home/Index.cshtml                            |  3 +-
 +
TrustRegistry/Views/Shared/_Layout.cshtml                        |  2 +-
 +
TrustRegistry/Views/Vi/Confirm.cshtml                            |  4 +-
 +
TrustRegistry/favicon.ico                                        | Bin 0 -> 23230 bytes
 +
TrustRegistry/wwwroot/NoDocument.html                            |  4 +-
 +
TrustRegistry/wwwroot/SvcWrkr.min.js                            |  2 +-
 +
TrustRegistry/wwwroot/circle.html                                | 177 +++++++++++++++++++++++++++++++++++++++++++++++
 +
TrustRegistry/wwwroot/images/{manifest.json => webmanifest.json} |  0
 +
TrustRegistry/wwwroot/js/SvcWrkr.js                              |  53 +++++---------
 +
TrustRegistry/wwwroot/js/site.js                                |  35 ++++++++--
 +
TrustRegistry/wwwroot/js/site.min.js                            |  2 +-
 +
14 files changed, 264 insertions(+), 57 deletions(-)
 +
create mode 100644 TrustRegistry/favicon.ico
 +
create mode 100644 TrustRegistry/wwwroot/circle.html
 +
rename TrustRegistry/wwwroot/images/{manifest.json => webmanifest.json} (100%)
 +
root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# cat TrustRegistry/wwwroot/NoDocument.html
 +
<!DOCTYPE html>
 +
<html lang="en">
 +
<head>
 +
    <meta charset="utf-8" />
 +
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 +
    <title>@ViewData["Title"] - TrustRegistry</title>
 +
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
 +
    <link rel="stylesheet" href="~/css/site.css" />
 +
    <link rel="manifest" href="~/images/webmanifest.json" />"
 +
</head>
 +
<body style="margin:10px">
 +
    <p>No document was found at this address</p>
 +
    <p>Click <a href="/home/index"> Here to go back to the home page</a></p>
 +
</body>
 +
</html>
 +
root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git stash pop
 +
Removing TrustRegistry/registrydb-old.sqlite
 +
On branch master
 +
Your branch is up to date with 'origin/master'.
 +
 +
Changes not staged for commit:
 +
  (use "git add/rm <file>..." to update what will be committed)
 +
  (use "git restore <file>..." to discard changes in working directory)
 +
        deleted:    TrustRegistry/registrydb-old.sqlite
 +
        modified:  TrustRegistry/wwwroot/letschallenge.csv
 +
        modified:  production.yml
 +
 +
Untracked files:
 +
  (use "git add <file>..." to include in what will be committed)
 +
        TrustRegistry/wwwroot/-ohJyLXX8IF0vixTQ0g8-T875DIq2X86a_BdQR-p1_o
 +
        TrustRegistry/wwwroot/.well-known/
 +
        TrustRegistry/wwwroot/CERTIFICATE.txt
 +
        TrustRegistry/wwwroot/G8Umf1_BYLHq6pLZh3RyTOh_KavEq4ELi_W40rqXf9k
 +
        TrustRegistry/wwwroot/WfAxiMUPdH3_yYtfnoAWMGKdUQT2d_U-Vq-bV8Brf_c
 +
        TrustRegistry/wwwroot/oK0M6H3cf6Cy861APrJxjPfwbgzGgJFsoMYbGbLpMbg
 +
 +
no changes added to commit (use "git add" and/or "git commit -a")
 +
Dropped refs/stash@{0} (82a0d3a16b63291910b0587783ac53a2dac8e6bb)
 +
root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# docker-compose -f docker-compose.yml -f production.yml build
 +
Building trustregistry
 +
Step 1/17 : FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
 +
---> 1f3ec31914a8
 +
Step 2/17 : WORKDIR /app
 +
---> Using cache
 +
---> 5fabddfe98f6
 +
Step 3/17 : EXPOSE 80
 +
---> Using cache
 +
---> a180f7570b3c
 +
Step 4/17 : EXPOSE 443
 +
---> Using cache
 +
---> c82fba507a5f
 +
 +
Step 5/17 : FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
 +
---> b160c8f3dbd6
 +
Step 6/17 : WORKDIR /src
 +
---> Using cache
 +
---> 163b671e4293
 +
Step 7/17 : COPY ["TrustRegistry/TrustRegistry.csproj", "TrustRegistry/"]
 +
---> cbedda3cc778
 +
Step 8/17 : RUN dotnet restore "TrustRegistry/TrustRegistry.csproj"
 +
---> Running in 03a5797c5a9d
 +
  Determining projects to restore...
 +
  Skipping project "/src/Asn1Service/Asn1Service.csproj" because it was not found.
 +
  Skipping project "/src/DerConverter/DerConverter.csproj" because it was not found.
 +
  Skipping project "/src/Asn1Service/Asn1Service.csproj" because it was not found.
 +
  Skipping project "/src/DerConverter/DerConverter.csproj" because it was not found.
 +
docker-compose -f docker-compose.yml -f production.yml up
 +
  Restored /src/TrustRegistry/TrustRegistry.csproj (in 25.28 sec).
 +
Removing intermediate container 03a5797c5a9d
 +
---> 431d09978e2e
 +
Step 9/17 : COPY . .
 +
---> fc7ed71d0109
 +
Step 10/17 : WORKDIR "/src/TrustRegistry"
 +
---> Running in 2dcb8e87ddbc
 +
Removing intermediate container 2dcb8e87ddbc
 +
---> 31af51f1dc11
 +
Step 11/17 : RUN dotnet build "TrustRegistry.csproj" -c Release -o /app/build
 +
---> Running in 5876b681e057
 +
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
 +
Copyright (C) Microsoft Corporation. All rights reserved.
 +
 +
  Determining projects to restore...
 +
  Restored /src/TrustRegistry/TrustRegistry.csproj (in 3.2 sec).
 +
  Restored /src/DerConverter/DerConverter.csproj (in 2 ms).
 +
  Restored /src/Asn1Service/Asn1Service.csproj (in 13 ms).
 +
  DerConverter -> /app/build/DerConverter.dll
 +
/src/Asn1Service/Asn1/DynamicDictionary.cs(45,30): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(226,28): warning CS0219: The variable 'plicit' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(227,28): warning CS0219: The variable 'nextName' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(418,34): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(498,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
  Asn1Service -> /app/build/Asn1Service.dll
 +
 +
  Bundler: Begin processing bundleconfig.json
 +
  Bundler: Done processing bundleconfig.json
 +
/src/TrustRegistry/Controllers/CatchAllController.cs(24,51): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ConnectController.cs(37,59): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/JwksController.cs(27,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/WellKnownController.cs(25,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ViController.cs(249,44): warning CS0219: The variable 'faz' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ViController.cs(260,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]
 +
  TrustRegistry -> /app/build/TrustRegistry.dll
 +
  TrustRegistry -> /app/build/TrustRegistry.Views.dll
 +
 +
Build succeeded.
 +
 +
/src/Asn1Service/Asn1/DynamicDictionary.cs(45,30): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(226,28): warning CS0219: The variable 'plicit' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(227,28): warning CS0219: The variable 'nextName' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(418,34): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(498,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/TrustRegistry/Controllers/CatchAllController.cs(24,51): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ConnectController.cs(37,59): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/JwksController.cs(27,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/WellKnownController.cs(25,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ViController.cs(249,44): warning CS0219: The variable 'faz' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ViController.cs(260,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]
 +
    11 Warning(s)
 +
    0 Error(s)
 +
 +
Time Elapsed 00:00:17.11
 +
Removing intermediate container 5876b681e057
 +
---> 4b67d479e6f4
 +
 +
Step 12/17 : FROM build AS publish
 +
---> 4b67d479e6f4
 +
Step 13/17 : RUN dotnet publish "TrustRegistry.csproj" -c Release -o /app/publish
 +
---> Running in 94acabb77a22
 +
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
 +
Copyright (C) Microsoft Corporation. All rights reserved.
 +
 +
  Determining projects to restore...
 +
  All projects are up-to-date for restore.
 +
  DerConverter -> /src/DerConverter/bin/Release/net5.0/DerConverter.dll
 +
/src/Asn1Service/Asn1/DynamicDictionary.cs(45,30): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(226,28): warning CS0219: The variable 'plicit' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(227,28): warning CS0219: The variable 'nextName' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(418,34): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj]
 +
/src/Asn1Service/Asn1/Asn1Reader.cs(498,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]
 +
  Asn1Service -> /src/Asn1Service/bin/Release/net5.0/Asn1Service.dll
 +
 +
  Bundler: Begin processing bundleconfig.json
 +
  Bundler: Done processing bundleconfig.json
 +
/src/TrustRegistry/Controllers/CatchAllController.cs(24,51): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ConnectController.cs(37,59): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/JwksController.cs(27,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/WellKnownController.cs(25,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ViController.cs(249,44): warning CS0219: The variable 'faz' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]
 +
/src/TrustRegistry/Controllers/ViController.cs(260,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]
 +
  TrustRegistry -> /src/TrustRegistry/bin/Release/net5.0/TrustRegistry.dll
 +
  TrustRegistry -> /src/TrustRegistry/bin/Release/net5.0/TrustRegistry.Views.dll
 +
  TrustRegistry -> /app/publish/
 +
Removing intermediate container 94acabb77a22
 +
---> 930006d294c9
 +
 +
Step 14/17 : FROM base AS final
 +
---> c82fba507a5f
 +
Step 15/17 : WORKDIR /app
 +
---> Using cache
 +
---> 6dd446cd8897
 +
Step 16/17 : COPY --from=publish /app/publish .
 +
---> 40664318a104
 +
Step 17/17 : ENTRYPOINT ["dotnet", "TrustRegistry.dll"]
 +
---> Running in 6bb96760adac
 +
Removing intermediate container 6bb96760adac
 +
---> 8bc550b54707
 +
 +
Successfully built 8bc550b54707
 +
Successfully tagged trustregistry:latest
 +
root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# docker-compose -f docker-compose.yml -f production.yml up
 +
Creating network "trustregistry5_default" with the default driver
 +
Creating trustregistry5_trustregistry_1 ... done
 +
Attaching to trustregistry5_trustregistry_1
 +
trustregistry_1  |
 +
trustregistry_1  | dbPath = Data Source = registrydb.sqlite
 +
trustregistry_1  | warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
 +
trustregistry_1  |      Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
 +
trustregistry_1  | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
 +
trustregistry_1  |      No XML encryptor configured. Key {599dce34-e555-464e-b86a-b274aba3acc1} may be persisted to storage in unencrypted form.
 +
trustregistry_1  | TrustRegistry running in Production mode with version:5.0.0.14
 +
trustregistry_1  | DB has been Created - pre migrate
 +
trustregistry_1  | Completed Creation of base Registered Objects
 +
trustregistry_1  | info: Microsoft.Hosting.Lifetime[0]
 +
trustregistry_1  |      Now listening on: https://[::]:443
 +
trustregistry_1  | info: Microsoft.Hosting.Lifetime[0]
 +
trustregistry_1  |      Now listening on: http://[::]:80
 +
trustregistry_1  | info: Microsoft.Hosting.Lifetime[0]
 +
trustregistry_1  |      Application started. Press Ctrl+C to shut down.
 +
trustregistry_1  | info: Microsoft.Hosting.Lifetime[0]
 +
trustregistry_1  |      Hosting environment: Production
 +
trustregistry_1  | info: Microsoft.Hosting.Lifetime[0]
 +
trustregistry_1  |      Content root path: /app
  
 
==References==
 
==References==
 
* [https://docs.docker.com/get-started/orchestration/ Docker docs], but note that the Docker team only deals with the low level formats.
 
* [https://docs.docker.com/get-started/orchestration/ Docker docs], but note that the Docker team only deals with the low level formats.
 
* [https://www.digitalocean.com/docs/apis-clis/doctl/reference/ command line Interface] reference for dolt, the DigitalOcean controller.
 
* [https://www.digitalocean.com/docs/apis-clis/doctl/reference/ command line Interface] reference for dolt, the DigitalOcean controller.
 +
* [https://swissarmydevops.com/containers/docker/docker-cli-cheat-sheet Docker CLI Cheat Sheet] 2020-11-22
 
* [https://github.com/docker/for-win/issues/3385 Docker for Windows] on GitHub with issues.
 
* [https://github.com/docker/for-win/issues/3385 Docker for Windows] on GitHub with issues.
 
* [https://www.ianlewis.org/en/container-runtimes-part-1-introduction-container-r a four-part series on Container Runtimes] describes low-level versus high-level runtimes well.
 
* [https://www.ianlewis.org/en/container-runtimes-part-1-introduction-container-r a four-part series on Container Runtimes] describes low-level versus high-level runtimes well.
Line 121: Line 403:
 
[[Category: Standard]]
 
[[Category: Standard]]
 
[[Category: Best Practice]]
 
[[Category: Best Practice]]
 +
[[Category: ASP.NET]]

Latest revision as of 22:36, 18 September 2025

Full Title or Meme

Docker is a system for building, deploying and running complex images of a program with its runtime environment.

Context

  • With the rise of cloud computing the need arose to give users an easy way to create a run-time package that could be sent to any cloud Platform as a Service provider (PaaS) with complete interoperability.

Documentation

Docker was released in 2013 and solved many of the problems that developers had running containers end-to-end. It had all these things:

  1. A container image format
  2. A method for building container images (Dockerfile/docker build)
  3. A way to manage container images (docker images, docker rm , etc.)
  4. A way to manage instances of containers (docker ps, docker rm , etc.)
  5. A way to share container images (docker push/pull)
  6. A way to run containers (docker run)

Open Container Initiative addresses some of the features needed to deploy a complex docker container.

When you run a Docker container, these are the steps Docker actually goes through:

  1. Download the image
  2. Unpack the image into a "bundle". This flattens the layers into a single filesystem.
  3. Run the container from the bundle

Windows Subsystem for Linux

Path          :
Online        : True
RestartNeeded : False
  • For Ubuntu the hard disk image can be found on a location similar to: C:\Users\rp_to\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc

Networking

Networking out ports are always enabled. If you append -P (or --publish-all=true) to docker run, Docker identifies every port the Dockerfile exposes (you can see which ones by looking at the EXPOSE lines). Docker also finds ports you expose with --expose 8080 (assuming you want to expose port 8080). Docker maps all of these ports to a host port within a given ephemeral port range. You can find the configuration for these ports (usually 32768 to 61000) in /proc/sys/net/ipv4/ip_local_port_range. This is the method that Visual Studio uses when debugging in docker.

  • To see pros key in: docker port {container #}
  • They are also displayed for all container with: docker ps
  • To list all networks key: docker network ls
  • To see details about a network key: docker network inspect {network number from above list}

Container

lifecycle

  1. containers start as images, images are built by using the instructions in the dockerfile.
  2. run a container to start it, and then exec commands on containers that are already running (commonly just exec bash on a container to get a prompt inside its environment to poke around)
  3. docker-compose is a tool to manage containers, or groups of containers. to run containers with docker-compose run, just as with docker run an image, but most of the parameters pass to docker run would be specified in the docker-compose.yml file
  4. docker-compose run wil only start a single container in a compose file. so docker-compose up is more often used to start all the containers in the compose file. docker-compose up will also build any images it needs to start the containers it's been asked to start
  5. docker-compose exec <container> allows commands on the already running containers, and use docker-compose as a way to address the container names without having to figure out what the automatic name it was given was.
  6. a good pattern is to just use docker-compose commands, there's not a whole lot to do with docker itself this way. docker-compose is just a syntax tool to help run docker commands

Orchestration

  • Optional for single docker images. Most important for deploying multiple apps to a single server or server farm.
  • The portability and reproducibility of a containerized process provides have an opportunity to move and scale containerized applications across clouds and server farms. Containers effectively guarantee that those applications run the same way anywhere, taking advantage any server environment. There is tooling to help automate the maintenance of those applications, ability to replace failed containers automatically, and manage the rollout of updates and reconfigurations of those containers during their lifecycle. Tools to manage, scale, and maintain containerized applications are called orchestrators, and the most common examples of these are Kubernetes and Docker Swarm. Development environment deployments of both of these orchestrators are provided by Docker Desktop.
  • An Overview of Docker Compose describes a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. The ordinary interface for the user is the docker-compose command line interface (CLI).

Services and Swarms

  • Docker-compose introduces the concept of services.
  • What is the difference between Docker Service and Docker Container?
    Docker services can be used when the master node is configured with Docker swarm so that docker containers will run in a distributed environment and it can be easily managed.
  • Docker run (used to create a standalone container): The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command. That is, docker run is equivalent to the API /containers/create then /containers/(id)/start source: https://docs.docker.com/engine/reference/commandline/run/#parent-command
  • Docker service: Docker service will be the image for a microservice within the context of some larger application. Examples of services might include an HTTP server, a database, or any other type of executable program that you wish to run in a distributed environment. When you create a service, you specify which container image to use and which commands to execute inside running containers. source: https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/#services-tasks-and-containers You also define options for the service including:
    • the port where the swarm will make the service available outside the swarm
    • an overlay network for the service to connect to other services in the swarm
    • CPU and memory limits and reservations
    • a rolling update policy
    • the number of replicas of the image to run in the swarm
  • docker service is the new docker run
  • Docker service create: is used to create instances (called tasks) of that service running in a cluster (called swarm) of computers (called nodes). Those tasks are containers of cource, but not standalone containers. In a sense a service acts as a template when instantiating tasks.

File Storage

  • How to run ASP.NET Core 3.1 over HTTPS in Docker using Linux Containers
  • Docker Docs - use volumes. Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure and OS of the host machine, volumes are completely managed by Docker. Unless data needs to also be managed by the underlying o/s (as is the case for debugging on an IDE), it is recommended to use volumes over bind mounts.
  • use rsync commands to move files between dev machine and a running linux container instance.
  • Docker Bind for files on core o/s.

Support for TLS

Troubleshoot in Docker on Linux

  • How to stop a running Container Cannot kill -- permission denied (suggestion that apparmor is blocking).
  • Troubleshooting an ASP.NET Core App Running in Docker deals with configuration environments in Development and Production. One place where errors like "dbPath is nul" can occur because the upsetting.{env}.json is not correctly spell. Not that the file naming convention in Linux is case sensitive and in Windows it is not. This means that if the env = "development" and the file name is upsettings.Development.json, the configuration will be correctly retrieved in Windows, but not in Linux.

Practices

This section is specific to Visual Studio 2019 and later.

  1. Start the project as a docker project, or go the startup project and Add->Docker support.
  2. Add orchestration in the same project by Add->Container Orchestrator Support. This will build a new folder under the VS solution folder called "docker-compose".
    1. That will enable containers that have more that one start project.
  3. If the application uses User Secrets, there might be a problem deploying it to Production.
  4. Ditto with root/.aspnet/https/---.pfs

Token

When password is requested on website download or pull - must use token instead

  • Step 1: Generate a Personal Access Token

Log in to your GitHub account.

Go to Settings → Developer settings → Personal access tokens → Tokens (classic).

Click Generate new token.

Give it a descriptive name (e.g., Server Deployment).

Select the scopes you need:

For pushing/pulling code: check repo.

For automation: you might also add workflow if using GitHub Actions.

Generate and copy the token. You won’t see it again, so store it securely. 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

Fetching changes from Github

Download a repo from Github (cloning)

  1. Go to GitHub repo, click on green button "Code", copy the link that displays. For example:
https://github.com/TomCJones/RegistryDemo.git
  1. Open Terminal.
  2. Change the current working directory to the location where you want the cloned directory.
  3. Type git clone, and then paste the URL you copied earlier.

Update a repo from GitHub

git fetch origin
git reset --hard origin/master
git clean -f
to remove local files that might have been added but no longer needed
git clean -n -f
To see what files will be removed (without actually removing them):

Handling Data Files

  • This section is about files that need to be loaded into a service that should not be included with the program for some reason.

If the files to be loaded are on a GitHub account the easiest was is to use curl. The token can be generated by signing into GitHub and using the shorted URL. Then cut and paste the URL that results in returning the data. Note that single quotes are placed around the URL because of the "?" which is only needed on some version of zsh.

 curl -H 'UserAgent:Mozilla' -H 'Accept: application/vnd.github.v3.raw' -L 'https://raw.githubusercontent.com/TomCJones/tcdata/main/trorgpw.txt?token=ACWGVVTTTFA3S4PSADLBCXS76TVLG'  -o trorgpw.txt
 curl -H 'UserAgent:Mozilla' -H 'Accept: application/vnd.github.v3.raw' -L 'https://raw.githubusercontent.com/TomCJones/tcdata/main/trorg-210307.pfx?token=ACWGVVTTTFA3S4PSADLBCXS76TVLG'  -o trorg-210307.pfx
or just
 curl -L 'https://raw.githubusercontent.com/TomCJones/tcdata/main/trorg-210307.pfx?token=ACWGVVV7TPKPZKZVCXBYYMK76X5XG' -o Trustregistry.pfx

Note that tokens are only good for a day!

Troubleshooting on Windows

Containers

  • Configuration of Containers Windows is reached by using the search box in the IDE (press Ctrl+Q to use it), type in container, and choose the Containers window from the list.
  • Container Tools launch settings in msft docs.
  • Visual Studio Find does not search this file so you need to know about its contents.

Nav (left) panel

  1. Solution Containers
    1. List of containers, most with weird made-up names. (BTW, the current container name will be in the page footer is a terminal is open.)
  2. Other Containers

Nav (top) bar

  1. Environment
  2. Ports - contains linkage, for example, from container port (80) to host port (32775) and type (TCP) 443 -> 32774 (see networking above}
  3. Logs
  4. Files

example refresh 2025-09-18=

root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git stash Saved working directory and index state WIP on master: 3670e26 added challenge/response table for let's encrypt root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git pull Username for 'https://github.com': tomcjones Password for 'https://tomcjones@github.com': remote: Invalid username or token. Password authentication is not supported for Git operations. fatal: Authentication failed for 'https://github.com/TomCJones/TrustRegistry5/' root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git pull Username for 'https://github.com': tomcjones Password for 'https://tomcjones@github.com': remote: Enumerating objects: 63, done. remote: Counting objects: 100% (63/63), done. remote: Compressing objects: 100% (25/25), done. remote: Total 42 (delta 32), reused 24 (delta 17), pack-reused 0 (from 0) Unpacking objects: 100% (42/42), 9.55 KiB | 543.00 KiB/s, done. From https://github.com/TomCJones/TrustRegistry5

  3670e26..339e651  master     -> origin/master

Updating 3670e26..339e651 Fast-forward

TrustRegistry/Controllers/ViController.cs                        |  11 +++
TrustRegistry/TrustRegistry.csproj                               |  17 ++++-
TrustRegistry/Views/Home/About.cshtml                            |  11 +--
TrustRegistry/Views/Home/Index.cshtml                            |   3 +-
TrustRegistry/Views/Shared/_Layout.cshtml                        |   2 +-
TrustRegistry/Views/Vi/Confirm.cshtml                            |   4 +-
TrustRegistry/favicon.ico                                        | Bin 0 -> 23230 bytes
TrustRegistry/wwwroot/NoDocument.html                            |   4 +-
TrustRegistry/wwwroot/SvcWrkr.min.js                             |   2 +-
TrustRegistry/wwwroot/circle.html                                | 177 +++++++++++++++++++++++++++++++++++++++++++++++
TrustRegistry/wwwroot/images/{manifest.json => webmanifest.json} |   0
TrustRegistry/wwwroot/js/SvcWrkr.js                              |  53 +++++---------
TrustRegistry/wwwroot/js/site.js                                 |  35 ++++++++--
TrustRegistry/wwwroot/js/site.min.js                             |   2 +-
14 files changed, 264 insertions(+), 57 deletions(-)
create mode 100644 TrustRegistry/favicon.ico
create mode 100644 TrustRegistry/wwwroot/circle.html
rename TrustRegistry/wwwroot/images/{manifest.json => webmanifest.json} (100%)

root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# cat TrustRegistry/wwwroot/NoDocument.html <!DOCTYPE html> <html lang="en"> <head>

   <meta charset="utf-8" />
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>@ViewData["Title"] - TrustRegistry</title>
   <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
   <link rel="stylesheet" href="~/css/site.css" />
   <link rel="manifest" href="~/images/webmanifest.json" />"

</head> <body style="margin:10px">

No document was found at this address

Click <a href="/home/index"> Here to go back to the home page</a>

</body> </html> root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# git stash pop Removing TrustRegistry/registrydb-old.sqlite On branch master Your branch is up to date with 'origin/master'.

Changes not staged for commit:

 (use "git add/rm <file>..." to update what will be committed)
 (use "git restore <file>..." to discard changes in working directory)
       deleted:    TrustRegistry/registrydb-old.sqlite
       modified:   TrustRegistry/wwwroot/letschallenge.csv
       modified:   production.yml

Untracked files:

 (use "git add <file>..." to include in what will be committed)
       TrustRegistry/wwwroot/-ohJyLXX8IF0vixTQ0g8-T875DIq2X86a_BdQR-p1_o
       TrustRegistry/wwwroot/.well-known/
       TrustRegistry/wwwroot/CERTIFICATE.txt
       TrustRegistry/wwwroot/G8Umf1_BYLHq6pLZh3RyTOh_KavEq4ELi_W40rqXf9k
       TrustRegistry/wwwroot/WfAxiMUPdH3_yYtfnoAWMGKdUQT2d_U-Vq-bV8Brf_c
       TrustRegistry/wwwroot/oK0M6H3cf6Cy861APrJxjPfwbgzGgJFsoMYbGbLpMbg

no changes added to commit (use "git add" and/or "git commit -a") Dropped refs/stash@{0} (82a0d3a16b63291910b0587783ac53a2dac8e6bb) root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# docker-compose -f docker-compose.yml -f production.yml build Building trustregistry Step 1/17 : FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base

---> 1f3ec31914a8

Step 2/17 : WORKDIR /app

---> Using cache
---> 5fabddfe98f6

Step 3/17 : EXPOSE 80

---> Using cache
---> a180f7570b3c

Step 4/17 : EXPOSE 443

---> Using cache
---> c82fba507a5f

Step 5/17 : FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build

---> b160c8f3dbd6

Step 6/17 : WORKDIR /src

---> Using cache
---> 163b671e4293

Step 7/17 : COPY ["TrustRegistry/TrustRegistry.csproj", "TrustRegistry/"]

---> cbedda3cc778

Step 8/17 : RUN dotnet restore "TrustRegistry/TrustRegistry.csproj"

---> Running in 03a5797c5a9d
 Determining projects to restore...
 Skipping project "/src/Asn1Service/Asn1Service.csproj" because it was not found.
 Skipping project "/src/DerConverter/DerConverter.csproj" because it was not found.
 Skipping project "/src/Asn1Service/Asn1Service.csproj" because it was not found.
 Skipping project "/src/DerConverter/DerConverter.csproj" because it was not found.

docker-compose -f docker-compose.yml -f production.yml up

 Restored /src/TrustRegistry/TrustRegistry.csproj (in 25.28 sec).

Removing intermediate container 03a5797c5a9d

---> 431d09978e2e

Step 9/17 : COPY . .

---> fc7ed71d0109

Step 10/17 : WORKDIR "/src/TrustRegistry"

---> Running in 2dcb8e87ddbc

Removing intermediate container 2dcb8e87ddbc

---> 31af51f1dc11

Step 11/17 : RUN dotnet build "TrustRegistry.csproj" -c Release -o /app/build

---> Running in 5876b681e057

Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Copyright (C) Microsoft Corporation. All rights reserved.

 Determining projects to restore...
 Restored /src/TrustRegistry/TrustRegistry.csproj (in 3.2 sec).
 Restored /src/DerConverter/DerConverter.csproj (in 2 ms).
 Restored /src/Asn1Service/Asn1Service.csproj (in 13 ms).
 DerConverter -> /app/build/DerConverter.dll

/src/Asn1Service/Asn1/DynamicDictionary.cs(45,30): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(226,28): warning CS0219: The variable 'plicit' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(227,28): warning CS0219: The variable 'nextName' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(418,34): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(498,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]

 Asn1Service -> /app/build/Asn1Service.dll
 Bundler: Begin processing bundleconfig.json
 Bundler: Done processing bundleconfig.json

/src/TrustRegistry/Controllers/CatchAllController.cs(24,51): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ConnectController.cs(37,59): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/JwksController.cs(27,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/WellKnownController.cs(25,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ViController.cs(249,44): warning CS0219: The variable 'faz' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ViController.cs(260,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]

 TrustRegistry -> /app/build/TrustRegistry.dll
 TrustRegistry -> /app/build/TrustRegistry.Views.dll

Build succeeded.

/src/Asn1Service/Asn1/DynamicDictionary.cs(45,30): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(226,28): warning CS0219: The variable 'plicit' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(227,28): warning CS0219: The variable 'nextName' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(418,34): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(498,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj] /src/TrustRegistry/Controllers/CatchAllController.cs(24,51): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ConnectController.cs(37,59): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/JwksController.cs(27,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/WellKnownController.cs(25,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ViController.cs(249,44): warning CS0219: The variable 'faz' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ViController.cs(260,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]

   11 Warning(s)
   0 Error(s)

Time Elapsed 00:00:17.11 Removing intermediate container 5876b681e057

---> 4b67d479e6f4

Step 12/17 : FROM build AS publish

---> 4b67d479e6f4

Step 13/17 : RUN dotnet publish "TrustRegistry.csproj" -c Release -o /app/publish

---> Running in 94acabb77a22

Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Copyright (C) Microsoft Corporation. All rights reserved.

 Determining projects to restore...
 All projects are up-to-date for restore.
 DerConverter -> /src/DerConverter/bin/Release/net5.0/DerConverter.dll

/src/Asn1Service/Asn1/DynamicDictionary.cs(45,30): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(226,28): warning CS0219: The variable 'plicit' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(227,28): warning CS0219: The variable 'nextName' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(418,34): warning CS0168: The variable 'ex' is declared but never used [/src/Asn1Service/Asn1Service.csproj] /src/Asn1Service/Asn1/Asn1Reader.cs(498,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/Asn1Service/Asn1Service.csproj]

 Asn1Service -> /src/Asn1Service/bin/Release/net5.0/Asn1Service.dll
 Bundler: Begin processing bundleconfig.json
 Bundler: Done processing bundleconfig.json

/src/TrustRegistry/Controllers/CatchAllController.cs(24,51): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ConnectController.cs(37,59): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/JwksController.cs(27,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/WellKnownController.cs(25,40): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ViController.cs(249,44): warning CS0219: The variable 'faz' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj] /src/TrustRegistry/Controllers/ViController.cs(260,28): warning CS0219: The variable 'foo' is assigned but its value is never used [/src/TrustRegistry/TrustRegistry.csproj]

 TrustRegistry -> /src/TrustRegistry/bin/Release/net5.0/TrustRegistry.dll
 TrustRegistry -> /src/TrustRegistry/bin/Release/net5.0/TrustRegistry.Views.dll
 TrustRegistry -> /app/publish/

Removing intermediate container 94acabb77a22

---> 930006d294c9

Step 14/17 : FROM base AS final

---> c82fba507a5f

Step 15/17 : WORKDIR /app

---> Using cache
---> 6dd446cd8897

Step 16/17 : COPY --from=publish /app/publish .

---> 40664318a104

Step 17/17 : ENTRYPOINT ["dotnet", "TrustRegistry.dll"]

---> Running in 6bb96760adac

Removing intermediate container 6bb96760adac

---> 8bc550b54707

Successfully built 8bc550b54707 Successfully tagged trustregistry:latest root@docker-s-1vcpu-1gb-sfo2-01:/home/app/TrustRegistry5# docker-compose -f docker-compose.yml -f production.yml up Creating network "trustregistry5_default" with the default driver Creating trustregistry5_trustregistry_1 ... done Attaching to trustregistry5_trustregistry_1 trustregistry_1 | trustregistry_1 | dbPath = Data Source = registrydb.sqlite trustregistry_1 | warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60] trustregistry_1 | Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. trustregistry_1 | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] trustregistry_1 | No XML encryptor configured. Key {599dce34-e555-464e-b86a-b274aba3acc1} may be persisted to storage in unencrypted form. trustregistry_1 | TrustRegistry running in Production mode with version:5.0.0.14 trustregistry_1 | DB has been Created - pre migrate trustregistry_1 | Completed Creation of base Registered Objects trustregistry_1 | info: Microsoft.Hosting.Lifetime[0] trustregistry_1 | Now listening on: https://[::]:443 trustregistry_1 | info: Microsoft.Hosting.Lifetime[0] trustregistry_1 | Now listening on: http://[::]:80 trustregistry_1 | info: Microsoft.Hosting.Lifetime[0] trustregistry_1 | Application started. Press Ctrl+C to shut down. trustregistry_1 | info: Microsoft.Hosting.Lifetime[0] trustregistry_1 | Hosting environment: Production trustregistry_1 | info: Microsoft.Hosting.Lifetime[0] trustregistry_1 | Content root path: /app

References