Introduzione a Docker e alla Dockerizzazione.
Filosofia e progettazione Docker
Comandi principali per gesitere immagini, container, volumi e reti
Dockerfile e docker-compose
Valerio Radice @ Nextre (Maggio 2017)
TAG: docker , Dockerfile , docker-compose , italian , nextre
Gives a brief introduction of the emerging containerization technology, the difference in traditional VMs and Conatiners and the most popular one- Docker
This document provides an introduction to Docker presented by Tibor Vass, a core maintainer on Docker Engine. It outlines challenges with traditional application deployment and argues that Docker addresses these by providing lightweight containers that package code and dependencies. The key Docker concepts of images, containers, builds and Compose are introduced. Images are read-only templates for containers which sandbox applications. Builds describe how to assemble images with Dockerfiles. Compose allows defining multi-container applications. The document concludes by describing how Docker improves the deployment workflow by allowing testing and deployment of the same images across environments.
This document provides an introduction to Docker and containers. It discusses why containers are useful for software deployment given changes in the industry. Containers provide lightweight isolation of applications and their dependencies. Docker is a tool that manages containers running on the same operating system kernel. Key Docker components include the client, server, images, and containers. Popular use cases of Docker include Google running over a billion containers per week and Finnish Railways saving 50% of cloud costs with Docker.
Containers are not virtual machines - they have fundamentally different architectures and benefits. Docker allows users to build, ship, and run applications inside containers. It provides tools and a platform to manage the lifecycle of containerized applications, from development to production. Containers use layers and copy-on-write to provide efficient application isolation and delivery.
Docker is an open source containerization platform that allows applications to be easily deployed and run across various operating systems and cloud environments. It allows applications and their dependencies to be packaged into standardized executable units called containers that can be run anywhere. Containers are more portable and provide better isolation than virtual machines, making them useful for microservices architecture, continuous integration/deployment, and cloud-native applications.
Docker is a tool that allows users to package applications into containers to run on Linux servers. Containers provide isolation and resource sharing benefits compared to virtual machines. Docker simplifies deployment of containers by adding images, repositories and version control. Popular components include Dockerfiles to build images, Docker Hub for sharing images, and Docker Compose for defining multi-container apps. Docker has gained widespread adoption due to reducing complexity of managing containers across development and operations teams.
Swarm in a nutshell
Exposes several Docker Engines as a single virtual Engine
Serves the standard Docker API
Extremely easy to get started
Batteries included but swappable
Docker is a system for running applications securely isolated in a container to provide a consistent deployment environment. The document introduces Docker, discusses the challenges of deploying applications ("the matrix from hell"), and how Docker addresses these challenges by allowing applications and their dependencies to be packaged into lightweight executable containers that can run on any infrastructure. It also summarizes key Docker tools like Docker Compose for defining and running multi-container apps, Docker Machine for provisioning remote Docker hosts in various clouds, and Docker Swarm for clustering Docker hosts.
Docker allows users to package applications with all their dependencies into standardized units called containers that can run on any Linux server. Containers are more lightweight than virtual machines because they share the host operating system and only require the additional libraries and binaries needed to run the application rather than a full guest operating system. Docker uses containers and an image format to deploy applications in a consistent manner across development, testing, and production. The document provides examples of how to define a Dockerfile to build an image, run containers from images using docker-compose, and common Docker commands.
Short Introduction to Docker. These slides show the basic idea behind the container technology Docker. The slides present the basic features for the daily use with Docker, Docker Compose, Docker Machine and Docker Swarm.
Docker is specially important for DevOps, because it gives Software Developers more control about their dependencies in different environments.
This document provides an introduction to Docker and discusses:
- The challenges of managing applications across different environments which Docker aims to solve through lightweight containers.
- An overview of Docker concepts including images, containers, the Docker workflow and networking.
- How Docker Compose allows defining and running multi-container applications and Docker Swarm enables orchestrating containers across a cluster.
- The open container ecosystem including the Open Container Initiative for standardization.
This document provides an overview of Docker and the author's experience. It discusses key Docker concepts like images, containers, the Dockerfile and Docker Engine. It also summarizes Docker benefits like portability, scalability and efficiency. Components like Docker Hub, Docker Machine and orchestration tools are briefly introduced. Security considerations and using Docker in production are also mentioned.
The document introduces Docker, a container platform. It discusses how Docker addresses issues with deploying different PHP projects that have varying version requirements by allowing each project to run isolated in its own container with specified dependencies. It then covers key Docker concepts like images, containers, linking, exposing ports, volumes, and Dockerfiles. The document highlights advantages of Docker like enabling applications to run anywhere without compatibility issues and making deployment more efficient.
The document provides an overview of Docker networking as of version 17.06. It begins with introductions of the presenter and some key terminology used. It then discusses why container networking is needed and compares features of container and VM networking. The major components of Docker networking including network drivers, IPAM, Swarm networking, service discovery, and load balancing are outlined. Concepts of CNI/CNM standards and IP address management are explained. Examples of different network drivers such as bridge, overlay, macvlan are provided. The document also covers Docker networking concepts such as default networks, Swarm mode, service discovery, and load balancing. It concludes with some debugging commands and a reference slide.
The document provides information on how to write a Dockerfile, including:
- What a Dockerfile is and its purpose of providing instructions to build a Docker image
- Common Dockerfile instructions like FROM, RUN, COPY, EXPOSE, and CMD
- Best practices for writing Dockerfiles such as making images smaller, choosing the correct build context, leveraging the build cache, and ordering instructions
- Additional topics covered include the Docker build context, Dockerfile format, and tools like Docker BuildKit and Docker Scan. The presentation concludes with a demonstration of Dockerfiles.
This document provides instructions on installing and using Docker on Linux (Ubuntu) and Windows. It discusses installing Docker on Ubuntu, basic Docker commands like images, ps, pull, run options for ports, volumes, and other commands. For Windows, it recommends using Docker Toolbox which includes Docker Machine, Engine, Compose and Kitematic GUI. It also covers installing the newer Docker for Windows which requires Windows 10 Pro/Enterprise with Hyper-V enabled.
Docker allows applications to be packaged with all their dependencies and run consistently across computing environments. It provides isolation, security and portability for applications. This document discusses setting up an Eh Avatar application to run in Docker containers for Postgres, Redis and the application itself. It covers bringing up the dependency containers, building a custom Docker image for the application, and using Docker Compose to define and run the multi-container application. While this provides an introduction, there is still more to learn about optimizing Docker usage and avoiding common pitfalls.
Docker allows building portable software that can run anywhere by packaging an application and its dependencies in a standardized unit called a container. Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery. Kubernetes can replicate containers, provide load balancing, coordinate updates between containers, and ensure availability. Defining applications as Kubernetes resources allows them to be deployed and updated easily across a cluster.
Introduction to Docker storage, volume and imageejlp12
油
Docker storage drivers allow images and containers to be stored in different ways by implementing a pluggable storage driver interface. Common storage drivers include overlay2, aufs, devicemapper, and vfs. Images are composed of read-only layers stacked on top of each other, with containers adding a writable layer. Storage can be persisted using volumes, bind mounts, or tmpfs mounts. Strategies for managing persistent container data include host-based storage, volume plugins, and container storage platforms.
This document provides an introduction and overview of Docker. It discusses why Docker is useful for isolation, simplicity, and workflow. It also covers the Docker platform, including the Docker engine, images, containers, and networking. Key components are the Docker daemon, Docker CLI, and Docker Hub registry. Demos are provided on installing Docker and using Docker for building images, running containers with volumes, and configuring Docker networking.
Livin' with Docker - dallo sviluppo alla produzionegiacomos
油
Presentiamo un caso di studio di un progetto web nato e cresciuto con Docker al centro della scena. Vedremo le soluzioni scelte durante tutto il percorso, partendo da docker-compose in locale, per arrivare a CoreOS e systemd in produzione, passando per la fase di continuous integration/build e il deploy.
Talk DockerOps 13-02-2016, Ferrara
Swarm in a nutshell
Exposes several Docker Engines as a single virtual Engine
Serves the standard Docker API
Extremely easy to get started
Batteries included but swappable
Docker is a system for running applications securely isolated in a container to provide a consistent deployment environment. The document introduces Docker, discusses the challenges of deploying applications ("the matrix from hell"), and how Docker addresses these challenges by allowing applications and their dependencies to be packaged into lightweight executable containers that can run on any infrastructure. It also summarizes key Docker tools like Docker Compose for defining and running multi-container apps, Docker Machine for provisioning remote Docker hosts in various clouds, and Docker Swarm for clustering Docker hosts.
Docker allows users to package applications with all their dependencies into standardized units called containers that can run on any Linux server. Containers are more lightweight than virtual machines because they share the host operating system and only require the additional libraries and binaries needed to run the application rather than a full guest operating system. Docker uses containers and an image format to deploy applications in a consistent manner across development, testing, and production. The document provides examples of how to define a Dockerfile to build an image, run containers from images using docker-compose, and common Docker commands.
Short Introduction to Docker. These slides show the basic idea behind the container technology Docker. The slides present the basic features for the daily use with Docker, Docker Compose, Docker Machine and Docker Swarm.
Docker is specially important for DevOps, because it gives Software Developers more control about their dependencies in different environments.
This document provides an introduction to Docker and discusses:
- The challenges of managing applications across different environments which Docker aims to solve through lightweight containers.
- An overview of Docker concepts including images, containers, the Docker workflow and networking.
- How Docker Compose allows defining and running multi-container applications and Docker Swarm enables orchestrating containers across a cluster.
- The open container ecosystem including the Open Container Initiative for standardization.
This document provides an overview of Docker and the author's experience. It discusses key Docker concepts like images, containers, the Dockerfile and Docker Engine. It also summarizes Docker benefits like portability, scalability and efficiency. Components like Docker Hub, Docker Machine and orchestration tools are briefly introduced. Security considerations and using Docker in production are also mentioned.
The document introduces Docker, a container platform. It discusses how Docker addresses issues with deploying different PHP projects that have varying version requirements by allowing each project to run isolated in its own container with specified dependencies. It then covers key Docker concepts like images, containers, linking, exposing ports, volumes, and Dockerfiles. The document highlights advantages of Docker like enabling applications to run anywhere without compatibility issues and making deployment more efficient.
The document provides an overview of Docker networking as of version 17.06. It begins with introductions of the presenter and some key terminology used. It then discusses why container networking is needed and compares features of container and VM networking. The major components of Docker networking including network drivers, IPAM, Swarm networking, service discovery, and load balancing are outlined. Concepts of CNI/CNM standards and IP address management are explained. Examples of different network drivers such as bridge, overlay, macvlan are provided. The document also covers Docker networking concepts such as default networks, Swarm mode, service discovery, and load balancing. It concludes with some debugging commands and a reference slide.
The document provides information on how to write a Dockerfile, including:
- What a Dockerfile is and its purpose of providing instructions to build a Docker image
- Common Dockerfile instructions like FROM, RUN, COPY, EXPOSE, and CMD
- Best practices for writing Dockerfiles such as making images smaller, choosing the correct build context, leveraging the build cache, and ordering instructions
- Additional topics covered include the Docker build context, Dockerfile format, and tools like Docker BuildKit and Docker Scan. The presentation concludes with a demonstration of Dockerfiles.
This document provides instructions on installing and using Docker on Linux (Ubuntu) and Windows. It discusses installing Docker on Ubuntu, basic Docker commands like images, ps, pull, run options for ports, volumes, and other commands. For Windows, it recommends using Docker Toolbox which includes Docker Machine, Engine, Compose and Kitematic GUI. It also covers installing the newer Docker for Windows which requires Windows 10 Pro/Enterprise with Hyper-V enabled.
Docker allows applications to be packaged with all their dependencies and run consistently across computing environments. It provides isolation, security and portability for applications. This document discusses setting up an Eh Avatar application to run in Docker containers for Postgres, Redis and the application itself. It covers bringing up the dependency containers, building a custom Docker image for the application, and using Docker Compose to define and run the multi-container application. While this provides an introduction, there is still more to learn about optimizing Docker usage and avoiding common pitfalls.
Docker allows building portable software that can run anywhere by packaging an application and its dependencies in a standardized unit called a container. Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery. Kubernetes can replicate containers, provide load balancing, coordinate updates between containers, and ensure availability. Defining applications as Kubernetes resources allows them to be deployed and updated easily across a cluster.
Introduction to Docker storage, volume and imageejlp12
油
Docker storage drivers allow images and containers to be stored in different ways by implementing a pluggable storage driver interface. Common storage drivers include overlay2, aufs, devicemapper, and vfs. Images are composed of read-only layers stacked on top of each other, with containers adding a writable layer. Storage can be persisted using volumes, bind mounts, or tmpfs mounts. Strategies for managing persistent container data include host-based storage, volume plugins, and container storage platforms.
This document provides an introduction and overview of Docker. It discusses why Docker is useful for isolation, simplicity, and workflow. It also covers the Docker platform, including the Docker engine, images, containers, and networking. Key components are the Docker daemon, Docker CLI, and Docker Hub registry. Demos are provided on installing Docker and using Docker for building images, running containers with volumes, and configuring Docker networking.
Livin' with Docker - dallo sviluppo alla produzionegiacomos
油
Presentiamo un caso di studio di un progetto web nato e cresciuto con Docker al centro della scena. Vedremo le soluzioni scelte durante tutto il percorso, partendo da docker-compose in locale, per arrivare a CoreOS e systemd in produzione, passando per la fase di continuous integration/build e il deploy.
Talk DockerOps 13-02-2016, Ferrara
Nell'ultimo quinquennio un nuovo attore si 竪 affacciato sulla scena dell'Information Technology, il suo nome 竪 Docker. Con una crescita esponenziale ed una diffusione ancor pi湛 rapida, Docker ha trasformato il modo di percepire e utilizzare l'ICT. Una trasformazione cos狸 radicale ed estesa da non poter ignorare la domanda: Cos'竪 Docker?
Lo scopo di questa giornata 竪 di fornire una risposta a questo interrogativo, mostrando ai partecipanti nuovi scenari, per le realt dell'Universit e della Ricerca, grazie alle possibilit che Docker offre.
Latini Giuliano li guider lungo un percorso articolato secondo questi temi:
- Infrastruttura, Isolamento, Idempotenza e DevOps ovvero i vantaggi e i vincoli della definizione formale di un'infrastruttura, concetti teorici e glossario;
- Docker, un facilitatore per utilizzare i Container e le tecnologie ad essi collegate;
- Container vs Hypervisor, le due facce della stessa medaglia: pro, contro ed esempi d'uso;
- Dalla Vm alla Infrastruttura di Servizi, un modo per rimescolare le carte a nostro vantaggio;
- Sviluppo software: esempio d'uso di Docker nello sviluppo di una procedura PHP;
- Gestione di Sistemi: esempio di un'infrastruttura Wordpress organizzata a servizi, definizione formale implementata con Docker;
- Docker Swarm la clusterizzazione ed alta affidabilit, come il sistema risponde e si adatta alle sollecitazioni esterne in un sistema di calcolo;
L'obiettivo finale 竪 fornire ai partecipanti un gruppo di concetti ed esempi grazie ai quali poter approfondire autonomamente Docker, personalizzandone l'uso per le proprie necessit; in alternativa ad una trattazione dettagliata ed esaustiva di tutti i temi illustrati, impossibile nel tempo a disposizione.
A conclusione del corso verrano messi a disposizione, come materiale didattico da approfondire: slide, esempi e bibliografia di riferimento.
Apache Maven - Gestione di progetti Java e build automationTiziano Serritella
油
Apache Maven 竪 un tool per la gestione di progetti e build automation, utilizzato principalmente per progetti Java, il cui obiettivo 竪: semplificare, uniformare e automatizzare il processo di build di sistemi complessi.
In questa presentazione / guida verranno illustrati i problemi e le criticit dei tool di build automation tradizionali: make e Apache Ant, vedremo poi come installare e configurare Maven, le caratteristiche, gli obiettivi e i punti di forza del tool, le fasi del ciclo di vita, i plugin e i goal, le dipendenze, gli scope e la risoluzione di eventuali conflitti, i repository, i plugin "esterni" e i progetti multi-modulo.
La presentazione 竪 ricca di esempi pratici.
MuleSoft Meetup Roma - Runtime Fabric Series (From Zero to Hero) - Sessione 1Alfonso Martino
油
Questo slide rappresentano un approfondimento su Runtime Fabric - il modello di deployment containerizzato di MuleSoft.
Al loro interno troverete:
- Panoramica su Runtime Fabric
- Setup e configurazione di un cluster su cloud AWS
- Deployment di un'API di test
Vagrant e Docker a confronto;scegliere ed iniziareDaniele Mondello
油
Pitch presentato al Linux Day 2015 a Palermo su Vagrant e docker per confrontarli, scegliere ed iniziare. Partendo dal concetto di virtualizzazione, proseguendo con l'analisi delle due soluzioni fino a dare cenni sull'installazione ed un primo utilizzo.
Parleremo di come configurare e utilizzare Docker in un progetto Laravel per uno sviluppatore che si inserisce in un nuovo Team per la prima volta. Prendedermo come esempio alcuni progetti gi pre-costituiti come Laravel Homestead e Laradock fino ad arrivare ad a costruire un ambiente docker pi湛 strutturato con Laravel, Redis, Memcached, Laravel Echo Server per avere un ambiente facilmente deployable sul cloud.
Usare SQL Server for Linux e Docker per semplificare i processi di testing - ...Giulio Vian
油
DevOps@Work 2020
Roma, 16 January 2020
https://www.domusdotnet.org/events/
SQL Server per Linux apre un nuovo mondo di possibilit per testare il codice SQL in modi che prima non erano pensabili.
Esploriamo alcune opzioni come:
- Ripristinare il database ad uno stato noto tra un test e l'altro
- Provare pi湛 varianti di configurazione
- Eseguire test di integrazione nella pipeline CI
- Test delle migrazioni dello schema
- Attach di grossi database eseguendo i container nel cloud
際際滷 sesta lezione al linguaggio Java 8 in preparazione alla certificazione OCA 1Z0-808.
Argomenti:
Librerie indispensabili e famose (StringTokenizer, StringBuilder, DateTime API)
Collections Framework & Stream API, Gestione input e Output
Lezione del 11-01-2018 tenuta da Valerio Radice presso Nextre Engeneering
https://www.nextre.it/corso/corso-java-oca/
際際滷 quinta lezione al linguaggio Java 8 in preparazione alla certificazione OCA 1Z0-808.
Argomenti:
Invocazione virtuale dei metodi
Eccezioni, gestione e creazione
Catturare e rilanciare eccezioni
NullPointer
Operazioni lambda, Predicate e principali operazioni
Stream
Lezione del 05-12-2017 tenuta da Valerio Radice presso Nextre Engeneering
https://www.nextre.it/corso/corso-java-oca/
際際滷 quarta lezione al linguaggio Java 8 in preparazione alla certificazione OCA 1Z0-808.
Argomenti:
Design Pattern: Singleton
Classe Astratta
Interfaccia e interfaccia funzionale
Ereditariet e costruttori
Super e this
Incapsulamento
Polimorfismo
Varargs
Overload e Override
Invocazione virtuale dei metodi
Lezione del 28-11-2017 tenuta da Valerio Radice presso Nextre Engeneering
https://www.nextre.it/corso/corso-java-oca/
際際滷 introduttive al linguaggio Java 8 in preparazione alla certificazione OCA 1Z0-808.
Lezione del 12-10-2017 tenuta da Valerio Radice presso Nextre Engeneering
https://www.nextre.it/corso/corso-java-oca/
SPRING - MAVEN - REST API (ITA - Luglio 2017)Valerio Radice
油
Introduzione al framework Java Spring e Maven per realizzare API REST.
Breve introduzione all'uso di Maven per configurare un progetto SpringBoot e realizzare un server REST.
Disponibile il codice dimostrativo su github (link nelle slide, attenzione alle branch).
Valerio Radice (valix85)
Luglio 2017
Introduzioni all'uso dei preprocessori Sass e Less per la stesura di un foglio di stile CSS intelligente
Autore: Valerio Radice - valix85
Data: Giugno 2017
Breve introduzione a GIT:
. Iniziare un nuovo progetto o clonarne uno esistente
. primi commit e comandi base
. esempi di utilizzo
Autore: Valerio Radice
tag line:
Tutorial GIT ITA italiano
Analisi di tecnologie per linterazione dei visitatori all'interno di museiValerio Radice
油
Presentazione di Ubiquitous Computing - Sistemi context aware
"Analisi di tecnologie per linterazione dei visitatori all'interno di musei"
Lorenzo Airoldi - Matteo Baiguini - Rossella Nota - Valerio Radice
11/2010 - Universit degli studi di Milano Bicocca
6. 6
Questa domanda ha portati gli sviluppatori di
Google ad estendere il kernel di Linux con le
librerire cgroups, successivamente integrate
ufficialmente nel kernel linux.
Con cgroups, si ricrea un contesto di esecuzione
isolato, con un alto livello di astrazione, tanto da
imporsi come una sorta di sistema operativo
semplificato e virtualizzato che soggiace alla
base di tutte le applicazioni.
7. 7
DOCKER: cos'竪
piattaforma open-source
per la creazione di
containers
portabili, leggeri, autosufficienti
per eseguire applicazioni
Configure once... run everywhere!
Documentazione
8. 8
La conteinerizzazione
pu嘆 essere considerata figlia della
virtualizzazione
da cui si evolve in una nuova
generazione introducendo migliorie
9. 9
端 Replica ambiente di produzione
端 Modularit -> Scalabilit
端 Rapidit
端 Efficiente separazione dei servizi
端 Portabilit
端 Alta personalizzazione
DOCKER
10. 10
端 Containers
端 Immagini
端 Kernel condiviso
端 No hypervisor (niente overhead)
端 Performance migliori
端 Utilizzo solo delle risorse necessarie
DOCKER
17. 17
Ma i container possono dialogare
con i servizi offerti dalla
macchina che li ospita?
SI certamente, in ogni momento!
Vi 竪 sempre condivisione di risorse
DOMANDA
18. 18
un deployment semplificato: impacchettando unapplicazione in un singolo
componente distribuibile e configurabile con una sola linea di comando, la
tecnologia a container permette di semplificare il deployment di qualsiasi
applicazione, senza doversi preoccupare della configurazione dellambiente
di runtime;
una disponibilit rapida: virtualizzando ed astraendo solo il sistema
operativo e le componenti necessarie allesecuzione dellapplicazione, invece
che lintera macchina, lintero package si avvia in un ventesimo di secondo,
rispetto ai tempi di avvio di una VM;
BENEFICI
19. 19
un controllo pi湛 granulare: i container consentono agli operatori e agli
sviluppatori di suddividere ulteriormente le risorse computazionali in
microservizi, garantendo cos狸 un controllo superiore sulleseguibilit delle
applicazioni e un miglioramento delle prestazioni dellintero sistema.
lamministrazione dei cicli di rilascio delle applicazioni 竪 semplificato
basta pubblicare la nuova immagine docker e ricaricare il container per avere
tutto aggiornato (* salvare i dati volatili esternamente);
anche le attivit di testing traggono un beneficio economico infatti il
testing avviene solo su container perch竪 la stessa situazione verr ricreata sul
server.
BENEFICI
20. 20
CONTAINER
端 Pacchetto standardizzato contenente
software e dipendenze
端 Isola l'applicazione dal resto del
sistema
端 Condivide lo stesso kernel del
sistema operativo
端 Funziona sulla maggiorparte delle
distribuzioni linux
端 Nativo da Windows Server 2016
22. 22
WINDOWS
Installare su Windows 10 (Pro or Enterprise)
La miglior esperienza su Windows, sfortunatamente disponibile solo nelle
versioni Pro ed Enterprise.
Ti baster installare il file di installazione della versione Docker
Community Edition (CE) per Windows disponibile sul Docker Store.
Installare su Windows 7, 8, o 10 Home Edition
Sfortunatamente nelle precedenti versioni di Windows non 竪 disponibile,
nelle sue funzionalit complete, Hyper-V, cos狸 竪 necessario installare
Docker Toolbox, un approccio leggermente differente in quanto prevede
l'installazione di una macchina virtuale (VirtualBox VM) sul quale girer
docker.
https://www.docker.com/docker-windows
Documentazione
23. 23
MAC
Installare su Mac OS X >= El Capitan
La miglior procedura per utilizzare Docker su un sistema MacOS 竪
l'installazione per Mac disponibile sul Docker Store.
Installare su Mac OS X <= Yosemite
Sfortunatamente nelle precedenti versioni di Mac il MacOS Hypervisor
framework non 竪 pienamento integrato con Docker e risultanto
necessario installare Docker Toolbox, disponibile sul sito ufficiale di
Docker.
https://www.docker.com/docker-mac
Documentazione
24. 24
LINUX / UBUNTU
Installare su Linux (Kernel version >= 3.10)
La miglior procedura per utilizzare Docker su un sistema Linux 竪
installarlo da terminale con il comando:
curl -sSL https://get.docker.com/ | sh
Installare su Ubuntu (Kernel version >= 3.10)
Per la distribuzione Ubuntu 竪 dedicata una pagina apposita dal quale 竪
possibile scaricare un pacchetto per l'installazione.
https://www.docker.com/docker-ubuntu
Documentazione
26. 26
VOCABOLARIO DOCKER
Docker Image
Rappresenta la base di un Docker container, contiene l'intera applicazione.
Docker Container
L'unit standard nella quale l'applicazione vive e viene eseguita.
Docker Engine
Il motore di Docker che organizza, avvia, ferma i container pemettendo la
comunicazione e la condivisione delle risorse tra macchine virtuali e host.
Registry Service
Il servizio, cloud o locale, dove si registrano e si distribuiscono le immagini
di Docker (Docker HUB o Docker Trusted Registry).
27. 27
CODE
I comandi di docker nel nuovo formato sono strutturati in:
docker <comandoPrincipale> <comandoSecondario> [parametri]
la lista dei comandi si pu嘆 ottenere semplicimente col comando:
docker
la versione di docker installata sul sistema 竪 ottenibile da:
docker version
oppure una versione semplificata:
docker -v
docker --version
Per avere informazioni sull'installazione di docker sulla macchina
docker info
28. 28
Le immagini sono costruite sui cambiamenti del file system,
generalmente da un'immagine di partenza, ed arricchite da
metadati.
Ogni modifica 竪 contenuta in un layer, identificata da un
ID e salvate sull'host. la costruzione di un'immagine risulta
cos狸 un'operazione incrementale e quando caricher嘆 sul
mio docker hub non dovr嘆 ricaricare tutta l'immagine ma
solo le modifiche (layer).
IMAGE
29. 29
IMAGE: CODE
Per vedere le immagini in cache locale:
docker image ls
Per scaricare un'immagine dal docker hub:
docker pull <nomeImmagine>
Per cancellare un'immaigne:
docker image rm <nomeImmagine>
Per rimuovere le immagini non usate:
docker image prune
30. 30
IMAGE: CODE
Per assegnare un tag all'immagine:
docker image tag <nomeImmagine>[:TAG] <nomeImmagine>[:TAG]
Per vedere la storia di un'immagine:
docker image history <nomeImmagine>
Per vedere il contenuto/configurazione di un'immagine:
docker image inspect <nomeImmagine>
Per generare un container da un Dockerfile:
docker image build [options] <nomeImmagine>
32. 32
Il container 竪 l'istanza di un'immagine, il suo stato
pu嘆 essere salvato, tuttavia per il corretto
disaccoppiamento tra ambiente e persistenza dei
dati 竪 opportuno creare dei volumi dedicati.
Inizialmente il container 竪 la copia di un'immagine,
fino alla prima modifica, successivamente l'immagine
verr copiata e resa disponibile all'istanza di quel
container, lasciando inalterata l'immagine.
Proprio per la natura effimera del container 竪
opportuno non salvare nulla all'interno di esso, si
adotta il principio di Separation of concerns.
CONTAINER
33. 33
CONTAINER: CODE
Comando principale per gestire i container:
docker container <comandoPrincipale>
Per vedere i container attivi:
docker container ls
e tutti quelli sulla macchina:
docker container ls -a
Tutti i comandi:
docker container --help
34. 34
CONTAINER: CODE
Creare un container da un'immagine:
docker container run [-v,-d,-p, options] <nomeImmagine>
Parametri principali:
-p <portaHost>:<portaContainer> = espone una porta
-d = detached mode (resta attivo in background)
-v <nomeVolume>:<percorsoNelContainer> = Assegna un volume definito
-rm = non lascia traccia del container al termine
Per trasformare un container in una nuova immagine:
docker container commit [options] <nomeContainer | ID> <nomeImmagine>
Per esporre pi湛 volte lo stesso servizio, da docker diverse, basta esporle solo sulla
porta esterna
35. 35
CONTAINER: CODE
Per avviare un'immagine ed entrare nel suo terminale:
docker run -it <nomeImmagine> bash
Per entrare nella shell di un container gi avviato:
docker container exec -it <nomeContainer> <bash|sh>
-i = interactive mode
-t = allocate pseudo-TTY terminal
Per vedere le porte condivise tra host e container:
docker container port <nomeContainer>
Per generare un container da un template (Dockerfile) usare
docker image build -t <NomeImmagine> .
-t = specifica il nome dell'immagine, il punto indica di caricare
dal path corrente il Dockerfile (scritto con la D maiuscola!)
es: docker build -t wget
36. 36
I container sono solitamente immutabili ed effimeri, ma come fare a
mantenere le informazioni nel tempo?
Esempio
Come faccio a persistere i dati di un database che lavora in un container?
Persistent data
2 modi per farlo:
- Volumes
- Bind Mounts ( link container path to host path )
https://docs.docker.com/engine/tutorials/dockervolumes
DOMANDA
38. 38
PERSISTENT DATA: Volumes
E' un luogo speciale al di fuori del file system del container in uso
Esempio, salvare il db di un container mysql
docker pull mysql
docker image inspect mysql
#genera un volume
docker container run -d --name mysqltest -e
MYSQL_ALLOW_EMPTY_PASSWORD=True mysql
- docker container inspect mysqltest
#scopro che volumi sono presenti sul mio sistema
docker volume ls
#controllo cosa contiene il volume di mysqltest
docker volume inspect <id_volume | volume_name>
Nei sistemi linux i file sono archiviati direttamente su disco e non si perdono
quando si cancella il container. Nei sistemi Win e Mac questi sono archiviati
dentro la macchina virtuale di Docker.
39. 39
VOLUME
Creare un volume:
docker volume create <volumeName>
Elencare i volumi sulla macchina:
docker volume ls
Eliminare i volumi non usati:
docker volume prune
Eliminare un volume:
docker volume rm
Ottenere dettagli sul volume:
docker volume inspect <volumeName | ID>
40. 40
Named Volumes 竪 un sistema per ricordarsi facilmente i volumi
assegnandogli un nome.
Per creare un volume prima di creare un container fare:
docker volume create -d <nomeVolume>
docker container run -v <nomeVolume>:<percorsoNelContainer>
<nomeImmagine>
esempio:
docker container run -d --name mysqltest -e
MYSQL_ALLOW_EMPTY_PASSWORD=True -v mysql-db:/var/lib/mysql mysql
VOLUME
43. 43
PERSISTENT DATA: bind
E' un metodo per linkare una cartella sulla macchina host in un path del
container.
Pu嘆 essere effettuato solo durante la generazione del container e non nel
Dockerfile.
Tutti i file presenti nel container verranno sovrascritti dai file condivisi con la
macchina host.
Esempio
docker run -p 80:4000 -v $(pwd):/site bretfisher/jekyll-serve
Windows
docker run -p 80:4000 -v //c/example/bind:/site bretfisher/jekyll-
serve
PWD is a environment variable in bash and other shells, which is updated by the
shell on cd. So when you do echo $PWD, shell replaces $PWD as whatever its
currently storing. $XYZ means a variable for the shell, and PWD is a varibale which it
itself does create, while there is no such $pwd present.
46. 46
NET: CODE
Con docker 竪 possibile dividere ulteriormente i container con l'utilizzo di reti
virtuali dedicate, ci嘆 竪 reso possibile da un substrato che simula una rete di
default tra la macchina host ed i container (Documentazione).
La rete di default per i container, se non diversamente specificato, sar bridge
(docker0).
Per vedere le reti presenti sulla macchina:
docker network ls
Per creare una rete in fase di run usare l'attributo network:
docker run --network=<nomeRete> [parametri] <nomeImmagine>
Per vedere i comandi possibili per network vedere la guida:
docker network help
I container possono collegarsi e scollegarsi dalla rete in qualsiasi momento
47. 47
NET: CODE
Per creare una rete in fase di run usare l'attributo network:
docker network create [parametri] <nomeRete>
Per ispezionare una rete usare:
docker network inspect <nomeRete>
48. 48
NET: BRIDGE & PORT MAPPING
Per creare una rete usare il comando network create:
docker network create [parametri] <nomeRete>
Per ispezionare una rete usare:
docker network inspect <nomeRete>
50. 50
Dockerfile
Il Dockerfile 竪 un file ben preciso che ci permette di creare un'immagine,
eseguendo una serie di comandi ben precisi, specificando eventualmente delle
opzioni, che risulterebbero scomode
da scrivere su una sola riga in console.
端 Istruzioni su come creare un'immagine
端 Ottimizare operazioni sulla
configurazione dell'immagine
端 Utilizzo di comandi nativi
Documentazione & best practice
> docker image build -t demo1 .
> docker run -d -p 3000:3000 demo1
51. 51
DOCKER-COMPOSE
Il docker-compose.yml 竪 un file ben preciso, scritto in
yaml, che ci permette di creare un ambiente operativo
a partire da uno o pi湛 container.
Permette il settaggio di:
端 variabili
端 variabili d'ambiente
端 porte
端 referenze ad altri container
端 volumi
端 reti
Ci sono diverse versioni, consigliata minimo la v2
Documentazione & versioni
56. 56
DOCKER REGISTRY
Il Docker registry 竪 un repository, pubblico o privato, per il versionamento delle
immagini.
L'archiviazione 竪 affidata ad un driver di connessione remota con l'host che
archivier i contenuti. I registry non sono solo quelli di docker hub ma anche S3,
Amazon, Azure, OpenStack e molti altri.
端 Soluzione rapida per fare il deploy su un proprio cluster.
端 Miglior soluzione per la distribuzione di un immagine in un contesto isolato
Documentazione
A Docker registry stores Docker images. Docker Hub and Docker
Cloud are public registries that anyone can use, and Docker is
configured to look for images on Docker Hub by default. You can
even run your own private registry. If you use Docker Datacenter
(DDC), it includes Docker Trusted Registry (DTR).
57. 57
DOCKER HUB
Il Docker hub 竪 il luogo (repository) pubblico dove vengono caricate le immagini
che genereranno i nostri container.
Si possono trovare le immagini dei pi湛 diffusi software per lo sviluppo web e
database.
Sono presenti immagini di web server (apache, nginx, ecc... ) con preconfigurato
il supporto a diversi linguaggi di programmazione (php, ruby, python ecc... ).
Oltre alla immagini ufficiali sono presenti numerose immagine degli utenti, che,
come per github, possono caricare liberamente le loro creazioni e condividerle
con la community.
Ogni utente iscritto ottiene un proprio ID detto anche Docker ID.
58. 58
DOCKER HUB
Ogni utente pu嘆 caricare le proprie immagini sul docker hub.
Le sue immagini vengono identificate con:
<dockerID>/<nomeImmagine>:<tagVersion>
La CLI mette a disposizione dei comandi per gestire direttamente il docker hub
da console, tra cui: docker search , docker pull , docker login e docker
push.
Esempio di account:
https://hub.docker.com/r/_/wordpress/
Docker HUB & documentazione
60. 60
Dubbi o domande?
Il mio contatto diretto: valerio.radice@nextre.it
GRAZIE per l'attenzione
61. 61
BIBLIOGRAFIA & CREDITS
Special thanks to all the people who made and released these awesome
resources for free:
Docker - Official Docs
Docker (Windows)
Docker 101
Docker & Microservices
Registry
www.play-with-docker.com
courses/try-docker
Docker@youtube