7

I have just created a web application with the latest .Net Core Preview sdks. I am trying to run it on Linux Docker however the project does not build.
The error I am receiving is:

Error The DOCKER_REGISTRY variable is not set.
Defaulting to a blank string.Creating network "dockercompose11433628216532645154_default" with the default driver
Building testapppreview2
Service 'testapppreview2' failed to build: manifest for microsoft/aspnetcore:2.1 not found.

My docker-compose.yml file

version: '3.4'
services:
  testapppreview2:
    image: ${DOCKER_REGISTRY}testapppreview2
    build:
      context: .
      dockerfile: TestAppPreview2/Dockerfile

Its override is:

version: '3.4'
services:
  testapppreview2:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    ports:
      - "80"

Can someone direct me some direction please?

Further information:
The error points me to this file:
C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 363

3 Answers 3

4

When you get this error you should take a look at Output -> Docker, usually it shows what is the problem. It could be that container you are trying to overwrite is running. Or some other configuration problem.

By reading Docker Output you should be able to quickly deduce what is the problem and fix it. Too bad that Visual Studio doesn't instruct you to do this, but for now only give this generic The DOCKER_REGISTRY variable is not set error.

Sign up to request clarification or add additional context in comments.

Comments

0

As the error states Error The DOCKER_REGISTRY variable is not set. - you should add it to your environment variables.

To do so simply type the following command with the corresponding registry URL into your cli:

export DOCKER_REGISTRY=<your-docker-registry>

5 Comments

How do I know what my docker registry is? I must be very naive here. I installed docker for windows, switch to Linux containers and then added the Docker Support to my existing project. I checked the docker documentation part About Registry. I could not find the answer
its default is docker.io (hub.docker.com). As you're using the variable it needs to be set. If you don't use the variable your image needs to be available at docker.io
is the above command for Linux?? I am using windows. I am now trying to add the environment the windows way
I added the docker in the variable and it still gives me the same exception
I restarted the machine and the environment change has taken effect.
0

Responding little late. I had this issue and has resolved after taken below steps.

  1. Run Visual Studio as Administrator
  2. Your running Docker host should logged-in to your DockerHub account. This is very important. The ENV variable mentioned has set after this step.

The main reason for this issue is Visual Studio couldn't download nano server image from docker hub as it couldn't see any dockerhub details. So always make sure that you logged in to your dockerhub account from running docker host or you may manually set this registry, which I think not a perfect way.

You can verify this through Visual Studio output window.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.