Why Docker? - Simplify development, testing, production and make it faster - Save time & money - Save resources - Run on every platform - Easy to use - Large (& growing) community - Open Source (Docker CE)
Docker in Testing - Deterministic tests & builds - CI ready (Gitlab CI, Travis CI) - Fast test setup & cleanup - Test exact same code and environment which 'll run in production
What is Docker? Docker is an open-source project that automates the deployment of applications inside software containers. ... Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server.
Virtualization A VM is an abstraction of physical hardware. Each VM has a full server hardware stack from virtualized BIOS to virtualized network adapters, storage, and CPU. That stack allows run any OS on your host but it takes some power.
Containers Containers are abstraction in linux kernel, just proces, memory, network, … namespaces. Containers run in same kernel as host - it is not possible use different OS or kernel version, but containers are much more faster than VMs.
Image and Container An image is an inert, immutable, file that's essentially a snapshot of a container. Images are created with the build command, and they'll produce a container when started with run. Images are stored in a Docker registry..
Common Docker Run Params --name -d - run as daemon -ti - map TTY a STDIN (for bash eg.) -e = - set ENV variable -h - set hostname -u - run command by specific user
Docker Exec docker exec -d - run command as daemon -e = - set ENV variable -ti - map TTY a STDIN (for bash eg.) -u - run command by specific user # Eg.: docker exec my-debian ls
Dockerfile Dockerfile is preferred way to create images. Dockerfile defines each layer of image by some command. To make image use command docker build
Dockerfile FROM - define base image MAINTAINER - set maintainers name & email RUN - run command and save as layer COPY - copy file or directory to image layer ADD - instead of copy, archives added by add are extracted
Dockerfile ENV - set ENV variable USER - switch user WORKDIR - change working directory VOLUME - define volume ENTRYPOINT - command, run on container starts CMD - parameters for entrypoint
What is Docker Registry? A service responsible for hosting and distributing images. The default registry is the Docker Hub. GitLab contains Docker Registry from version 8.
What is Docker Compose? Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application's services.
What is Docker Swarm? A native clustering system for Docker. It turns a pool of Docker hosts into a single, virtual host using an API proxy system. It is Docker's first container orchestration project that began in 2014. Combined with Docker Compose, it's a very convenient tool to manage containers.
Enable experimental mode # Run on all docker hosts sudo sh -c "echo '{\"experimental\": true}' > /etc/docker/daemon.json" sudo /etc/init.d/docker restart
skoleni-docker.cz I do: - inhouse training - open courses for individuals - i can do the course in Olomouc, if there 'll be demand Pristi termin workshopu: - 29. - 30. 1. 2018