SlideShare ist ein Scribd-Unternehmen logo
1 von 24
dans.knaw.nl
DANS is een instituut van KNAW en NWO
DANS Docker workshop
Vyacheslav Tykhonov
Senior Information Scientist (DANS)
Docker POC project
29.05.2018
Docker introduction
• Extremely powerful configuration tool
• Allows to install software on any platform (Linux, Mac,
Windows)
• Any software can be installed from Docker as standalone
container or container delivering Microservices (database,
search engine, core service)
• Docker allows to host unlimited amount of the same
software tools on different ports
• Docker can be used to organise multilingual interfaces, for
example
Docker advantages
• Faster development and deployments
• Isolation of running containers allows to scale apps
• Portability saves time to run the same image on the local
computer or in the cloud
• Snapshotting allows to archive Docker images state
• Resource limitation can be adjusted
Docker deployment in Clouds
• Google Cloud (policy for CESSDA SaW)
• Microsoft Azure
• Amazon Cloud
• OpenShift Cloud
• local Docker installation
dans.knaw.nl
DANS is een instituut van KNAW en NWO
Example: Dataverse as set of Docker microservices
Example: Dataverse multilanguage support
implementation
Problems:
• maintenance costs will increase
• two and more SOLR search indexes
Solutions:
At the moment there are French, Spanish and Chinese localisations.
Possible solutions to support multilingual interfaces:
• different Dataverse containers running on different ports
• implementing switch between Bundle.properties
We can provide switch for language configuration of every subdataverse.
Docker Community Edition
Ideal for developers and small teams looking to get started
with Docker https://www.docker.com/community-edition
Features:
- docker-for-desktop
- docker-compose support
- integrated kubernetes (minikube)
- kitematic: Visual Docker Container Management
Docker Hub
Docker Hub is registry with preinstalled images
Example: https://hub.docker.com/_/httpd/
$ docker pull httpd
Push images to Docker Cloud:
https://docs.docker.com/docker-cloud/builds/push-images/
$ docker login
$ docker tag my_image $DOCKER_ID_USER/my_image
$ docker push $DOCKER_ID_USER/my_image
Docker concepts
• Containers are runnable artefacts
• Images are copies of containers with filesystems
• Containers can be archived as images and executed in
different clouds
• Images can preserved in repositories
https://act.dataverse.nl/dataset.xhtml?persistentId=hdl:106
95/9VCRBR
• data folders can be hosted outside of containers
Hello world app (Flask application)
Dockerfile https://github.com/DANS-KNAW/parthenos-
widget/blob/master/Dockerfile
FROM python:2.7
MAINTAINER Vyacheslav Tykhonov
COPY . /widget
WORKDIR /widget
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
Docker command line usage
Command line allows to manage containers and images and
execute Docker commands
$ docker help run
$ docker ps
$ docker login
$ docker pull, push, commit
$ docker build, run
$ docker exec
$ docker stop, rm, rmi
Typical Docker pipeline (PARTHENOS example)
Install all dependencies and build tool from scratch:
$ docker build -t parthenos:latest .
Run image from command line
$ docker run -p 8081:8081 -name parthenos parthenos
Check if container is running
$ docker ps|grep parthenos
Login inside of the container
$ docker exec -it [CONTAINER_ID] /bin/bash
Copy configuration inside of the container
$ docker cp ./parthenos.config [CONTAINER_ID]:/widget
Copy from container to local folder
$ docker [CONTAINER_ID]:/widget/* ./
Ship “dockerized” app to the world (Docker Hub or another registry)
$ docker push [IMAGE_ID]
Pipeline explanation
Credits: Arun Gupta, Package your Java EE Application using Docker and Kubernetes
Docker archiving process
Easy process to archive running software, metadata and data
separately
https://docs.docker.com/engine/reference/commandline/save
/
• postgresql database with metadata and users information
• datasets files in separate folder
• software image with some individual settings
$ docker save -o archive.tar [CONTAINER_ID]
Easy to restore complete system with data and metadata by
Docker composer.
$ docker load archive.tar
Docker Compose
Management tool for Docker configuration for multicontainer solutions
All connections, networks, containers, port specifications stored in one file
(YML specification)
Example (DataverseEU):
https://github.com/Dans-labs/dataverse-docker
Tool to turn Docker Compose to Kubernetes config called Kompose:
https://github.com/kubernetes/kompose
Usage:
$ docker-compose [something]
Docker Compose is perfect tool to keep the PROVenance of software
(versions control, etc)
Docker Compose with variables
dataverse:
build: dataversedock/
container_name: dataverse
ports:
- "443:443"
- "8085:8080"
environment:
- "HOST_DNS_ADDRESS=0.0.0.0"
- "LANG=en"
- "GLASSFISH_DIRECTORY=/opt/glassfish4"
- "MAIL_SERVER=mailrelay.knaw.nl"
- "POSTGRES_ADMIN_PASSWORD=secret"
- "POSTGRES_SERVER=db"
- "POSTGRES_PORT=5432"
- "POSTGRES_DATABASE=dvndb"
- "POSTGRES_USER=dvnapp"
- "POSTGRES_PASSWORD=secret"
- "SOLR_LOCATION=solr:8983"
depends_on:
- postgres
- solr
https://github.com/Dans-labs/dataverse-docker/blob/da-ra/docker-multilingual.yml
Services definition with external volumes
services:
postgres:
build: postgresql/
container_name: db
ports:
- "5435:5432"
volumes:
- ./data/db:/var/lib/db
Swarm
The cluster management and orchestration features embedded
in the Docker Engine are built using swarmkit.
A swarm consists of multiple Docker hosts which run in swarm
mode and act as managers (to manage membership and
delegation) and workers (which run swarm services).
Key advantage of swarm services over standalone containers:
it’s possible to modify a service’s configuration, including the
networks and volumes it is connected to, without the need to
manually restart the service.
Swarm node is an instance of the Docker engine participating in
the swarm.
Kubernetes introduction
Open Source orchestration system developed by Google.
Kubernetes provides a container-centric management
environment.
Some useful features:
• auto-restart
• replication
• schedule across hosts
Kubernetes concepts
Pods - group of Docker containers
Service - stable name for a set of pods (as single IP)
Replication controller - manages lifecycle of every pod and
controls running containers
Label - groups of objects selection
Service definition in Kubernetes (postgres)
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f ./docker-multilingual.yml
kompose.version: 1.8.0 (0c0c027)
creationTimestamp: null
labels:
io.kompose.service: postgres
name: postgres
spec:
type: ExternalName
externalName: db
ports:
- name: "5435"
port: 5435
targetPort: 5432
selector:
io.kompose.service: postgres
status:
loadBalancer: {}
kubectl introduction
Major command to manage Kubernetes cluster
https://kubernetes.io/docs/reference/kubectl/overview/
$ kubectl get pods
$ kubectl create -f <filename>
$ kubectl update
$ kubectl delete
Questions?
Ask Slava or open a thread on Docker Forum
https://forums.docker.com
Dataverse installation manual on Docker for Amazon and
Google Cloud (contributed by Slava, Wilko, Eko):
https://docs.google.com/document/d/10slhVGt2X1TfnAzlUQtD
xZKHqwOl0tNMjEZX5YylBL4

Weitere ähnliche Inhalte

Was ist angesagt?

OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQ
dotCloud
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
Balaji Rajan
 

Was ist angesagt? (20)

Docker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registryDocker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registry
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Docker 101 @KACST Saudi HPC 2016
Docker 101  @KACST Saudi HPC 2016Docker 101  @KACST Saudi HPC 2016
Docker 101 @KACST Saudi HPC 2016
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and Azure
 
Docker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCSDocker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCS
 
Docker Intro
Docker IntroDocker Intro
Docker Intro
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQIntroduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
 
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and moreAll Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
 
Introduction to Docker
Introduction  to DockerIntroduction  to Docker
Introduction to Docker
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQ
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Docker
DockerDocker
Docker
 
HP Advanced Technology Group: Docker and Ansible
HP Advanced Technology Group: Docker and AnsibleHP Advanced Technology Group: Docker and Ansible
HP Advanced Technology Group: Docker and Ansible
 
Introduction to docker security
Introduction to docker securityIntroduction to docker security
Introduction to docker security
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerization
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 

Ähnlich wie Docker DANS workshop

Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)
Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)
Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)
Erica Windisch
 

Ähnlich wie Docker DANS workshop (20)

Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Docker 1.9 Workshop
Docker 1.9 WorkshopDocker 1.9 Workshop
Docker 1.9 Workshop
 
Docker and Microservice
Docker and MicroserviceDocker and Microservice
Docker and Microservice
 
Intro docker and demo monitor on docker
Intro docker and demo monitor on dockerIntro docker and demo monitor on docker
Intro docker and demo monitor on docker
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)
Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)
Practical Docker for OpenStack - NYC / PHL OpenStack meetup (4-23-2014)
 
Cohesion Techsessie Docker - Daniel Palstra
Cohesion Techsessie Docker - Daniel PalstraCohesion Techsessie Docker - Daniel Palstra
Cohesion Techsessie Docker - Daniel Palstra
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
 
ContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small businessContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small business
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Development
 
How to _docker
How to _dockerHow to _docker
How to _docker
 
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on AzureDocker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
 
Docker training
Docker trainingDocker training
Docker training
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
 
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker EcosystemDocker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
 
Docker slides
Docker slidesDocker slides
Docker slides
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Quick Trip with Docker
Quick Trip with DockerQuick Trip with Docker
Quick Trip with Docker
 

Mehr von vty

Mehr von vty (20)

Decentralised identifiers and knowledge graphs
Decentralised identifiers and knowledge graphs Decentralised identifiers and knowledge graphs
Decentralised identifiers and knowledge graphs
 
Decentralisation and knowledge graphs
Decentralisation and knowledge graphs Decentralisation and knowledge graphs
Decentralisation and knowledge graphs
 
Decentralised identifiers for CLARIAH infrastructure
Decentralised identifiers for CLARIAH infrastructure Decentralised identifiers for CLARIAH infrastructure
Decentralised identifiers for CLARIAH infrastructure
 
Dataverse repository for research data in the COVID-19 Museum
Dataverse repository for research data  in the COVID-19 MuseumDataverse repository for research data  in the COVID-19 Museum
Dataverse repository for research data in the COVID-19 Museum
 
Metaverse for Dataverse
Metaverse for DataverseMetaverse for Dataverse
Metaverse for Dataverse
 
Flexibility in Metadata Schemes and Standardisation: the Case of CMDI and DAN...
Flexibility in Metadata Schemes and Standardisation: the Case of CMDI and DAN...Flexibility in Metadata Schemes and Standardisation: the Case of CMDI and DAN...
Flexibility in Metadata Schemes and Standardisation: the Case of CMDI and DAN...
 
External CV support in Dataverse 5.7
External CV support in Dataverse 5.7External CV support in Dataverse 5.7
External CV support in Dataverse 5.7
 
Building COVID-19 Knowledge Graph at CoronaWhy
Building COVID-19 Knowledge Graph at CoronaWhyBuilding COVID-19 Knowledge Graph at CoronaWhy
Building COVID-19 Knowledge Graph at CoronaWhy
 
CLARIN CMDI use case and flexible metadata schemes
CLARIN CMDI use case and flexible metadata schemes CLARIN CMDI use case and flexible metadata schemes
CLARIN CMDI use case and flexible metadata schemes
 
Flexible metadata schemes for research data repositories - CLARIN Conference'21
Flexible metadata schemes for research data repositories - CLARIN Conference'21Flexible metadata schemes for research data repositories - CLARIN Conference'21
Flexible metadata schemes for research data repositories - CLARIN Conference'21
 
Controlled vocabularies and ontologies in Dataverse data repository
Controlled vocabularies and ontologies in Dataverse data repositoryControlled vocabularies and ontologies in Dataverse data repository
Controlled vocabularies and ontologies in Dataverse data repository
 
Automated CI/CD testing, installation and deployment of Dataverse infrastruct...
Automated CI/CD testing, installation and deployment of Dataverse infrastruct...Automated CI/CD testing, installation and deployment of Dataverse infrastruct...
Automated CI/CD testing, installation and deployment of Dataverse infrastruct...
 
Fighting COVID-19 with Artificial Intelligence
Fighting COVID-19 with Artificial IntelligenceFighting COVID-19 with Artificial Intelligence
Fighting COVID-19 with Artificial Intelligence
 
Building COVID-19 Museum as Open Science Project
Building COVID-19 Museum as Open Science ProjectBuilding COVID-19 Museum as Open Science Project
Building COVID-19 Museum as Open Science Project
 
External controlled vocabularies support in Dataverse
External controlled vocabularies support in DataverseExternal controlled vocabularies support in Dataverse
External controlled vocabularies support in Dataverse
 
Setting up Dataverse repository for research data
Setting up Dataverse repository for research dataSetting up Dataverse repository for research data
Setting up Dataverse repository for research data
 
Clariah Tech Day: Controlled Vocabularies and Ontologies in Dataverse
Clariah Tech Day: Controlled Vocabularies and Ontologies in DataverseClariah Tech Day: Controlled Vocabularies and Ontologies in Dataverse
Clariah Tech Day: Controlled Vocabularies and Ontologies in Dataverse
 
5 years of Dataverse evolution
5 years of Dataverse evolution 5 years of Dataverse evolution
5 years of Dataverse evolution
 
Ontologies, controlled vocabularies and Dataverse
Ontologies, controlled vocabularies and DataverseOntologies, controlled vocabularies and Dataverse
Ontologies, controlled vocabularies and Dataverse
 
CLARIN CMDI support in Dataverse
CLARIN CMDI support in Dataverse CLARIN CMDI support in Dataverse
CLARIN CMDI support in Dataverse
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Docker DANS workshop

  • 1. dans.knaw.nl DANS is een instituut van KNAW en NWO DANS Docker workshop Vyacheslav Tykhonov Senior Information Scientist (DANS) Docker POC project 29.05.2018
  • 2. Docker introduction • Extremely powerful configuration tool • Allows to install software on any platform (Linux, Mac, Windows) • Any software can be installed from Docker as standalone container or container delivering Microservices (database, search engine, core service) • Docker allows to host unlimited amount of the same software tools on different ports • Docker can be used to organise multilingual interfaces, for example
  • 3. Docker advantages • Faster development and deployments • Isolation of running containers allows to scale apps • Portability saves time to run the same image on the local computer or in the cloud • Snapshotting allows to archive Docker images state • Resource limitation can be adjusted
  • 4. Docker deployment in Clouds • Google Cloud (policy for CESSDA SaW) • Microsoft Azure • Amazon Cloud • OpenShift Cloud • local Docker installation
  • 5. dans.knaw.nl DANS is een instituut van KNAW en NWO
  • 6. Example: Dataverse as set of Docker microservices
  • 7. Example: Dataverse multilanguage support implementation Problems: • maintenance costs will increase • two and more SOLR search indexes Solutions: At the moment there are French, Spanish and Chinese localisations. Possible solutions to support multilingual interfaces: • different Dataverse containers running on different ports • implementing switch between Bundle.properties We can provide switch for language configuration of every subdataverse.
  • 8. Docker Community Edition Ideal for developers and small teams looking to get started with Docker https://www.docker.com/community-edition Features: - docker-for-desktop - docker-compose support - integrated kubernetes (minikube) - kitematic: Visual Docker Container Management
  • 9. Docker Hub Docker Hub is registry with preinstalled images Example: https://hub.docker.com/_/httpd/ $ docker pull httpd Push images to Docker Cloud: https://docs.docker.com/docker-cloud/builds/push-images/ $ docker login $ docker tag my_image $DOCKER_ID_USER/my_image $ docker push $DOCKER_ID_USER/my_image
  • 10. Docker concepts • Containers are runnable artefacts • Images are copies of containers with filesystems • Containers can be archived as images and executed in different clouds • Images can preserved in repositories https://act.dataverse.nl/dataset.xhtml?persistentId=hdl:106 95/9VCRBR • data folders can be hosted outside of containers
  • 11. Hello world app (Flask application) Dockerfile https://github.com/DANS-KNAW/parthenos- widget/blob/master/Dockerfile FROM python:2.7 MAINTAINER Vyacheslav Tykhonov COPY . /widget WORKDIR /widget RUN pip install -r requirements.txt ENTRYPOINT ["python"] CMD ["app.py"]
  • 12. Docker command line usage Command line allows to manage containers and images and execute Docker commands $ docker help run $ docker ps $ docker login $ docker pull, push, commit $ docker build, run $ docker exec $ docker stop, rm, rmi
  • 13. Typical Docker pipeline (PARTHENOS example) Install all dependencies and build tool from scratch: $ docker build -t parthenos:latest . Run image from command line $ docker run -p 8081:8081 -name parthenos parthenos Check if container is running $ docker ps|grep parthenos Login inside of the container $ docker exec -it [CONTAINER_ID] /bin/bash Copy configuration inside of the container $ docker cp ./parthenos.config [CONTAINER_ID]:/widget Copy from container to local folder $ docker [CONTAINER_ID]:/widget/* ./ Ship “dockerized” app to the world (Docker Hub or another registry) $ docker push [IMAGE_ID]
  • 14. Pipeline explanation Credits: Arun Gupta, Package your Java EE Application using Docker and Kubernetes
  • 15. Docker archiving process Easy process to archive running software, metadata and data separately https://docs.docker.com/engine/reference/commandline/save / • postgresql database with metadata and users information • datasets files in separate folder • software image with some individual settings $ docker save -o archive.tar [CONTAINER_ID] Easy to restore complete system with data and metadata by Docker composer. $ docker load archive.tar
  • 16. Docker Compose Management tool for Docker configuration for multicontainer solutions All connections, networks, containers, port specifications stored in one file (YML specification) Example (DataverseEU): https://github.com/Dans-labs/dataverse-docker Tool to turn Docker Compose to Kubernetes config called Kompose: https://github.com/kubernetes/kompose Usage: $ docker-compose [something] Docker Compose is perfect tool to keep the PROVenance of software (versions control, etc)
  • 17. Docker Compose with variables dataverse: build: dataversedock/ container_name: dataverse ports: - "443:443" - "8085:8080" environment: - "HOST_DNS_ADDRESS=0.0.0.0" - "LANG=en" - "GLASSFISH_DIRECTORY=/opt/glassfish4" - "MAIL_SERVER=mailrelay.knaw.nl" - "POSTGRES_ADMIN_PASSWORD=secret" - "POSTGRES_SERVER=db" - "POSTGRES_PORT=5432" - "POSTGRES_DATABASE=dvndb" - "POSTGRES_USER=dvnapp" - "POSTGRES_PASSWORD=secret" - "SOLR_LOCATION=solr:8983" depends_on: - postgres - solr https://github.com/Dans-labs/dataverse-docker/blob/da-ra/docker-multilingual.yml
  • 18. Services definition with external volumes services: postgres: build: postgresql/ container_name: db ports: - "5435:5432" volumes: - ./data/db:/var/lib/db
  • 19. Swarm The cluster management and orchestration features embedded in the Docker Engine are built using swarmkit. A swarm consists of multiple Docker hosts which run in swarm mode and act as managers (to manage membership and delegation) and workers (which run swarm services). Key advantage of swarm services over standalone containers: it’s possible to modify a service’s configuration, including the networks and volumes it is connected to, without the need to manually restart the service. Swarm node is an instance of the Docker engine participating in the swarm.
  • 20. Kubernetes introduction Open Source orchestration system developed by Google. Kubernetes provides a container-centric management environment. Some useful features: • auto-restart • replication • schedule across hosts
  • 21. Kubernetes concepts Pods - group of Docker containers Service - stable name for a set of pods (as single IP) Replication controller - manages lifecycle of every pod and controls running containers Label - groups of objects selection
  • 22. Service definition in Kubernetes (postgres) apiVersion: v1 kind: Service metadata: annotations: kompose.cmd: kompose convert -f ./docker-multilingual.yml kompose.version: 1.8.0 (0c0c027) creationTimestamp: null labels: io.kompose.service: postgres name: postgres spec: type: ExternalName externalName: db ports: - name: "5435" port: 5435 targetPort: 5432 selector: io.kompose.service: postgres status: loadBalancer: {}
  • 23. kubectl introduction Major command to manage Kubernetes cluster https://kubernetes.io/docs/reference/kubectl/overview/ $ kubectl get pods $ kubectl create -f <filename> $ kubectl update $ kubectl delete
  • 24. Questions? Ask Slava or open a thread on Docker Forum https://forums.docker.com Dataverse installation manual on Docker for Amazon and Google Cloud (contributed by Slava, Wilko, Eko): https://docs.google.com/document/d/10slhVGt2X1TfnAzlUQtD xZKHqwOl0tNMjEZX5YylBL4