How to deploy asp.net application to docker container on Linux server?

我与影子孤独终老i 提交于 2020-01-04 07:51:10

问题


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.

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:

Then I clicked Custom Docker Host and pressed OK button.

The interface was

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:

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:


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.



来源:https://stackoverflow.com/questions/36085314/how-to-deploy-asp-net-application-to-docker-container-on-linux-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!