儘管遵循了大量教程和指南(包括官方文檔),但在試圖將Docker容器部署到ECS時,我經常遇到磚牆問題。無法將Docker作曲家部署到AWS ECS
這裏是我做了什麼:
ecs-cli configure --cluster my-cluster
ecs-cli up --keypair XXX --capability-iam --size 1 --instance-type t2.micro
ecs-cli compose --file docker-compose.staging.yml up
我docker-compose.staging.yml
是
version: '2'
services:
web:
mem_limit: 128m
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- src:/var/www
- vhost.staging.conf:/etc/nginx/conf.d/site.conf
- certificates:/etc/nginx/ssl
links:
- app
depends_on:
- app
app:
mem_limit: 128m
image: groberts12/php7.1-fpm-base
volumes:
- src:/var/www
運行撰寫命令後,我得到:
WARN[0000] Skipping unsupported YAML option... option name=networks
WARN[0000] Skipping unsupported YAML option for service... option name=networks service name=app
WARN[0000] Skipping unsupported YAML option for service... option name="depends_on" service name=web
WARN[0000] Skipping unsupported YAML option for service... option name=networks service name=web
INFO[0002] Using ECS task definition TaskDefinition="ecscompose-docker:5"
INFO[0002] Starting container... container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/app"
INFO[0002] Starting container... container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/web"
INFO[0002] Describe ECS container status container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/web" desiredStatus=RUNNING lastStatus=PENDING taskDefinition="ecscompose-docker:5"
INFO[0002] Describe ECS container status container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/app" desiredStatus=RUNNING lastStatus=PENDING taskDefinition="ecscompose-docker:5"
INFO[0014] Describe ECS container status container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/web" desiredStatus=RUNNING lastStatus=PENDING taskDefinition="ecscompose-docker:5"
INFO[0014] Describe ECS container status container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/app" desiredStatus=RUNNING lastStatus=PENDING taskDefinition="ecscompose-docker:5"
INFO[0026] Describe ECS container status container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/web" desiredStatus=RUNNING lastStatus=PENDING taskDefinition="ecscompose-docker:5"
INFO[0026] Describe ECS container status container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/app" desiredStatus=RUNNING lastStatus=PENDING taskDefinition="ecscompose-docker:5"
INFO[0032] Stopped container... container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/web" desiredStatus=STOPPED lastStatus=STOPPED taskDefinition="ecscompose-docker:5"
INFO[0032] Stopped container... container="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/app" desiredStatus=STOPPED lastStatus=STOPPED taskDefinition="ecscompose-docker:5"
ecs-cli ps
親切返回:
Name State Ports TaskDefinition
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/web STOPPED ExitCode: 1 xx.xxx.xxx.xxx:443->443/tcp, xx.xxx.xxx.xxx:80->80/tcp ecscompose-docker:5
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/app STOPPED ExitCode: 0 ecscompose-docker:5
以防萬一,我然後跑紡的服務了:
ecs-cli compose --file docker-compose.staging.yml service up
這花了一段時間,但最後說,這是完成:
WARN[0000] Skipping unsupported YAML option... option name=networks
WARN[0000] Skipping unsupported YAML option for service... option name=networks service name=app
WARN[0000] Skipping unsupported YAML option for service... option name="depends_on" service name=web
WARN[0000] Skipping unsupported YAML option for service... option name=networks service name=web
INFO[0001] Using ECS task definition TaskDefinition="ecscompose-docker:6"
INFO[0001] Created an ECS service service=ecscompose-service-docker taskDefinition="ecscompose-docker:6"
INFO[0002] Updated ECS service successfully desiredCount=1 serviceName=ecscompose-service-docker
INFO[0002] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0032] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0062] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0092] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0122] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0152] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0182] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0212] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0243] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0273] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0303] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0333] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0363] Describe ECS Service status desiredCount=1 runningCount=0 serviceName=ecscompose-service-docker
INFO[0378] ECS Service has reached a stable state desiredCount=1 runningCount=1 serviceName=ecscompose-service-docker
但是再次檢查進程列表時,它充滿了上述嘗試的重複。
終於連接到容器實例後,我能夠查詢ECS-代理日誌,但這並沒有真正包含很多信息,除了:
2017-03-29T15:24:11Z [WARN] Warning, link with no linkalias module="api client" linkName="app" task="ecscompose-docker:6 arn:aws:ecs:eu-west-1:571010915057:task/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, Status: (NONE->RUNNING) Containers: [web (PULLED->RUNNING),app (RUNNING->RUNNING),]" container="web(nginx:latest) (PULLED->RUNNING)"
一切工作完全正常的碼頭工人沒有任何問題,但對於devops遊戲的這一部分來說是新的,因此完全混淆了可能是什麼問題。
有什麼建議嗎?