如何将asp.net应用程序部署到Linux服务器上的Docker容器? [英] How to deploy asp.net application to docker container on Linux server?

查看:667
本文介绍了如何将asp.net应用程序部署到Linux服务器上的Docker容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Linux服务器上安装了docker引擎。在桌面的Visual Studio 2015上,我创建了一个asp.net应用程序。现在,我想将其发布到Linux服务器并创建一个docker映像。



我关注了这个



我没有azure帐户,我想使用自己的Linux服务器。因此,接下来,我单击了 Docker Containers 。界面变为:





然后我点击了自定义Docker主机,然后按确定按钮。



界面为





现在我将图像名称输入为 DockerDemo 。我还要输入服务器URL,例如 tcp://12.16.45.56:8080 。确认连接正常,然后继续下一步。



最后我得到了:





但是在发布过程中出现错误。


严重性代码说明项目文件行抑制状态
错误发布期间发生错误。
命令[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]用代码 1 : docker未被识别为内部或外部命令,
可操作程序或批处理文件。
请访问 http://go.microsoft.com/fwlink/?LinkID= 529706 ,以获取故障排除指南。 DockerDemo 0


顺便说一句,我使用的框架是:

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

感谢帮助!

解决方案

Visual Studio在本地计算机上找不到 docker 命令。它需要它作为客户端连接到Linux服务器上的docker守护程序。最简单的方法是从此处安装Docker Toolbox:



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



您可能需要卸载并重新安装 Visual Studio 2015 Tools for Docker,或者如果仍然找不到docker命令,则手动将其添加到Powershell的 $ env:Path 中。



此外,您的图像名称不得包含大写字符。使用 dockerdemo 而不是 DockerDemo


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!

解决方案

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.

这篇关于如何将asp.net应用程序部署到Linux服务器上的Docker容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆