Dockertools: Cannot locate specified Dockerfile: DockerTest\Dockerfile

Created on 19 May 2018  路  11Comments  路  Source: microsoft/DockerTools

I installed docker for windows (edge version) Version 18.05.0-ce-win66 (17760).
I have Visual Studio 15.7.1.
I created a dot net core console app.
I added Docker support to the project targeting Linux.
When I try and run it is says this:
1>------ Build started: Project: docker-compose, Configuration: Debug Any CPU ------ 1>docker ps --filter "status=running" --filter "name=dockercompose18093898453904356706_dockertest_" --format {{.ID}} -n 1 1>DockerTest -> E:\dev\prydain2\netcore\DockerTest\DockerTest\bin\Debug\netcoreapp2.0\DockerTest.dll 1>docker-compose -f "E:\dev\prydain2\netcore\DockerTest\docker-compose.yml" -f "E:\dev\prydain2\netcore\DockerTest\docker-compose.override.yml" -f "E:\dev\prydain2\netcore\DockerTest\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose18093898453904356706 --no-ansi up -d --build --force-recreate --remove-orphans 1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string. 1>Building dockertest 1>Cannot locate specified Dockerfile: DockerTest\Dockerfile 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : The DOCKER_REGISTRY variable is not set. Defaulting to a blank string. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : Building dockertest 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : Cannot locate specified Dockerfile: DockerTest\Dockerfile. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting 1>Done building project "docker-compose.dcproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

This is a very basic example, surely this should just work.
But the troubleshooting guide and the tutorial say nothing about what is going on.

PHilip

stale

Most helpful comment

I eventually fixed it by doing both of the following:

  • In docker-compose.yml, I changed instances of
    build:
      context: .
      dockerfile: FolderName/Dockerfile

to

    build:
      context: FolderName
      dockerfile: Dockerfile

(in other words I moved the "folder" portion of the path to the Dockerfile to the context element instead).

  • Performing a solution clean, followed by a manual delete of all bin and obj folders.

All 11 comments

I have the same problem, with an existing solution that was working fine, until I installed the VS 15.7.1 update and the 18.05.0-ce-win66 (17760) Docker update.

Same for me

Same problem for me too. Occurrs on both new and existing projects after upgrading to VS 15.7.1

I eventually fixed it by doing both of the following:

  • In docker-compose.yml, I changed instances of
    build:
      context: .
      dockerfile: FolderName/Dockerfile

to

    build:
      context: FolderName
      dockerfile: Dockerfile

(in other words I moved the "folder" portion of the path to the Dockerfile to the context element instead).

  • Performing a solution clean, followed by a manual delete of all bin and obj folders.

The same problem with VS 15.7.2 and docker engine 18.05.0-ce

Looks like an issue with docker-compose 1.21.2: https://github.com/docker/compose/issues/5969

Got the same issue with Visual Studio 2017 15.7.3 and 18.05.0 (didn't write down the exact version, but it was one of the edge channel).
To fix it I uninstalled 18.05 and installed a stable version (18.03.1-ce-win65 17513) from the official website.
Now it works without modifying the docker-compose.yml file.

@TorbenJ I have this issue with 15.7.3 and 18.03.1-ce-win65 17513 (stable channel)

@Sam-Vimes that did not fix it for me either

Anybody know what the fix is?

Turns out the message is a false positive?

image

I notice this in the output window

docker-compose  -f "C:\Code\docker-compose.yml" -f "C:\Code\docker-compose.override.yml" -f "C:\Code\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose17647390188703866222 --no-ansi up -d --build --force-recreate --remove-orphans
1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.

The actual error message is above this one

1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
1>Creating dockercompose17647390188703866222_persistentsubscriber_1 ...
1>Creating dockercompose17647390188703866222_persistentsubscriber_1 ... error
1>ERROR: for dockercompose17647390188703866222.persistentsubscriber_1  Cannot create container for service persistentsubscriber: Conflict. The container name "/dockercompose17647390188703866222_persistentsubscriber_1" is already in use by container "60395aeec84c3285579b52f5a26878cf51598beb6448e0ce2d3124a6aebb23bc". You have to remove (or rename) that container to be able to reuse that name.
1>ERROR: for persistentsubscriber  Cannot create container for service persistentsubscriber: Conflict. The container name "/dockercompose17647390188703866222_persistentsubscriber_1" is already in use by container "60395aeec84c3285579b52f5a26878cf51598beb6448e0ce2d3124a6aebb23bc". You have to remove (or rename) that container to be able to reuse that name.
1>Encountered errors while bringing up the project.

Do i have to go and manually delete the docker every time i want to debug... that is like more than 10 times a day.

Is this tool supposed to update the container instead?
I can see it says --force-recreate so why is it complaining?
When I try rebuild and clean on the docker-compose I get the same visual studio error as posted.

I had this issue, tried @Sam-Vimes fix but my solution wouldn't clean or build.

It turns out I had previously added a second project to my solution which also had docker support, however I deleted it again however my docker-compose.yml and docker-compose.override.yml still had references to these images and hey presto, my solution built :)

This issue is being closed as an inactive issue. If you wish to keep it active, please let us know, we are happy to take a look!

Was this page helpful?
0 / 5 - 0 ratings