2017-02-23 2 views
0

다른 기능을 처리하는 두 가지 응용 프로그램이 있습니다. 단일 호스트 : 포트에 단일 엔터티로 배포하고 싶습니다.ElginBeanstalk nginx가있는 MultiContainer 도커

내 계획은 elasticbeanstalk의 multicontainer docker 플랫폼을 사용하는 것입니다. 각 응용 프로그램은 컨테이너입니다.

어떻게 서로 묶을 수 있습니까? 그것은 설치 및 eb 호스트에 nginx를 구성 할 수 있습니까?

+1

호스트에 바인드 된 포트 80이있는 철거 컨테이너로 NGINX를 실행했습니다. DockerHub에서 easginy nginx 이미지를 찾아야합니다. 귀하의 컨테이너가 서로 통신해야하는 방법을 잘 모르겠지만 아마도 호스트의 소켓이 괜찮을 것이라고 생각합니다. 각 컨테이너는 소켓을 생성하고 컨테이너에 액세스 할 수있는 볼륨에 저장합니다. – nicq

답변

0

응용 프로그램을 구성하는 모든 컨테이너 (nginx 컨테이너 포함)를 Dockerrun.aws.json에 정의해야합니다.

{ 
    "AWSEBDockerrunVersion": 2, 
    "volumes": [ 
    { 
     "name": "nginx-proxy-conf", 
     "host": { 
     "sourcePath": "/var/app/current/conf.d" 
     } 
    } 
    ], 
    "containerDefinitions": [ 
    { 
     "name": "first-app", 
     "image": "FIRST_APP_IMAGE_NAME:FIRST_APP_TAG", 
     "environment": [], 
     "essential": true, 
     "memoryReservation": 200, 
     "mountPoints": [], 
     "portMappings": [ 
     { 
      "hostPort": 8081, 
      "containerPort": 8080 
     } 
     ] 
    }, 
    { 
     "name": "secondapp", 
     "image": "SECOND_APP_IMAGE_NAME:SECOND_APP_TAG", 
     "environment": [], 
     "essential": true, 
     "memoryReservation": 200, 
     "mountPoints": [], 
     "portMappings": [ 
     { 
      "hostPort": 8082, 
      "containerPort": 8080 
     } 
     ] 
    } 
    { 
     "name": "nginx-proxy", 
     "image": "nginx", 
     "essential": true, 
     "memoryReservation": 128, 
     "portMappings": [ 
     { 
      "hostPort": 80, 
      "containerPort": 80 
     } 
     ], 
     "links": [ 
     "firstapp", "secondapp" 
     ], 
     "mountPoints": [ 
     { 
      "sourceVolume": "nginx-proxy-conf", 
      "containerPath": "/etc/nginx/conf.d", 
      "readOnly": true 
     } 
     ] 
    } 
    ] 
} 

이제 우리는 nginx 컨테이너에 앱 컨테이너를 연결 했으므로 이름을 호스트 이름으로 사용할 수 있습니다.

그리고는 당신은 당신이 지정해야합니다 (conf.d 폴더에 넣어) Dockerrun.aws.json이 nginx를 설정 conf.d/default.conf 파일과 함께 압축 배포해야

location /firstapp/ { 
    proxy_pass http://firstapp; 
} 

location /secondapp/ { 
    proxy_pass http://secondapp; 
} 

도의 nginx 프록시의 AWS의 예를 참조하십시오 PHP 응용 프로그램 전에. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_v2config.html

관련 문제