如何使用dotnetcore控制台应用程序处理docker-compose

时间:2018-01-30 12:02:12

标签: .net-core docker-compose console-application dockerfile

My project

我的docker-compose.yml

version: '3'

networks:
  default:
    external:
      name: rss-network

services:     
  message.api:
    image: message.api 
    build:
      context: ./
      dockerfile: Dockerfile.message
    container_name: message.api
    environment:
      - "RabbitMq/Host=rabbit"
      - "RabbitMq/Username=guest"
      - "RabbitMq/Password=guest"
      - "chatId=@chat"
      - "token=apitoken"
    links:
      - rabbit

  rabbit:
    image: rabbitmq:3.7.2-management
    hostname: rabbit
    container_name: rabbit
    ports:
      - "15672:15672"
      - "5671:5671"
      - "15671:15671"
      - "5672:5672"
      - "4369:4369"

  tracker:
    image: tracker/ 
    build:
      context: ./
      dockerfile: Dockerfile.tracker
    container_name: tracker
    environment:
      - "RabbitMq/Host=rabbit"
      - "RabbitMq/Username=guest"
      - "RabbitMq/Password=guest"
    links:
      - rabbit
      - message.api

  feeding:
    image: feeding_rss/ 
    build:
      context: ./
      dockerfile: Dockerfile.feeding_rss
    container_name: feeding_rss
    environment:
      - "RabbitMq/Host=rabbit"
      - "RabbitMq/Username=guest"
      - "RabbitMq/Password=guest"
      - "chatId=@chat"
      - "token=apitoken"
    links:
      - rabbit
      - message.api

我的dockerfiles看起来像:

FROM microsoft/dotnet:2.0.0-sdk
WORKDIR /app
COPY *.sln ./
COPY ./business_logic/*.csproj ./business_logic/
COPY ./data_access/*.csproj ./data_access/
COPY ./message/*.csproj ./message/
COPY ./tracker/*.csproj ./tracker/
COPY ./feeding_rss/*.csproj ./feeding_rss/
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o out
ENTRYPOINT ["dotnet", "out/<project-name>.dll"]

首先我得到了

  

无法连接到Docker守护程序。 docker守护程序是否正在运行   这个主持人?

我使用此命令eval $(docker-machine env default)错误消失了。 现在我在docker-compose build之后收到了这个错误:

rabbit uses an image, skipping
Building message.api Traceback (most recent call last):
   File "docker-compose", line 3, in <module>
   File "compose\cli\main.py", line 68, in main
   File "compose\cli\main.py", line 118, in perform_command
   File "compose\cli\main.py", line 239, in build
   File "compose\project.py", line 314, in build
   File "compose\service.py", line 888, in build
   File "site-packages\docker\api\build.py", line 207, in build
   File "site-packages\docker\api\build.py", line 254, in _set_auth_headers
   File "site-packages\docker\auth.py", line 85, in resolve_authconfig
   File "site-packages\docker\auth.py", line 129, in _resolve_authconfig_credstore docker.errors.DockerException: Credentials store error: StoreError('docker-credential-wincred not installed or not available in PATH',) Failed to execute script docker-compose

我收到了这个错误。

0 个答案:

没有答案