##docker-machine 활용 (Ubuntu)

AWS EC2 인스턴스에 Docker 설치하기 [1/6]


aws configure

AWS Access Key ID [None]: 
AWS Secret Access Key [None]: 
Default region name [None]: ap-northeast-2
Default output format [None]:

Untitled

Untitled

sudo groupadd docker

sudo usermod -aG docker $USER

newgrp docker

docker run hello-world

reboot

Untitled

##테스트용 웹서버 docker-compose

version: '3'
services:
  webserver:
    image: httpd
    deploy:
      replicas: 3
      placement:
        constraints: [node.role !=manager]
      restart_policy:
        condition: on-failure
        max_attempts: 3
    volumes:
      - /tem:/usr/local/apache2/htdocs
    environment:
      SERVICE_PORTS: 80
    networks:
      - web

  proxy:
    image: dockercloud/haproxy
    depends_on:
      - webserver
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - '80:80'
    networks:
      - web2
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]
  visual:
    image: dockersamples/visualizer
    ports:
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]

networks:
  web2:
    external: true
 

Use overlay networks

Untitled

#보안그룹 설정

Untitled

#ec2 별도 생성

Untitled