Learn MS NET | How to update a Docker container to the latest version

Our journey learning how to write .NET

Learn MS NET

  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

How to update a Docker container to the latest version


Having needed to update some Docker containers and getting familiar with how Docker works I though I would post this here so I have it for reference and if anyone else is looking to do the same thing.

On my installation of docker I run DotNet Core in containers and with each new update to the SDK new containers get published and it becomes necessary to update them every month or so.

As we can see on my installation at the moment the 2.2 versions are 4 months old

PS C:\WINDOWS\system32> docker images | findstr "dotnet"                                                                
mcr.microsoft.com/dotnet/core/sdk          3.0-buster               3930ade3a33a        4 days ago          695MB
mcr.microsoft.com/dotnet/core/aspnet       3.0-buster-slim          1d97a08ada5a        4 days ago          207MB
mcr.microsoft.com/dotnet/core/sdk          <none>                   4e9e8dec2900        3 weeks ago         707MB
mcr.microsoft.com/dotnet/core/aspnet       <none>                   de4e4dcb9041        3 weeks ago         196MB
mcr.microsoft.com/dotnet/core/sdk          2.2                      e268893be733        4 months ago        1.74GB
mcr.microsoft.com/dotnet/core/sdk          2.2-stretch              e268893be733        4 months ago        1.74GB
mcr.microsoft.com/dotnet/core/aspnet       2.2-stretch-slim         cb2dd04458bc        4 months ago        260MB
microsoft/dotnet                           2.1-aspnetcore-runtime   a5f99632e68d        4 months ago        253MB
mcr.microsoft.com/dotnet/core/aspnet       2.2                      df2a085ca3a8        4 months ago        260MB

In order to update the container and make sure they are the latest version, I ran pull:

PS C:\WINDOWS\system32> docker pull mcr.microsoft.com/dotnet/core/sdk:2.2                                               
2.2: Pulling from dotnet/core/sdk
9cc2ad81d40d: Pull complete                                                                                             
e6cb98e32a52: Pull complete                                                                                             
ae1b8d879bad: Pull complete                                                                                             
42cfa3699b05: Pull complete                                                                                             
dcc190332ff6: Pull complete                                                                                             
b49aea48d777: Pull complete                                                                                             
67e832fd5d6a: Pull complete                                                                                             
Digest: sha256:e1b19d391986f21b177c1ba47f8a8519bf5cff66a9459d04f3aea23e1a7ec30f
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/sdk:2.2
mcr.microsoft.com/dotnet/core/sdk:2.2

Now I have an update container for version 2.2 of the DotNet Core SDK

PS C:\WINDOWS\system32> docker images | findstr "dotnet"                                                                
mcr.microsoft.com/dotnet/core/sdk    2.2                   08657316a4cd        4 days ago          1.74GB

This will update the container that is located locally and if you were having any problems simply restart any container that uses that particular container to gain the latest version. The concludes the update of the container.

Add comment

Loading