A short introduction to what we learned over the last couple of months while developing with Docker, which problems we faced and how we used traefik.io to solved one of them.
with containers • Package software into standardised units for development, shipment and deployment • Containers run natively as a discrete process, sharing the kernel of the host machine • Tool support includes Docker Machine, Compose, Swarm • Available for Linux, macOS and Windows • Available as CE (stable, edge) 18.03 and EE 17.06 • Community-driven and open source, see https://www.opencontainers.org or https://mobyproject.org
the software • Every Dockerfile defines one ENTRYPOINT • Every entry point defines all the CMD available (serve, develop or migrate) • No shared base images • No separate build containers or multi-stage builds yet • File system performance in macOS can be bad, use cached or delegated flags for volumes to tune configurations
stored in environment variables, see https:// 12factor.net/config • The ARG instruction defines variables at build-time, passed by calling docker build … —build-arg xyz=123 • The ENV instruction defines environment variables, set at run-time by calling docker run … -e xyz=123 • .env.application file in the project folder for production-ready variables • .env file copied to the project folder for local development variables
development environment • Use a separate docker-compose.override.yml file for configuration overrides • Every dependent service defines a separate internal network • Be careful when using depends_on conditions, see https://docs.docker.com/compose/startup-order/ • Later versions are largely similar, currently using version 2.1 to 2.4
services (SMTP, AMQP) • AWS offers DynamoDB binaries to run the service locally, see https://amzn.to/2AP5rZd • There’s re-implementations like https://github.com/mhart/kinesalite to replace services • There’s entire stacks like https://github.com/localstack/localstack or https://github.com/awslabs/aws- sam-cli to mock or replace services
that spans multiple services? • Do you start each of the services locally? • Do you point them at each other by using http://localhost:xyz? • Isn’t there an easier solution?
made to deploy microservices • Supports several backends (Docker, Docker Swarm, Kubernetes, Consul, Rancher, Amazon ECS) • Configures itself automatically and dynamically • Supports multiple load balancing algorithms, HTTPS using Let's Encrypt, Circuit breakers and HA cluster mode • Written with ❤ in Go • Open source, see https://github.com/containous/traefik
by docker network create trv-studio • Every local service registered in the Docker network is called directly • Every other service is called in AWS through a local Nginx proxy • Requires SSL certificates for traefik.io • The base URL for all the services is the same, e.g. https://studio.dev.trv.cloud