4

I have installed docker engine on a Linux server. On my desktop's Visual Studio 2015, I created an asp.net application. Now I want to publish it to the Linux server and create a docker image.

I followed this step.

2

I don't have an azure account and I want to use my own Linux server. So next, I clicked the Docker Containers. The interface became:

3

Then I clicked Custom Docker Host and pressed OK button.

The interface was

4

Now I input the image name as DockerDemo. Also I type the server url something like tcp://12.16.45.56:8080. Validate connection is okay then go to the next step.

Finally I get this:

5

However I get an error during publish.

Severity Code Description Project File Line Suppression State Error An error occured during publish. The command [docker -H tcp://12.16.45.56:8080 build -t DockerDemo -f "C:\Users\me\AppData\Local\Temp\PublishTemp\DockerDemo63\approot\src\DockerDemo\Dockerfile" "C:\Users\me\AppData\Local\Temp\PublishTemp\DockerDemo63"] exited with code 1: 'docker' is not recognized as an internal or external command, operable program or batch file. Please visit http://go.microsoft.com/fwlink/?LinkID=529706 for troubleshooting guide. DockerDemo 0

By the way, the framework I am using is:

  "frameworks": {
  "dnx451": { },
  "dnxcore50": { }
}

Thanks for help!

  • 1
    Well it sounds like it's trying to run docker but it's not appearing on the path it's trying to run from. Probably a bug, as it should know where to find it. But as a workaround, try adding the path to the Docker executable to your system's PATH environment variable, then restart Visual Studio and try again. – mason Mar 18 '16 at 13:32
  • @mason, forgiving my ignorance. What is the path to the Docker executable? Can you give me an example? –  Mar 18 '16 at 13:37
  • I've got no idea. Use a tool to search your computer for it? Or [install it yourself](https://docs.docker.com/windows/)? – mason Mar 18 '16 at 13:40
  • @mason, sorry for my unclear statement. I wrote the asp.net on my Windows 7 desktop. But the docker container should be on a remote Linux server. My Windows desktop doesn't have docker installed. –  Mar 18 '16 at 13:44
  • The point is that Visual Studio needs Docker installed (on your development Windows box) in order to create a Docker container that you can then deploy to your Linux box. – mason Mar 18 '16 at 14:24

1 Answers1

0

Visual Studio can't find the docker command on your local computer. It needs this as a client to connect to the docker daemon on your Linux server. The easiest way to do this is to install Docker Toolbox from here:

https://www.docker.com/products/docker-toolbox

You may have to uninstall and re-install "Visual Studio 2015 Tools for Docker" or manually add to Powershell's $env:Path if the docker command still can't be found.

Also, your Image Name must not contain uppercase characters. Use dockerdemo rather than DockerDemo.

Steve Mayne
  • 22,285
  • 4
  • 49
  • 49
  • I installed the toolbox and the environment variable `PATH` includes it now. Why it still fails? I have `docker.exe` under C:\Program Files\Docker Toolbox; –  Mar 18 '16 at 14:37
  • Is Docker.exe on your PATH? Failing that, have you restarted VS.NET? Does the error message change at all? – Steve Mayne Mar 18 '16 at 14:38
  • Yes, I am sure and I restarted VS. Same error message. –  Mar 18 '16 at 14:40
  • No, if you referring to type the command as `PS C:\Users\Me> docker`. The term is not recognized. But I check the `PATH` variable, it(C:\Program Files\Docker Toolbox;) is there. Under that folder, there is `docker.exe`. –  Mar 18 '16 at 15:01
  • Docker Toolbox is listed as a pre-requisite for the installation of VS 2015 Tools for Docker. It might be simplest to remove and re-install the Tools. Or you can change the Powershell path here: http://stackoverflow.com/questions/714877/setting-windows-powershell-path-variable – Steve Mayne Mar 18 '16 at 15:05
  • First of all, uninstall and reinstall VS 2015 Tools for Docker is still not working. Secondly, I run the command `$env:Path` in PowerShell and found the folder `C:\Program Files\Docker Toolbox` is not there. So I run `$env:path +=';C:\Program Files\Docker Toolbox'` and verified it is executing now. However when I published it, I got a different error. `exited with code [125]: invalid value "DockerDemo" for flag -t: Error parsing reference: "DockerDemo" is not a valid repository/tag See 'docker build --help'.` –  Mar 18 '16 at 19:09
  • I have added to the answer - your image name should not contain upper case characters. – Steve Mayne Mar 19 '16 at 08:07