我试图将dotnet core 1.1中的web api与MySQL作为后端进行对等。我为我的项目添加了docker支持。
dockerfile 和 docker-compose.ci.build.yaml , docker-compose.yml 和 docker-compose。 override.yml 如下所示。但是我收到了像
这样的错误MySql.Data.MySqlClient.MySqlException:' UnableToConnectToHost' ExtendedSocketException:Connection refused ,,
dockerfile
FROM microsoft/aspnetcore:1.1
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "PDSController.dll"]
搬运工-compose.ci.build.yaml
version: '3'
services:
ci-build:
image: microsoft/aspnetcore-build:1.0-1.1
volumes:
- .:/src
working_dir: /src
command: /bin/bash -c "dotnet restore ./PDSController.sln && dotnet publish ./PDSController.sln -c Release -o ./obj/Docker/publish"
搬运工-compose.yml
version: '3'
services:
pdscontroller:
image: pdscontroller
build:
context: ./PDSController
dockerfile: Dockerfile
搬运工-compose.override.yml
version: '3'
services:
pdscontroller:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "80"
我必须在这些文件中进行哪些更改,以便在docker中运行时连接到我的数据库。我是码头工人的新手。请提前帮助,谢谢。此外,我计划将此api推送到AWS。