docker-compose up

how to build your environment

Icaro Caldeira Carreira / @icarcal

Icaro Caldeira Carreira

Tools

How I feel today, speaking in english

Docker

Definition

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.

How to

While we’ll define concepts along the way, it is good for you to understand what Docker is and why you would use Docker before we begin.

We also need to assume you are familiar with a few concepts before we continue:
  • IP Addresses and Ports
  • Virtual Machines
  • Editing configuration files
  • Basic familiarity with the ideas of code dependencies and building
  • Machine resource usage terms, like CPU percentages, RAM use in bytes, etc.

Images

A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

Containers

Container images become containers at runtime and in the case of Docker containers - images become containers when they run on Docker Engine.

Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure.

Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.

Container features

Standard: Docker created the industry standard for containers, so they could be portable anywhere

Lightweight: Containers share the machine’s OS system kernel and therefore do not require an OS per application, driving higher server efficiencies and reducing server and licensing costs

Secure: Applications are safer in containers and Docker provides the strongest default isolation capabilities in the industry

Docker vs VMs

Volumes

Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.

Volumes work on both Linux and Windows containers.

Volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality.

In addition, volumes are often a better choice than persisting data in a container’s writable layer, because a volume does not increase the size of the containers using it, and the volume’s contents exist outside the lifecycle of a given container.

Kitematic

Definition

Run containers through a simple, yet powerful graphical user interface.

How to

Now part of the Docker Toolbox (windows, mac)

Needs to be downloaded for linux through github release

Demos

Dockerfile

Definition

A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image

How to

  1. Create a Dockerfile file
  2. Define all the commands that you need to create your image
  3. Run your command

Demo

docker-compose

Definition

Compose is a tool for defining and running multi-container Docker applications.

How to

  1. Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
  2. Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
  3. Run docker-compose up and Compose starts and runs your entire app.

Demo

Cluster managment and orchestration

References

https://www.docker.com/

https://docs.docker.com/engine/reference/builder/

https://docs.docker.com/compose/

https://www.quora.com/What-are-Docker-Images

https://blog.docker.com/2018/08/containers-replacing-virtual-machines/

Questions?

@icarcal

Thanks