Welcome to today’s post.
I will discuss how to publish a docker image from a .Net Core Application to a DockerHub container registry.
To prepare your .Net Core application for Docker support see my previous post where I show you how this is done. It is quite straightforward.
Next, select the Publish option from the web project context menu. The following publish wizard screen will show:
Select New Profile …
The following Publish Target screen opens:
Select Container Registry and Docker Hub.
Click on Publish. Select Create profile in the drop-down options.
In the authentication screen that opens, enter your docker user account name and password.
Click on Save.
The Publish screen will display:
The URL to your repository in docker will be of the format:
Click on Publish.
The output window will show the image build and deployment progress.
The following step in the build:
Step 4/16 : FROM microsoft/aspnetcore-build:2.0 AS build 2.0: Pulling from microsoft/aspnetcore-build
Will could take a while (time depending on your internet download speed).
Once all the publication steps have completed, you will see output like that shown below:
Once the build phase completes, the docker image will also be re-built within the docker images on your machine:
the docker image deployment to docker hub commences in a separate command line process. This is the push process:
Once building and publishing is completed, open the docker hub
(and login if required). Go to repositories. The new docker image will show in the list of repositories as shown:
Click on the repository view icon as shown:
The repository details will show:
The repository does not have a tag. You can add a new tag by pushing a new one with the following command:
docker push [dockeraccount]/[repositoryname]:tagname
Select the Tags tabbed menu. You will see the Digest, OS and Size details:
Select the Builds tabbed menu. You will see the screen:
Here you will see two options, link your repository image to a GitHub or Bitbucket build.
This will allow you to automate the build of your Docker source container image from a GitHub repository.
In a separate post I will show how to trigger builds of your Docker image from your Git repository.
That’s all for now.
I hope this post has been useful and informative.