Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker Compose: More than just development envi...

Docker Compose: More than just development environment

Ben Firshman

April 17, 2015
Tweet

More Decks by Ben Firshman

Other Decks in Technology

Transcript

  1. Multi-container apps are a hassle. • Build images from Dockerfiles

    • Pull images from the Hub or a private registry • Configure and create containers • Start and stop containers • Stream their logs
  2. Multi-container apps are a hassle. $ docker pull redis:latest $

    docker build -t web . $ docker run -d --name=db redis:latest redis-server --appendonly yes $ docker run -d --name=web --link db:db -p 5000:5000 -v `pwd`:/code web python app.py
  3. app.py from flask import Flask from redis import Redis app

    = Flask(__name__) redis = Redis(host="redis", port=6379) @@app.route('/') def hello(): redis.incr('hits') return 'Hello World! I have been seen %s times.\n' % redis.get('hits') if __name__ == "__main__": app.run(host="0.0.0.0", debug=True)
  4. Dockerfile FROM python:2.7 ADD . /code WORKDIR /code RUN pip

    install -r requirements.txt CMD python app.py
  5. Compose in CI • Just run your development environment in

    your CI script • Includes all of your dependencies • Completely self-contained
  6. Swarm • Docker-native clustering • Treat multiple Docker hosts as

    a single Docker host – same API, same tools • Pluggable backends for scheduling and discovery
  7. docker client | swarm / \ node1 node2 | |

    docker engine docker engine Swarm
  8. compose | swarm / \ node1 node2 | | docker

    engine docker engine Compose + Swarm
  9. • Currently minimal • Automatic co-scheduling of dependent containers •

    Steady improvement • Difficult parts: networking, volumes, builds Compose + Swarm
  10. • Swarm creates a single virtual Docker host out of

    several hosts • Weave networks them together • Flocker stores the data • Powerstrip ties all this together • Compose defines and runs your app Swarm + Powerstrip + Weave + Flocker + Compose!
  11. docker client | swarm / \ node1 node2 disk SSD

    | | powerstrip powerstrip flocker flocker weave weave | | docker engine docker engine
  12. compose | swarm / \ node1 node2 disk SSD |

    | powerstrip powerstrip flocker flocker weave weave | | docker engine docker engine