Coder Social home page Coder Social logo

docker-on-ecs's Introduction

Docker on ECS

A demonstration on running a Docker cluster within AWS EC2 Container Service (ECS).

Please Note: Using this repo will create billed AWS resources such as EC2 Instances (and more than one). Therefore you WILL be charge by AWS.

Contents

Usage

Run ./bin/cli for a list of commands.

$ ./bin/cli

Usage: cli [options] [command]


Commands:

  aws:cf:list-local                       List locally configured stacks
  aws:cf:create [options] <stackName>     Create a stack with the specified name.
  aws:cf:delete <stackName>               Delete the specified stack.
  aws:cf:update [options] <stackName>     Update the specified stack.
  aws:ecs:cluster:create <clusterName>    Create a cluster with the specified name.
  aws:ecs:cluster:delete <clusterName>    Delete the specified cluster.
  aws:ecs:cluster:list-local              List locally configured clusters
  aws:ecs:service:create <serviceName>    Create a service with the specified name.
  aws:ecs:service:delete <serviceName>    Delete the specified service.
  aws:ecs:service:describe <serviceName>  Describe the specified service.
  aws:ecs:service:update <serviceName>    Update the specified service.
  aws:ecs:service:list-local              List locally configured services
  aws:ecs:task:list-local                 List locally configured tasks
  aws:ecs:task:register <taskName>        Register a task definition with the specified name.
  aws:ecr:list-local                      List locally configured repositories
  aws:ecr:create <repositoryName>         Create an EC2 Container Repository with the specified name.
  aws:ecr:delete <repositoryName>         Delete the specified repository.
  aws:ecr:describe [repositoryName...]    Describe the available EC2 Container Repositories. Provide an optional list of repository names.

Options:

  -h, --help     output usage information
  -V, --version  output the version number

File Structure

Various commands within the CLI assume a certain file structure. They are outlined below.

Apps

The apps directory is a placeholder for your applications. There is a hello world example with a packer file for building a flat Docker Image and publishing to your ECR

Services

The below example has a service called demo-api.

$ tree ./src/services
./src/services
└── demo-api
    └── ecs-service-definition.json
    └── ecs-task-definition.json

The ecs-service-definition.json file is a required file in order to interact with the ECS Service Commands in the CLI. An example file:

{
    "cluster": "app-ecs-cluster",
    "taskDefinition": "demo-api",
    "desiredCount": 0,
    "deploymentConfiguration": {
        "maximumPercent": 200,
        "minimumHealthyPercent": 100
    }
}

You will notice that there is no "serviceName": "demo-api", this is injected by the relevant CLI commands.

The ecs-task-definition.json file is a required file in order to interact with the ECS Task Commands in the CLI. An example file:

{
  "containerDefinitions": [
    {
      "name": "consul",
      "environment": [],
      "links": [],
      "image": "progrium/consul:latest",
      "essential": true,
      "command": [
        "-server" ,
        "-bootstrap",
        "-ui-dir",
        "ui"
      ],
      "portMappings": [
        {
          "containerPort": 8500,
          "hostPort": 8500
        }
      ],
      "memory": 256,
      "cpu": 128
    }
  ]
}

You will notice that there is no "family": "consul", this is injected by the relevant CLI commands.

Stacks

The below example has a stack called network.

$ tree ./src/stacks
./src/stacks
└── network
    └── cf.json

The cf.json file is a required file in order to interact with the ECS CloudFormation Commands in the CLI.

docker-on-ecs's People

Contributors

ardelio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.