Shipping and developing applications in different environments are hard and we became masters of workarounds. Docker makes our lives easier by shipping and running consistently the same container in every environment.
Docker? but I’m a developerPhoto by Axel Ahoi on Unsplash
View Slide
Michael Lancaster@weblancaster
Docker who?!
What is Docker?
HypervisorHardwareApp ABins/LibsGuest OSApp BBins/LibsGuest OSApp CBins/LibsGuest OSVMVirtual Machines
DockerHost OSHardwareBins/Libs Bins/Libs Bins/LibsRedis Nginx PythonContainersContainer
Container(writable, running application)Layered image 2(read-only)Layered image 1(read-only)Platform image(runtime environment, read-only)Image layers
Why Docker?
Cost savingsProductivity increaseConsistency across environmentsLightweightSecurityIsolation
How toInstallhttps://docs.docker.com/engine/installation/#supported-platforms
UsingCLIhttps://docs.docker.com/engine/reference/builder
$ docker run -p 8080:80 --name static -d nginxCLI:
UsingDockerfilehttps://docs.docker.com/engine/reference/builder
Dockerfile:FROM nginxCOPY build /usr/share/nginx/html$ docker build -t static-web .$ docker run -p 8080:80 --name static -d static-webBuild image:Run container:
UsingDocker-composehttps://docs.docker.com/compose/compose-file
$ docker-compose -f docker-compose.yml up -dCLI:version: “3”services:static:container_name: frontinbh_staticbuild: .ports:- "8080:80"server:image: mhart/alpine-node:latestworking_dir: /usr/src/appcontainer_name: frontinbh_servervolumes:- ./server:/usr/src/appports:- "3000:3000"command: npm startdocker-compose.yml:
Releasingthe imagehttps://docs.docker.com/docker-cloud/builds/push-images/
Tag image:$ docker tag frontinbh_static weblancaster/frontinbh_static$ docker login$ docker push weblancaster/frontinbh_staticRegistry login (Dockerhub default):Push image:
DeploymentStrategies
Thanks!https://github.com/weblancaster/frontinbh-docker-talk