我使用Docker Toolbox是因为我赢得了10家庭版。
有我的docker-compose文件:
version: "3.2"
networks:
frontend:
backend:
services:
catalog:
build:
context: .\src\Services\ProductCatalogApi
dockerfile: Dockerfile
image: microservices-v1.0.0
environment:
- DatabaseServer=mssqlserver
- DatabaseName=CatalogDb
- DatabaseUser=sa
- DatabaseUserPassword=ProductApi(!)
container_name: catalogapi
ports:
- "5000:80"
networks:
- backend
- frontend
depends_on:
- mssqlserver
mssqlserver:
image: "microsoft/mssql-server-linux:latest"
ports:
- "2200:1433"
container_name: mssqlcontainer
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=ProductApi(!)
networks:
- backend
我也有一个运行良好的mssqlserver实例,我可以毫无问题地通过地址ip连接到它。
Dockerfile:
FROM microsoft/aspnetcore-build:2.0.0 AS build
WORKDIR /code
COPY . .
RUN dotnet restore
RUN dotnet publish --output /out/ --configuration Release
FROM microsoft/aspnetcore:2.0.0
COPY --from=build /out /app/
WORKDIR /app
ENTRYPOINT ["dotnet","ProductCatalogApi.dll"]
到目前为止我尝试过什么?
答案 0 :(得分:0)
在Win 10 Home上使用docker时,您唯一需要做的就是通过VM机器的cmd地址进行检查(默认)。 指令:
docker-machine ls
然后,您将计算机的ip放在端口而不是本地主机的前面。