从搬运工,撰写到AWS(From docker-compose to AWS)

2019-10-30 12:04发布

我有一个docker-compose.yml

version: '2'

services:
  scheduler:
    build:
      context: .
      dockerfile: Dockerfile
    hostname: dask-scheduler
    ports:
      - "8786:8786"
      - "8787:8787"
    command: dask-scheduler

  worker:
    build:
      context: .
      dockerfile: Dockerfile
    hostname: dask-worker
    ports:
      - "8789:8789"
    command: dask-worker scheduler:8786

Dockerfile

FROM continuumio/miniconda3

RUN apt-get update && apt-get install -y build-essential freetds-dev

RUN mkdir project

COPY requirements.txt /project/requirements.txt
COPY src/ /project/src
COPY setup.py /project/setup.py
WORKDIR /project
RUN pip install -r requirements.txt
RUN python -m nltk.downloader punkt

我可以在本地使用它docker-compose up 。 接下来,我想有多个EC2节点相同的成分。 所以,我试图用ecs-cli但没有成功。 我跟着指示 ,但至今没有成功。 我得到的错误是:

WARN[0000] Skipping unsupported YAML option...           option name=networks
WARN[0000] Skipping unsupported YAML option for service...  option name=build service name=scheduler
WARN[0000] Skipping unsupported YAML option for service...  option name=networks service name=scheduler
WARN[0000] Skipping unsupported YAML option for service...  option name=build service name=worker
WARN[0000] Skipping unsupported YAML option for service...  option name=networks service name=worker
ERRO[0000] Error registering task definition             error="ClientException: Container.image should not be null or empty.\n\tstatus code: 400, request id: 1966ba7f-dbf6-11e7-a974-15857d851822" family="cs_emails"
ERRO[0000] Create task definition failed                 error="ClientException: Container.image should not be null or empty.\n\tstatus code: 400, request id: 1966ba7f-dbf6-11e7-a974-15857d851822"
FATA[0000] ClientException: Container.image should not be null or empty.
    status code: 400, request id: 1966ba7f-dbf6-11e7-a974-15857d851822

说实话,我不知道如何来解决这个问题。 任何想法?

编辑:试图把图像ECR

作为建议这个答案我建的图像,并将其推到ECR 。 此外,我改变了yml

version: '2'

services:
  scheduler:
    image: xxxx.dkr.ecr.eu-west-1.amazonaws.com/dask-poc
    hostname: dask-scheduler
    ports:
      - "8786:8786"
      - "8787:8787"
    command: dask-scheduler

  worker:
    # build:
    #   context: .
    image: xxxx.dkr.ecr.eu-west-1.amazonaws.com/dask-poc
    hostname: dask-worker
    ports:
      - "8789:8789"
    command: dask-worker scheduler:8786

现在, ecs-cli compose --file docker-compose.yml --cluster dask-poc-cluster --verbose up收益率:

INFO[0000] Using ECS task definition                     TaskDefinition="dir_name_of_projec:1"
ERRO[0000] Error running tasks                           error="InvalidParameterException: No Container Instances were found in your cluster.\n\tstatus code: 400, request id: 809171a2-dc02-11e7-bb31-a98d8b09e45a" task definition="arn:aws:ecs:eu-west-1:345891532217:task-definition/dir_name_of_project:1"
FATA[0000] InvalidParameterException: No Container Instances were found in your cluster.
    status code: 400, request id: 809171a2-dc02-11e7-bb31-a98d8b09e45a

Answer 1:

您必须使用泊坞窗撰写V3或堆栈文件使用中的节点组成的环境。



文章来源: From docker-compose to AWS