Docker In A Nutshell - INSPIRE

Transcription

Docker in a gwww.lat-lon.de1

Agenda What is Docker?Advantage over classical virtualizationHow to install DockerExercise: How to use Dockerwww.lat-lon.deCopyright 2016 Open Geospatial Consortium

What is Docker? Docker allows to package an application into astandardized unit for software development:– The Docker Container A Docker Container wraps apiece of software in a completefilesystem which contains allneeded resourcesA Docker Container runson Linux, Windows, macOS,and most Cloud infrastructuresImage source: https://www.docker.comwww.lat-lon.deCopyright 2016 Open Geospatial Consortium

Docker promise: Build, Ship, Run! Docker enables reliable deployments–Build here, run therewww.lat-lon.de

Advantage over classical virtualization Setting up a Virtual Machine requires additional tools forprovisioning such as Puppet, Chef, Ansible, Vagrant, shell scriptsand more .– Tools such as Packer do support builder and provisionersBut .–Docker comes with template Docker images hosted athub.docker.com–Easy to extend with custom software, libraries, files defined ina single Dockerfile–Images are version controlled and lightweight–Supports the Dev&Ops paradigm Infrastructure-as-Codewww.lat-lon.deCopyright 2016 Open Geospatial Consortium

Exercise: How to install Docker There are official installation guides available forvarious operating systems.– https://docs.docker.com/engine/installation/As installation guides are self-explanatory andDocker is pre-installed on all working stations, we canskip to the next chapter.www.lat-lon.de

Exercise: How to use Docker Check if correct Docker version is installed:docker version Run first Docker container:docker run hello-world First, Docker Image is searched locally, when not found Then, Docker Image is pulled from DockerHub. Split up command:docker pull hello-worlddocker run hello-worldwww.lat-lon.de

Exercise: How to use Docker States of a Docker application:–Dockerfile –Docker Image –Dockerfile–Image can be loaded by Docker and is used to createDocker Container.Docker Container Configuration to create a Docker Image.Instance of a Docker Image.Dockerfile islocated here!Build a Docker Image from Dockerfile with:docker build -t username/imagename .www.lat-lon.de

Exercise: How to use Docker Docker Image–List all Docker Images:docker images–Remove Docker Image with name 'imagename':docker rmi imagename Docker Container–List all Docker Containers with size:docker ps -as–Remove Docker Container 'containername':docker rm containernamewww.lat-lon.de

Exercise: How to use Docker Remove the Docker Container and Docker Image of thehello-world application.Then pull the image (with the pull command) and run itagain.www.lat-lon.de

Exercise: How to use Docker Other useful Docker commands:––––– dockerdockerdockerdockerdockercreate imagenamestart containernamestop containernamerestart containernamekill containernameThe „httpd“ Docker Image can be used to test abovedocumented commands.www.lat-lon.de

What we have learned Your are familiar with basic usage and commands ofDocker.www.lat-lon.de

Contact & Licence 2017 lat/longesellschaft für raumbezogeneinformationssysteme mbHAennchenstrasse 1953177 BonnTel: 49 228 18496-0Fax: 49 228 t-lon.de13

Exercise: How to use Docker States of a Docker application: - Dockerfile Configuration to create a Docker Image. - Docker Image Image can be loaded by Docker and is used to create Docker Container. - Docker Container Instance of a Docker Image. Dockerfile - Build a Docker Image from Dockerfile with: docker build -t username/imagename .