我创建了一个基本的.Net Core MVC Web应用程序,并为此创建了CICD管道。 我一直在努力使其与docker stack deploy一起使用,因为我无法访问/访问服务端点。
我使用本指南来创建docker群:Docker Swarm Mode Windows
环境:仅Windows(不使用Linux映像) Docker Swarm:1个Manager(Docker1),1个Worker节点(dswarmvm2)–均为Windows Server 2016
在Build Pipeline中使用Dockerfile来构建docker映像并将其推送到私有仓库中(最初我将这个文件用于Kubernetes,但是由于Kubernetes使用Linux作为主群集,所以不能像仅使用Windows那样使用它)
In Release Pipeline, using Inline Powershell I can run docker commands as you can see in Image here.
Content of docker stack file (image here)
Result when I run the Release Pipeline (image here)
Docker服务检查
PS C:\ Users \ accountname>泊坞服务检查sampleSwarmStack_k8s-aspnetcore [ { “ ID”:“ xlctwl1qv5akdvs5dhbjy7bfx”, “版本”:{ “索引”:623 }, “ CreatedAt”:“ 2018-10-27T12:20:25.672682Z”, “ UpdatedAt”:“ 2018-10-27T12:20:25.6915483Z”, “规范”:{ “名称”:“ sampleSwarmStack_k8s-aspnetcore”, “标签”: { “ com.docker.stack.image”:“ privaterepo.azurecr.io/k8saspnetcore:latest”, “ com.docker.stack.namespace”:“ sampleSwarmStack” }, “ TaskTemplate”:{ “ ContainerSpec”:{ “图片”:“ privaterepo.azurecr.io/k8saspnetcore:latest@sha256:5457138ee8353dd3af18fe19b5085b62791274455fbe9b4bbe0a5344335 “标签”: { “ com.docker.stack.namespace”:“ sampleSwarmStack” }, “特权”:{ “ CredentialSpec”:null, “ SELinuxContext”:空 }, “ StopGracePeriod”:10000000000, “ DNSConfig”:{} }, “资源”:{}, “ RestartPolicy”:{ “条件”:“失败”, “延迟”:5000000000, “最大尝试次数”:0 }, “放置”: { “平台”:[ { “架构”:“ amd64”, “ OS”:“ windows” } ] }, “网络”:[ { “目标”:“ qvuj5fsqy8d6a0pwawmcxe89i”, “别名”:[ “ k8s-aspnetcore” ] } ], “ ForceUpdate”:0, “运行时”:“容器” }, “模式”:{ “已复制”:{ “ Replicas”:2 } }, “ UpdateConfig”:{ “平行主义”:2 “延迟”:10000000000, “ FailureAction”:“暂停”, “监视器”:5000000000, “ MaxFailureRatio”:0, “订单”:“先停” }, “ RollbackConfig”:{ “平行主义”:1, “ FailureAction”:“暂停”, “监视器”:5000000000, “ MaxFailureRatio”:0, “订单”:“先停” }, “ EndpointSpec”:{ “模式”:“ vip”, “端口”:[ { “ Protocol”:“ tcp”, “ TargetPort”:80, “ PublishedPort”:45678, “ PublishMode”:“ ingress” } ] } }, “端点”:{ “规范”:{ “模式”:“ vip”, “端口”:[ { “ Protocol”:“ tcp”, “ TargetPort”:80, “ PublishedPort”:45678, “ PublishMode”:“ ingress” } ] }, “端口”:[ { “ Protocol”:“ tcp”, “ TargetPort”:80, “ PublishedPort”:45678, “ PublishMode”:“ ingress” } ], “ VirtualIP”:[ { “ NetworkID”:“ 5vnf47q8b8fkslruqy2i6226o”, “地址”:“ 10.255.0.6/16” }, { “ NetworkID”:“ qvuj5fsqy8d6a0pwawmcxe89i”, “地址”:“ 10.0.1.2/24” } ] } } ]
Docker网络检查
PS C:\ Users \ accountname>泊坞窗网络检查sampleSwarmStack_sampleSwarmNetwork [ { “名称”:“ sampleSwarmStack_sampleSwarmNetwork”, “ Id”:“ qvuj5fsqy8d6a0pwawmcxe89i”, “ Created”:“ 2018-10-27T12:20:25.9822386Z”, “范围”:“群”, “ Driver”:“ overlay”, “ EnableIPv6”:否, “ IPAM”:{ “ Driver”:“默认”, “选项”:null, “配置”:[ { “子网”:“ 10.0.1.0/24”, “网关”:“ 10.0.1.1” } ] }, “内部”:错误, “可附加”:错误, “入口”:false, “ ConfigFrom”:{ “网络”:“” }, “ ConfigOnly”:否, “容器”:{ “ c607895ddd8c8c497d954f9d7b496910b6db636c8827f5607cfb6c8123707b62”:{ “名称”:“ sampleSwarmStack_k8s-aspnetcore.2.9wi7riuu2c5d2jhhyrs2jyy99”, “ EndpointID”:“ b5359d73d2030fcdff6a21cedf90ed8d3b97f2558dcc1d22650f035537b47c67”, “ MacAddress”:“ 00:15:5d:55:1d:5e”, “ IPv4Address”:“ 10.0.1.4/24”, “ IPv6Address”:“” } }, “选项”:{ “ com.docker.network.driver.overlay.vxlanid_list”:“ 4098”, “ com.docker.network.windowsshim.hnsid”:“ be5e2825-39b3-4388-b3ce-3e2cac1c54f2” }, “标签”: { “ com.docker.stack.namespace”:“ sampleSwarmStack” }, “对等”:[ { “名称”:“ Docker1-8f9ddc4cd238”, “ IP”:“ 10.0.1.6” }, { “名称”:“ dswarmvm2-3de39daa18fa”, “ IP”:“ 10.0.1.5” } ] } ]
我的问题是,我该如何访问Web应用程序。当我尝试使用http:// {host ip}:{port}格式访问该页面时,该页面没有显示。 Image here
预期结果应该是这样的:Image here