Tutoriel DockerRelease 2019-02-28T143129517726+0100
igdevops
2019-02-28T143129517726+0100
CONTENTS
1 Introduction agrave Docker 311 Pourquoi utiliser docker 4
111 Transformation de la DSI des entreprises 4112 Pour donner davantage drsquoautonomie aux deacuteveloppeurs 4113 Faire eacutevoluer son systegraveme drsquoinformation 5114 Pour que ccedila fonctionne aussi sur une autre machine 6115 Livre blanc Ubuntu 6
12 Deacutefinitions concernant lrsquoagiliteacute et le mouvement Devops 6121 Deacutefinition de Devops p34 Programmez p214 janvier 2018 6122 Deacutefinition 2 Le Devops pour reacutepondre agrave lrsquoappel de lrsquoinnovation 2018-01-04 6123 Deacutefinition 3 extrait p53 MISC N95 Janvierfeacutevrier 2018 ldquoNe pas preacutevoir crsquoest deacutejagrave geacutemirrdquo 7
1231 Citations 712311 Ne pas preacutevoir crsquoest deacutejagrave geacutemir 712312 La vie crsquoest comme une bicyclette il faut avancer pour ne pas perdre
lrsquoeacutequilibre 7124 Devops inteacutegration et deacuteploiement continus pourquoi est-ce capital et comment y aller 8125 Agiliteacute et Devops Extrait p 35 de [Programmez] Ndeg214 janvier 2018 9126 What is a DevOps Engineer 9
13 Deacutefinitions concernant Docker 10131 Deacutefinition de Docker sur Wikipedia en franccedilais 10132 Docker est ldquoagilerdquo 10133 Docker est portable 10134 Docker est seacutecuriseacute 10135 Les conteneurs Docker sont plus leacutegers et rapides que les machines virtuelles 10
1351 Containers 101352 Virtual machines (VMs) 101353 Docker can run your applications in production at native speed 14
14 Dossier Docker dans le dossier MISC Ndeg95 de janvierfeacutevrier 2018 14
2 Installation de docker 15
3 Qui utilise Docker en production 1731 Historique 17
311 Janvier 2018 1732 Paypal 17
321 Challenges 18322 Solution 18
4 docker engine CE (Community Edition) 1941 docker engine versions 19
i
411 docker engine versions 194111 Future 194112 Versions 20
41121 1809-ce (2018-11-08) 2041122 18061-ce (2018-08-21) 2041123 18060-ce (2018-07-18) 2041124 18031-ce (2018-04-26 9ee9f40) 2041125 17121-ce (2018-02-27) 2041126 17060-ce (2017-06-23 02c1d87) 20
5 Docker compose 2151 Concepts cleacutes 21
511 Other definition 2252 Other links 22
521 heroku 2253 docker-compose commands 22
531 docker-compose commands 225311 docker-compose help 225312 docker-compose build 24
53121 docker-compose -f docker-composeyml build django 245313 docker-compose ps 245314 docker-compose up 24
54 docker-compose for production 26541 Docker compose in production 26
5411 Articles 2654111 Simple continuous deployment with docker compose docker machine and
Gitlab CI (2017-06-26) 2655 docker-compose TIPS 26
551 docker-compose tips 265511 docker-compose tips 2018 26
55111 3 Docker Compose features for improving team development workflow 2756 docker-compose versions 29
561 docker-compose versions 295611 Versions 29
56111 docker-compose 122 (2018-07-18) 2956112 docker-compose 121 (2018-04-09) 30
57 Exemples 30571 Quickstart Compose and Django 30
5711 Overview of Docker Compose 315712 Introduction 325713 Define the project components 32
57131 mkdir django_app 3257132 Create a Dockerfile 3257133 Create a requirementstxt in your project directory 3357134 Create a file called docker-composeyml in your project directory 34
5714 Create a Django project 3557141 cd django_app 3557142 docker-compose run web django-adminpy startproject composeexample 35
5715 Connect the database 3757151 Edit the composeexamplesettingspy file 3757152 django_appgt docker-compose up 3757153 docker ps 3957154 docker-compose down 41
5716 Compose file examples 41
ii
57161 Compose file examples 41572 gitlab ARM 43
5721 Overview of Docker Compose 43
6 compose-file 4561 Versions 45
611 37 45612 36 46
7 Bonnes pratiques Docker 4771 actualfa-safetyfr 4772 Best practices for writing Dockerfiles 47
721 9-pillars-of-containers-best-practices 4873 Best practices for writing Dockerfiles from Nick Janetakis 48
731 Docker Best practices from Nick Janetakis 487311 Dockerfile 497312 docker-composeyml 497313 dockerignore 497314 Example Apps for Popular Web Frameworks 497315 Flask example 50
73151 Flask Dockerfile 5073152 env file 5073153 Flask docker-composeyml 5073154 helloapppy 5173155 gitignore 51
8 Docker machine 55
9 Docker swarm 5791 Docker swarm articles 57
911 Docker swarm articles 2018 579111 Only one host for production environment What to use docker-compose or single
node swarm 5791111 Question 5791112 Response 58
10 Docker commands 59101 docker help 60102 docker attach 61103 docker build 62
1031 Description 621032 docker build ndashno-cache 62
104 docker commit 62105 docker cp 62106 docker diff 63107 docker exec 63108 docker export 63109 docker history 631010 docker inspect 631011 docker images 641012 docker kill 641013 docker login 641014 docker logs 64
10141 Description 641015 docker ps 65
iii
10151 docker ps ndashfilter 651016 docker pull 651017 docker rename 651018 docker run 65
10181 detach-keys 6510182 downloading images 6610183 labels 6610184 entrypoint 66
1019 docker search 6610191 Description 66
1020 docker system 6710201 docker system prune 67
1021 docker stop 671022 docker tag 681023 docker volume 68
11 Dockerfile 69111 Deprecated 69
1111 MAINTAINER 69
12 Docker network 71121 Las networking 71
13 Volumes Docker 73131 Use volumes 73132 Create and manage volumes 74
1321 docker volume create 741322 docker volume ls 74
14 Registry 75141 Definition 75142 Understanding image naming 75143 Use cases 76144 Implementations 76
1441 Docker Registry implementations 7614411 Gitlab Container Registry 76
144111 Historique 77144112 Administration 77144113 Examples 78
145 Examples 781451 Docker Registry examples 78
14511 Running Your Own Registry 78
15 Glossaire Docker 79
16 docker FAQ 83161 How to delete all your docker images 83162 How to run a shell in our running container 83163 How to delete stopped containers 84164 Where can I find example compose files 84
17 Heacutebergeurs Docker 85171 Gitlab 85172 Amazon 85
iv
18 Docker documentation 87181 Docker aquasec documentation 87
1811 About this Site 87
19 Docker people 89191 Bret Fischer 89
1911 News 8919111 2018 89
192 Nick Janetakis 891921 Best practices 89
193 Mickael Bright 891931 Activiteacutes septembre 2018 agrave Grenoble 92
194 Steacutephane Beuret 921941 Activiteacutes 2018 92
19411 GNULinux Mag hors seacuterie Ndeg98 septembre 2018 9219412 GNUlinux mag Ndeg217 juillet 2018 9219413 GNUlinux mag Ndeg214 avril 2018 9219414 GNUlinux mag Ndeg211 janvier 2018 9319415 GNUlinux mag Ndeg204 mai 2017 93
20 linux techniques 95201 namespaces 95202 cgroups 95
21 Docker videos 97211 2018 97
22 Actionsnews 99221 Actionsnews 2018 99
2211 Actionsnews 2018-11 9922111 Jeudi 8 novembre 2018 sortie de Docker 1809 99
2212 Actionsnews 2018-09 9922121 Deacutemonstration de Mickael Bright agrave Grenoble 99
2213 Actionsnews 2018-08 9922131 ~jpetazzoDeacuterisquer son infrastructure avec les conteneurs 100
2214 Actionsnews 2018-06 10022141 Et je suis passeacute agrave https avec Docker et Traefik (https letsencrypt) 100
221411 Conclusion 10022142 Interesting Dockerfile and docker-compose files 100
221421 Joe Jasinski 100221422 Jeff Triplett 101221423 cookiecutter-django docker-postgres backups 101
22143 Introducing an Easier Way To Design Applications in Docker Desktop 10122144 Docker adoption 101
2215 Actionsnews mai 2018 10122151 Tutoriel pour preacuteparer son environnement de deacuteveloppement ROS avec Docker de
Mickael Baron 10222152 DjangoCon 2018 - An Intro to Docker for Djangonauts by Lacey Williams 10222153 hard-multi-tenancy-in-kubernetes 10222154 containers-security-and-echo-chambers 10222155 Aly Sivji Joe Jasinski tathagata dasgupta (t) - Docker for Data Science - PyCon 2018102
221551 Description 10222156 Creacuteez un cluster hybride ARMAMD64 (GNULinux Ndeg215 mai 2018) 103
2216 Actionsnews avril 2018 10322161 Les slides de Petazzoni pour les formations docker et kubernetes drsquoavril 2018 103
v
221611 Le reacutepertoire source des slides 103221612 Autres confeacuterences passeacutees et futures 103
22162 Docker for the busy researcher (from Erik Matsen) 103221621 Why Docker 103
2217 Actionsnews mars 2018 10422171 Jeudi 29 mars 2018 Running Your Own Registry 104
221711 Docker Registry 10422172 Jeudi 29 mars 2018 Article de Jeacuterocircme Petazzoni Containers par ougrave commencer 104
2218 Actionsnews feacutevrier 2018 10422181 Mardi 13 feacutevrier 2018 import drsquoune nouvelle base de donneacutees donneacutees
db_id3_intranet 104221811 Suppression du volume djangoid3_intranet_volume (docker volume rm
djangoid3_intranet_volume) 104221812 Import de la nouvelle base de donneacutees (docker-compose -f docker-
compose_for_existing_databaseyml up ndashbuild) 105221813 Accegraves agrave la nouvelle base de donneacutees (docker-compose exec db bash) 107221814 Arrecirct du service (docker-compose -f docker-
compose_for_existing_databaseyml down) 10922182 Mardi 13 feacutevrier 2018 mise en place drsquoune base de donneacutees PostgreSQL 102 avec
import de la base de donneacutees db_id3_intranet 109221821 docker-compose_for_existing_databaseyml 109221822 Contenu du reacutepertoire init 110
22183 Lundi 12 feacutevrier 2018 mise en place drsquoune base de donneacutees PostgreSQL 102 111221831 Dockerfile 111221832 docker-composeyml 112221833 Accegraves HeidiSQL agrave partir de la machine hocircte 112
2219 Actionsnews janvier 2018 11222191 Mercredi 31 janvier 2018 exportimport drsquoune base de donneacutees PostgreSQL (tuto-
riel PostgreSQL) 112221911 Dockerfile 113221912 docker-composeyml 113221913 Export 113221914 Import 113221915 Commandes docker-compose 113
22192 Mercredi 31 janvier 2018 Bilan mardi 30 janvier 2018 113221921 Suppression de la base db_id3_intranet 114221922 Bilan mardi 30 janvier 2018 115221923 Pour lancer PostgreSQL 115221924 Pour acceacuteder au conteneur 115221925 Livre PostgreSQL Administration et exploitation de vos bases de donneacutees 117
22193 Mardi 30 janvier 2018 eacutecriture des fichiers Dockerfile et docker-composeyml 117221931 Objectifs pour la journeacutee 117221932 Avancement deacutecouverte 117221933 Historique 117
22194 Lundi 29 janvier 2018 encore un nouveau tutoriel A Simple Recipe for DjangoDevelopment In Docker (Bonus Testing with Selenium) de Jacob Cook 117
221941 Analyse et plan de travail pour la journeacutee 118221942 Autre projet inteacuteressant 118
222 Actionsnews 2017 1192221 Actionsnews aoucirct 2017 119
22211 4 aoucirct 2017 ldquoDocker et Shorewallrdquo par Guillaume Cheramy 119222111 Creacuteer les regravegles shorewall pour Docker 119
23 Images Docker (Store Docker ex Hub docker) 121
vi
231 Nouveau le docker store httpsstoredockercom 122232 Ancien le hub docker httpshubdockercomexplore 122233 Gitlab registry 122
2331 GitLab Container Registry 12223311 Introduction 12223312 Private registry 122
233121 Private GitLab Container Registry 122234 Images OS 125
2341 Images Alpine 12523411 Short Description 12523412 Description 12523413 Dockerfile 126
234131 39 1262342 Images Debian 126
23421 Short Description 12723422 Description 12723423 Versions 127
234231 buster 1272343 Images Ubuntu 129
23431 Short Description 13023432 Description 13023433 La Philosophie drsquoUbuntu 13123434 Ubuntu Versions 131
234341 Disco 1904 131234342 Cosmic 1810 132234343 Bionic 1804 133
2344 Images CentOS 13523441 Short Description 13523442 Description 13523443 Structures 13623444 Versions 137
234441 centos 7 137235 Images langages 137
2351 Images Python 13723511 Short Description 13923512 What is Python 13923513 How to use this image 13923514 Versions 139
235141 erinxoconpybuntu Python 38 (not for mod_wsgi) 139235142 380-dev erinxoconpybuntu-docker (not for mod_wsgi) 141235143 erinxoconpybuntu Python 37 (237MB) 143235144 372 Debian strech 145235145 372 strech-slim 146235146 372 alpine 39 149
2352 Images pipenv 15223521 Short Description 15223522 What is Python 15223523 Dockerfile 15223524 How to use this image 153
2353 Images PHP 15323531 Short Description 15323532 What is PHP 154
2354 Images Ruby 15423541 Short Description 154
vii
23542 What is Ruby 1552355 Images Node 155
23551 Short Description 15523552 What is Nodejs 155
2356 Images Go (Golang) 15623561 Short Description 15623562 What is Go 156
2357 Images OpenJDK (Java) 15723571 Short Description 15723572 What is OpenJDK 15723573 How to use this image 159
236 Images webserver serveurs HTTP (serveurs Web) 1592361 Images Apache HTTPD 159
23611 Short Description 16023612 What is httpd 16023613 Configuration 16023614 SSLHTTPS 16123615 Versions 161
236151 24 classic 161236152 24 Alpine 164
2362 Images Apache HTTPD bitnami 16723621 Short Description 168
236211 What is Apache 16823622 TLDR 16823623 Docker Compose 16823624 Dockerfile 16923625 Why use Bitnami Images 16923626 Adding custom virtual hosts 169
236261 Step 1 Write your my_vhostconf file with the following content 170236262 Step 2 Mount the configuration as a volume 170
23627 Using custom SSL certificates 170236271 Step 1 Prepare your certificate files 170236272 Step 2 Run the Apache image 171
23628 Full configuration 171236281 Step 1 Run the Apache image 171236282 Step 2 Edit the configuration 171236283 Step 3 Restart Apache 172
23629 Logging 172236210 Upgrade this image 172
2362101 Step 1 Get the updated image 1722362102 Step 2 Stop and backup the currently running container 1722362103 Step 3 Remove the currently running container 1732362104 Step 4 Run the new image 173
236211 Notable Changes 1732362111 2434-r8 (2018-07-24) 1732362112 2418-r0 1732362113 2412-4-r01 174
2363 Images apache Tomcat 17423631 Short Description 17423632 What is Apache Tomcat 174
2364 Images webserver serveurs Web + reverse proxy + load balancer 17623641 Apache HTTP Server + mod_proxy 17623642 Nginx 176
236421 Images nginx (engine-x) 176
viii
237 Images authentication authentification 1772371 Images LDAP 177
238 Images db bases de donneacutees 1772381 Images PostgreSQL 177
23811 Short Description 17823812 Description 17823813 What is PostgreSQL 17923814 Environment Variables 180
238141 POSTGRES_PASSWORD 180238142 POSTGRES_USER 180238143 PGDATA 180238144 POSTGRES_DB 180238145 POSTGRES_INITDB_WALDIR 180
23815 Docker Secrets 18123816 How to extend this image 181
238161 Extends with a Dockerfile 18123817 docker-compose up 182
2382 Images MariaDB 18323821 Short Description 18423822 What is MariaDB 18423823 How to use this image 185
2383 Docker sybase 185239 Images message queue 185
2391 Images rabbitmq 18523911 What is RabbitMQ 18623912 Rabbitmq and celery 186
2310 Images outils collaboratifs 18623101 Images Gitlab community edition 186
231011 Short Description 18623102 Images Redmine 186
231021 Short Description 18723103 Images Wordpress 187
231031 Short Description 1872311 Images ldquodocumentationrdquo 189
23111 Images MiKTeX 189231111 Short Description 189
2312 Images outils scientifiques 18923121 Images Anaconda3 189
231211 Short Description 191231212 Usage 191
2313 Images apprentissage 19123131 Image dockersamplesstatic-site 19123132 Image hello world 192
231321 Short Description 192
24 Tutoriels Docker 193241 Avril 2018 container training from Jeacuterocircme Petazzoni 193
2411 Intro Avril 2018 19324111 Overview 193
241111 A brief introduction 194241112 About these slides 195241113 Docker 30000ft overview 195241114 OK Why the buzz around containers 195241115 Deployment becomes very complex 196
ix
241116 Results 196241117 Escape dependency hell 196241118 On-board developers and contributors rapidly 197241119 Implement reliable CI easily 1972411110 Use container images as build artefacts 1972411111 Decouple ldquoplumbingrdquo from application logic 1982411112 Formats and APIs before Docker 1982411113 Formats and APIs after Docker 1982411114 Shipping before Docker 1982411115 Shipping after Docker 1992411116 Example 1992411117 Devs vs Ops before Docker 1992411118 Devs vs Ops after Docker 199
24112 History of containers and Docker 200241121 First experimentations 200241122 The VPS age (until 2007-2008) 201241123 Containers = cheaper than VMs 201241124 The PAAS period (2008-2013) 201241125 Containers = easier than VMs 201241126 First public release of Docker 202241127 Docker early days (2013-2014) 202241128 First users of Docker 203241129 Positive feedback loop 2032411210 Maturity (2015-2016) 2032411211 Docker becomes an industry standard 2032411212 Docker becomes a platform 203
2412 Chapter1 Avril 2018 2042413 Chapter2 Avril 2018 container training 204
24131 Our first containers 204241311 Hello World 205241312 Starting another container 205
24132 Backgroud containers 205241321 Objectives 205241322 A non-interactive container 206241323 Run a container in the background 206241324 List running containers 206241325 View only the IDs of the containers 207241326 Combining flags 207241327 View the logs of a container 208241328 View only the tail of the logs 208241329 Follow the logs in real time 2082413210 Stop our container 2092413211 Stopping our containers 2092413212 Killing the remaining containers 210
24133 Restarting and attaching to containers 210241331 Introduction 210241332 Background and foreground 211241333 Detaching from a container 211241334 Specifying a custom detach sequence 211241335 Attaching to a container 212241336 Detaching from non-interactive containers 212241337 Restarting a container 212
24134 Understanding Docker images 213241341 Objectives 213
x
241342 What is an image 214241343 Differences between containers and images 214241344 Object-oriented programming 214241345 Wait a minute 215241346 Creating the first images 215241347 Creating other images 215241348 Images namespaces 216241349 Root namespace 2162413410 User namespace 2162413411 Self-Hosted namespace 2172413412 How do you store and manage images 2172413413 Showing current images 2172413414 Searching for images 2182413415 Downloading images 2192413416 Pulling an image 2192413417 Image and tags 2192413418 When to (not) use tags 2202413419 Section summary 220
2414 Chapter3 Avril 2018 22024141 Building images interactively 220
241411 Building images interactively 221241412 The plan 221241413 Setting up our container 222241414 Inspect the changes 223241415 Docker tracks filesystem changes 223241416 Copy-on-write security benefits 224241417 Commit our changes into a new image 224241418 Testing our new image 224241419 Tagging images 2252414110 Whatrsquos next 225
24142 Building Docker images with a Dockerfile 225241421 Objectives 226241422 Dockerfile overview 226241423 Writing our first Dockerfile 226241424 Type this into our Dockerfile 227241425 Build it 227241426 What happens when we build the image 227241427 Sending the build context to Docker 228241428 Executing each step 229241429 The caching system 2292414210 Running the image 2292414211 Using image and viewing history 2292414212 Introducing JSON syntax 2302414213 JSON syntax vs string syntax 2302414214 When to use JSON syntax and string syntax 230
24143 CMD and ENTRYPOINT 231241431 Objectives 232241432 Defining a default command 232241433 Adding CMD to our Dockerfile 232241434 Build and test our image 232241435 Overriding CMD 233241436 Using ENTRYPOINT 233241437 Adding ENTRYPOINT to our Dockerfile 233241438 Implications of JSON vs string syntax 234
xi
241439 Build and test our image 2342414310 Using CMD and ENTRYPOINT together 2342414311 CMD and ENTRYPOINT together 2352414312 Build and test our image 2352414313 Overriding the image default parameters 2362414314 Overriding ENTRYPOINT 236
24144 Copying files during the build 236241441 Objectives 237241442 Build some C code 237241443 The Dockerfile 237241444 Testing our C program 237241445 COPY and the build cache 238241446 Details 238241447 Next step multi-stage building 239
24145 Multi-stage builds 239241451 Multi-stage builds 239241452 Multi-stage builds principles 240241453 Multi-stage builds in practice 240241454 Multi-stage builds for our C program 240241455 Multi-stage build Dockerfile 240241456 Comparing singlemulti-stage build image sizes 242
24146 Publishing images to the Docker Hub 242241461 Publishing images to the Docker Hub 242241462 Logging into our Docker Hub account 243241463 Image tags and registry addresses 243241464 Image tags and registry addresses 243241465 Tagging an image to push it on the Hub 244
24147 Tips for efficient Dockerfiles 244241471 Tips for efficient Dockerfiles 245241472 Reducing the number of layers 245241473 Avoid re-installing dependencies at each build 246241474 Example ldquobadrdquo Dockerfile 246241475 Fixed Dockerfile 246241476 Embedding unit tests in the build process 247
2415 Chapter4 Avril 2018 24724151 Naming and inspecting containers 247
241511 Objectives 248241512 Naming our containers 248241513 Default names 248241514 Specifying a name 249241515 Renaming containers 249241516 Inspecting a container 249241517 Parsing JSON with the Shell 249241518 Using ndashformat 250
24152 Naming and inspecting containers 250241521 Labels 250241522 Using labels 251241523 Querying labels 251241524 Using labels to select containers (docker ps ndashfilter) 251241525 Use-cases for labels 252
24153 Getting inside a container 252241531 Objectives 253241532 Getting a shell 253241533 Not getting a shell 253
xii
241534 Viewing container processes from the host 253241535 Whatrsquos the difference between a container process and a host process 254241536 Getting a shell in a running container 254241537 Caveats 254241538 Getting a shell in a stopped container 255241539 Analyzing a stopped container 2552415310 Viewing filesystem changes 2552415311 Accessing files 2562415312 Exploring a crashed container (docker commit + docker run ndashti ndashentrypoint)2562415313 Obtaining a complete dump (docker export) 256
24154 Container networking basics 25724155 Container network drivers 25724156 Container network model 25724157 Service discovery with containers 25724158 Ambassadors 258
2416 Chapter5 Avril 2018 25824161 Local development workflow with Docker 258
241611 Objectives 259241612 Containerized local development environments 259241613 Working on the ldquonamerrdquo application 259241614 Looking at the code 259
24162 Working with volumes 260241621 Objectives 260241622 Working with volumes 261241623 Volumes are special directories in a container 261241624 Volumes bypass the copy-on-write system 261241625 Volumes can be shared across containers 262241626 Sharing app server logs with another container 262241627 Volumes exist independently of containers 262241628 Naming volumes 263241629 Using our named volumes 2632416210 Using a volume in another container 2642416211 Managing volumes explicitly 2642416212 Migrating data with ndashvolumes-from 2652416213 Data migration in practice 2652416214 Upgrading Redis 2652416215 Testing the new Redis 2662416216 Volumes lifecycle 2662416217 Checking volumes defined by an image 2662416218 Checking volumes used by a container 2662416219 Sharing a single file 2672416220 Volume plugins 2672416221 Volumes vs Mounts 2682416222 ndashmount syntax 2682416223 Section summary 268
24163 Compose for development stacks 268241631 Compose for development stacks 269241632 What is Docker Compose 269241633 Compose overview 270241634 Checking if Compose is installed 270241635 Launching Our First Stack with Compose 270241636 Launching Our First Stack with Compose 274241637 Stopping the app 274241638 The docker-composeyml file 275
xiii
241639 Compose file versions 2752416310 Containers in docker-composeyml 2762416311 Container parameters 2762416312 Compose commands 2762416313 Check container status 2772416314 Cleaning up (1) 2772416315 Cleaning up (2) 2772416316 Special handling of volumes 2782416317 Compose project name 2782416318 Running two copies of the same app 278
24164 Managing hosts with Docker Machine 2792417 Chapter6 Avril 2018 2792418 Chapter7 Avril 2018 2792419 Chapter8 Avril 2018 279
242 Les conseils et formations de Jeacuterocircme Petazzoni 2792421 Se former seul ou accompagneacute 2802422 Jeacuterocircme Petazzoni Container training 2802423 Jeacutereacutemy Garrouste 2812424 Les slides de la formation drsquoavril 2018 281
243 Funkwhale tutoriel about docker 2812431 Pre-Introduction 2812432 Introduction 2812433 Mono-container Dockerfile 2822434 httpsdevfunkwhaleaudiofunkwhalefunkwhaleblobdevelopdeployenvprodsample 284
244 Tutoriels Docker pour Windows 2862441 Installation 2872442 docker ndashversion 2872443 docker-compose ndashversion 2882444 docker-machine ndashversion 2882445 notary version 2882446 Binaires docker sous Windows 10 2882447 Where to go next 288
245 Get started (httpsdocsdockercomget-started) 2892451 docker run hello-world 2892452 docker ndashversion 2902453 Conclusion 2902454 Parts 290
24541 Get started Part2 Containers 290245411 Preacuterequis 290245412 Build the app docker build -t friendlyhello 291245413 docker images 292245414 Run the app docker run -p 400080 friendlyhello 293245415 docker container ls 293245416 docker container stop 06193b763075 293245417 Tag the image docker tag friendlyhello id3pvergainget-startedpart2 293245418 Publish the image 293245419 Pull and run the image from the remote repository 294
24542 Get started Part3 services 295245421 Prerequisites 295245422 Introduction 296245423 About services 296245424 Your first docker-composeyml file 296245425 Run your new load-balanced app 297245426 docker swarm init 297
xiv
245427 docker stack deploy -c docker-composeyml getstartedlab 297245428 docker service ls 298245429 docker service ps getstartedlab_web 2982454210 docker container ls -q 2982454211 Sous WSL (Windows Subsystem Linux) 2992454212 Scale the app 2992454213 Take down the app (docker stack rm getstartedlab) 2992454214 Take down the swarm (docker swarm leave ndashforce) 299
24543 Get started Part4 swarms 300245431 Introduction 300245432 Understanding Swarm clusters 301245433 Set up your swarm 301245434 Encore Bloqueacute 301
246 A Simple Recipe for Django Development In Docker par Adam King (Advanced tutorial) 3022461 Dockerfile Adam King 303
24611 WORKDIR 3042462 docker-composeyml Adam King 304
24621 stdin_open true ttytrue 30424622 docker-compose up -d 304
2463 Explore your container (docker-compose exec django bash) 3052464 Take a break 3052465 Next Steps Add a MySQL Database 305
24651 db 306246511 MYSQL_ROOT_PASSWORD 306
24652 DATABASE_URL 306247 Modern DevOps with Django par Jacob Cook (Advanced tutorial) 307
2471 tree 3072472 Dockerfile Jacob Cook 3082473 docker-composeyml Jacob Cook 3092474 Testing and Production 309
24741 docker-composetestyml 31024742 docker-composestagingyml 31024743 docker-composeprodyml 311
248 Django for beginners par William Vincent 3122481 Thanks to William Vincent 3132482 tree ch4-message-board-app 3142483 Installing django with pipenv and python 36 314
24831 Dockerfile 31524832 Pipfile 315
2484 docker build ndashtag gdevopsdjango36_ch4 3152485 docker images 3172486 mb_projectsettingspy 3172487 Launch the db and web services with docker-composeyml 317
24871 db 31824872 web 31824873 volumes 31824874 ports 31824875 volumes 318
2488 docker-compose run web python codemanagepy migrate ndashnoinput 3182489 docker-compose run web python codemanagepy createsuperuser 32024810 docker-compose up 32024811 docker-compose ps 32324812 docker-compose exec db bash 32324813 psql -d db -U postgres 323
xv
248131 dt 324248132 conninfo 324248133 dn 324248134 d posts_post 325
249 A Brief Intro to Docker for Djangonauts par Lacey Williams 3252491 Introduction 3262492 Annonce de lrsquoeacutecriture du tutoriel le 20 octobre 2017 3262493 Dockerfile Lacey Williams 326
24931 FROM python36 32624932 ENV PYTHONUNBUFFERED 1 32624933 ENV DJANGO_ENV dev 32624934 ENV DOCKER_CONTAINER 1 33024935 EXPOSE 8000 330
2494 docker-composeyml Lacey Williams 3302495 version lsquo3rsquo 3312496 services 331
24961 db 331249611 volumes 331
24962 web 331249621 build 331249622 command python codemanagepy migrate ndashnoinput 332249623 command python codemanagepy runserver 00008000 332
2410 Tutoriel pour preacuteparer son environnement de deacuteveloppement ROS avec Docker de Mickael Baron 33224101 Format PDF 33224102 Introduction 33224103 Conclusion 333
2411 Docker les bons reacuteflexes agrave adopter par Paul MARS (MISC 95) 33324111 Dockerfile MISC 95 33424112 Fichiers env 334
2412 Tutoriel Django step by step 3342413 Tutoriel erroneousboat Docker Django 335
24131 tree 33524132 docker-composeyml 33624133 webappDockerfile 33724134 READMEmd 337
2414 Tutoriel Utilisation de pipenv avec Docker 34124141 Les fichiers 34224142 Reacuteeacutecriture du fichier Dockerfile 34224143 apppy 34324144 docker build -t docker-pipenv-sample construction de lrsquoimage 34324145 docker run -p 50005000 docker-pipenv-sample 34524146 httplocalhost5000 34524147 docker ps 34524148 docker exec -it 1a0a3dc7924d bash 34524149 docker rm 1a0a3dc7924d suppression du conteneur agrave lrsquoarrecirct 345241410docker rmi docker-pipenv-sample suppression de lrsquoimage 346
2415 play with docker 34624151 Docker for IT Pros and System Administrators Stage 1 34624152 Docker for Beginners - Linux 346
2416 Centos7 34624161 Plan de travail 34724162 yum update 34824163 yum install -y httpscentos7iuscommunityorgius-releaserpm 35224164 yum install -y python36u python36u-libs python36u-devel python36u-pip 353
xvi
24165 python36 35624166 yum install which 35624167 which pip36 35724168 docker build -t id3centos71 35824169 docker images 364241610docker run ndashname test -it id3centos71 365241611Probleme avec regex 365241612yum install gcc 366241613yum install openldap-devel 370241614pip install pyldap 373241615Nouveau fichier Dockerfile 374
2416151Dockerfile 3742416152which python36 3742416153python36 -m pip install pipenv 374
241616Nouveau Dockerfile 3752416161Dockerfile 3752416162docker build -t id3centos7011 375
241617Nouveau fichier Dockerfile 3852416171Dockerfile 3852416172Constuction de lrsquoimage docker build -t id3centos7012 3862416173docker run ndashname id3centos712 -it id3centos7012 386
241618Nouveau dockerfile 3872416181Dockerfile 387
241619Nouveau fichier Dockerfile 3882416191Dockerfile 388
241620Nouveau fichier Dockerfile 3892417 Tutoriel Docker et Postgresql 393
24171 Modegravele de fichier docker-composeyml 39524172 docker-compose up 39624173 docker-compose run postgres psql -h postgres -U postgres 39724174 docker-compose down 39824175 docker-compose build 39824176 docker-compose up 39924177 docker-compose exec -u postgres db psql 39924178 docker ps 40124179 docker exec -it d205b9239366 bash 401241710Mardi 30 janvier 2018 402
2417101docker-composeyml 4022417102docker volume ls 4032417103docker volume inspect postgresql_volume_intranet 4032417104docker exec -it 47501acda106 bash 4032417105psql -U postgres 4042417106l (liste des bases de donneacutees) 4042417107CREATE USER id3admin WITH PASSWORD lsquoid338rsquo 4042417108CREATE DATABASE db_id3_intranet WITH OWNER = id3admin ENCODING =
lsquoUTF8rsquo CONNECTION LIMIT = -1 4042417109l 40424171010docker-compose run db env 40524171011docker-compose config 405
241711Import de la base de donneacutees 406241712Mercredi 31 janvier 2018 exportimport drsquoune base de donneacutees PostgreSQL (tutoriel Post-
greSQL) 4062417121pg_dump -U postgres ndashclean ndashcreate -f dbdumpsql db_id3_intranet 4062417122Entecircte de dbdump 406
xvii
2417123Expeacuterience substitution de db_id3_save agrave db_id3_intranet 4072417124psql -U postgres -f dbdumpsql 4082417125docker-compose stop 4092417126docker-compose build 410
241713CREATE DATABASE db_id3_save WITH TEMPLATE = template0 ENCODING = lsquoUTF8rsquoLC_COLLATE = lsquofr_FRUTF-8rsquo LC_CTYPE = lsquofr_FRUTF-8rsquo 410
2418 Docker OpenLDAP 410
25 Exemples Docker labs 411251 Samples Docker labs 411
2511 Samples Docker labs beginner 41125111 Setup 41225112 docker run hello-world 412
251121 helloc 413251122 Dockerfilebuild 414
25113 Running your first container docker pull alpine 415251131 docker pull alpine 415251132 docker images 415251133 docker run alpine ls -l 416251134 docker ps -a 416251135 docker run -it alpine binsh 417
25114 docker run ndashhelp 41825115 docker inspect alpine 42125116 Next Steps 20 Webapps with Docker 423
2512 2) Webapps with Docker (Python + Flask) 42325121 Introduction 42425122 Run a static website in a container docker run -d dockersamplesstatic-site 42425123 docker images 42525124 docker run ndashname static-site -e AUTHOR=rdquopatrickvergainrdquo -d -P
dockersamplesstatic-site 42625125 docker port static-site 42625126 docker run ndashname static-site-2 -e AUTHOR=rdquopatrickvergainrdquo -d -p 888880
dockersamplesstatic-site 42625127 docker stop static-site 42925128 docker rm static-site 42925129 Letrsquos use a shortcut to remove the second site docker rm -f static-site-2 429251210 Docker Images 429251211 docker pull ubuntu1604 430251212 Create your first image 431251213 Create a Python Flask app that displays random cat pix 431
2512131 apppy 4312512132 requirementstxt 4322512133 templatesindexhtml 4322512134 Write a Dockerfile 4332512135 Build the image (docker build -t id3pvergainmyfirstapp) 4352512136 docker images 4372512137 Run your image (docker run -p 88885000 ndashname myfirstapp
id3pvergainmyfirstapp) 4372512138 Push your image (docker push id3pvergainmyfirstapp) 4392512139 docker rm -f myfirstapp 43925121310docker ps 440
251214 Dockerfile commands summary 4402512141 FROM 4402512142 RUN 440
xviii
2512143 COPY 4402512144 CMD 4402512145 EXPOSE 4412512146 PUSH 441
251215 Next Steps Deploying an app to a Swarm 4412513 30) Deploying an app to a Swarm 441
25131 Introduction 44225132 Voting app 44225133 Deploying the app 443
251331 docker swarm init 443251332 Docker compose file docker-stackyml 443251333 docker stack deploy ndashcompose-file docker-stackyml vote 445251334 docker stack services vote 446251335 Analyse du fichier Docker compose file docker-stackyml 446
25134 Customize the app 449251341 Change the images used 449251342 Redeploy docker stack deploy ndashcompose-file docker-stackyml vote 451251343 Another test run 452251344 Remove the stack 452
25135 Next steps 453252 Exemples sur Windows 10 453
xix
xx
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 1 Logo Docker httpswwwdockercom
httpsfrwikipediaorgwikiDocker_(logiciel)
See also
bull httpsgitlabcomgdevopstuto_docker
bull httpsgdevopsgitlabiotuto_docker
bull httpsdocsdockercom
bull httpstwittercomDockerlistsdocker-captainsmembers
bull httpstwittercomdocker
bull httpsplusgooglecomcommunities108146856671494713993
bull httptrainingplay-with-dockercom
bull httpsavril2018containertraining
bull httpsgithubcomjpetazzocontainertraining
bull httpshubdockercomuid3pvergain
See also
bull httpsjpetazzogithubio20180328containers-par-ou-commencer
CONTENTS 1
Tutoriel Docker Release 2019-02-28T143129517726+0100
2 CONTENTS
CHAPTER
ONE
INTRODUCTION Agrave DOCKER
Fig 1 Le logo Docker
See also
bull httpsfrwikipediaorgwikiDocker_(logiciel)
bull httpswwwdockercom
bull httpstwittercomdocker
bull httpsenwikipediaorgwikiCloud_computing
bull httpsfrwikipediaorgwikiVirtualisation
bull httpsenwikipediaorgwikiDevops
bull httpsdocsdockercomget-started
Contents
bull Introduction agrave Docker
ndash Pourquoi utiliser docker
Transformation de la DSI des entreprises
Pour donner davantage drsquoautonomie aux deacuteveloppeurs
Faire eacutevoluer son systegraveme drsquoinformation
Pour que ccedila fonctionne aussi sur une autre machine
Livre blanc Ubuntu
ndash Deacutefinitions concernant lrsquoagiliteacute et le mouvement Devops
3
Tutoriel Docker Release 2019-02-28T143129517726+0100
Deacutefinition de Devops p34 Programmez p214 janvier 2018
Deacutefinition 2 Le Devops pour reacutepondre agrave lrsquoappel de lrsquoinnovation 2018-01-04
Deacutefinition 3 extrait p53 MISC N95 Janvierfeacutevrier 2018 ldquoNe pas preacutevoir crsquoest deacutejagrave geacutemirrdquo
middot Citations
middot Ne pas preacutevoir crsquoest deacutejagrave geacutemir
middot La vie crsquoest comme une bicyclette il faut avancer pour ne pas perdre lrsquoeacutequilibre
Devops inteacutegration et deacuteploiement continus pourquoi est-ce capital et comment y aller
Agiliteacute et Devops Extrait p 35 de [Programmez] Ndeg214 janvier 2018
What is a DevOps Engineer
ndash Deacutefinitions concernant Docker
Deacutefinition de Docker sur Wikipedia en franccedilais
Docker est ldquoagilerdquo
Docker est portable
Docker est seacutecuriseacute
Les conteneurs Docker sont plus leacutegers et rapides que les machines virtuelles
middot Containers
middot Virtual machines (VMs)
middot Docker can run your applications in production at native speed
ndash Dossier Docker dans le dossier MISC Ndeg95 de janvierfeacutevrier 2018
11 Pourquoi utiliser docker
111 Transformation de la DSI des entreprises
See also
bull httpsactualfa-safetyfrservice-awsdevops-et-transformation-dela-dsi
Trois eacutevolutions majeures convergent depuis peu et poussent agrave une transformation de la DSI des entreprises
bull la pression du time to market lrsquoacceacuteleacuteration du rythme drsquoeacutevolution des applications en particulier web poursortir au plus vite de nouvelles fonctionnaliteacutes et reacutepondre aux besoins du marcheacute
bull Le Devops pour livrer plus vite les eacutequipes de Dev font eacutevoluer leurs meacutethodes pour rendre les deacuteploiementsplus rapides freacutequents et fluides et attendent que lrsquoinfrastructure les laquo Ops raquo eacutevoluent au mecircme rythme
bull le cloud public il a atteint un niveau de maturiteacute et drsquoefficaciteacute tel qursquoune majoriteacute des DSI travaille maintenantagrave lrsquointeacutegrer souvent sous la pression des eacutequipes de deacuteveloppement
112 Pour donner davantage drsquoautonomie aux deacuteveloppeurs
See also
bull httpsactualfa-safetyfrdevopsdocker-en-production
4 Chapter 1 Introduction agrave Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
Avec Docker donnez davantage drsquoautonomie aux deacuteveloppeurs
Lrsquoun des atouts du conteneur est de donner davantage drsquoautonomie au deacuteveloppeur Ce dernier doit pouvoir travaillersur son application sans se soucier de la configuration de la machine sur laquelle il travaille il doit pouvoir deacuteveloppersur son poste de travail et pousser son conteneur sur un serveur de test puis preacute-production et jusqursquoen productionsans rencontrer de difficulteacutes
Le deacuteveloppeur doit aussi pouvoir modifier son docker et en geacuterer les versions sans se preacuteoccuper des conseacutequencespour la production
En reacutesumeacute un des beacuteneacutefices du conteneur crsquoest qursquoil doit pouvoir se deacuteployer nrsquoimporte ougrave en toute seacutecuriteacute
113 Faire eacutevoluer son systegraveme drsquoinformation
See also
bull httpslinuxfrorgforumslinux-generalpostsdocker-en-prod
Bonjour agrave tous apregraves la virtualisation il y a docker (qui a le vent en poupe) Je me dis qursquoil y a peut-ecirctre quelque choseagrave faire Le concept est assez simple lrsquoutilisation a lrsquoair souple
Comme par hasard je dois migrer le serveur intranet de ma boite actuellement il est en RHE 5x et depuis la version65 docker est inteacutegreacute par RedHat Il sert agrave plusieurs choses
bull dev pour les sites internet
bull PIM interne
bull Cacti
bull
Jrsquoaimerais bien avoir un environnement qui me permette drsquoajouter Ruby par exemple sans tout peacuteter sur les autresdevs ou installer la version de php 7 alors que le reste doit rester en php 5 la lib rrdtool 14 alors qursquoun autre doitrester en 12 Enfin le genre de chose bien prise de tecircte agrave geacuterer
Apregraves avoir lu pas mal de doc autres que celles de RH je me rend compte qursquoagrave chaque fois se sont des environnementsde dev qui sont mis en place mais jamais de la prod du vrai du concret avec du users bien bourrin
Avez-vous des exemples ou des expeacuteriences (reacuteussi ou pas) drsquoarchi en prod
11 Pourquoi utiliser docker 5
Tutoriel Docker Release 2019-02-28T143129517726+0100
114 Pour que ccedila fonctionne aussi sur une autre machine
See also
bull httpputaindecodeiofrarticlesdocker
Il eacutetait une fois un jeune deacuteveloppeur qui codait tranquillement sur son ordinateur Il eacutetait presseacute car comme touteacutetudiant qui se respecte il devait preacutesenter son travail le lendemain matin Apregraves des heures de travail lrsquoapplicationeacutetait lagrave et elle fonctionnait agrave merveille Le lendemain notre codeur arriva tout fier pour sa preacutesentation avec sonprojet sur une cleacute usb Il le transfegravere sur lrsquoordinateur de son pote et lagrave ccedila ne fonctionne pas
Quel est le problegraveme
Lrsquoapplication de notre jeune deacuteveloppeur ne fonctionne pas sur lrsquoordinateur de son ami agrave cause drsquoun problegravemedrsquoenvironnement Entre deux systegravemes il peut y avoir des diffeacuterences de version sur les deacutependances ou encoredes bibliothegraveques manquantes
115 Livre blanc Ubuntu
ubuntuWP_The_no-nonsense-way-to-accelerate-your-business-with_containerspdf
12 Deacutefinitions concernant lrsquoagiliteacute et le mouvement Devops
121 Deacutefinition de Devops p34 Programmez p214 janvier 2018
See also
bull httpsenwikipediaorgwikiDevops
bull httpdavidmonniauxfreefrdotclearindexphppost20180105Pourquoi-l-informatique-devient-incomprC3A9hensible2C-et-l-impact-sur-la-sC3A9curitC3A9
Si le mouvement Devops fait bien reacutefeacuterence agrave lrsquoautomatisation des tests unitaires ou fonctionnels avec la mise en placede lrsquointeacutegration continue ou agrave lrsquoautomatisation ce nrsquoest pas lrsquoaspect principal qursquoeacutevoque le mouvement Devops
Le Devops est un mouvement qui privileacutegie la mise en place drsquoun alignement de lrsquoensemble de la DSI autourdrsquoobjectifs communs le terme Devops est la concateacutenation de dev pour deacuteveloppeur et ops pour opeacuterationnelssoit les ingeacutenieurs responsables des infrastructures
Avoir une eacutequipe enfermeacutee dans une piegravece totalement isoleacutee des eacutequipes de deacuteveloppement pour mettre en place dessolutions drsquointeacutegration continue ou de livraison continue ne correspond pas agrave ce concept Devops Crsquoest pourtant cettefaccedilon de faire que nous voyons de plus en plus aujourdrsquohui
122 Deacutefinition 2 Le Devops pour reacutepondre agrave lrsquoappel de lrsquoinnovation 2018-01-04
See also
bull httpswwwprogrammezcomavis-expertsle-Devops-pour-repondre-lappel-de-linnovation-26954
Le Devops est axeacute sur la collaboration neacutecessaire pour deacutevelopper tester et deacuteployer des applications rapidement etreacuteguliegraverement
Crsquoest un changement culturel qui met lrsquoaccent sur le renforcement de la communication et de la collaboration entrediffeacuterentes eacutequipes telles que celles chargeacutees du deacuteveloppement de lrsquoexploitation et de lrsquoassurance-qualiteacute
Lrsquoobjectif est de deacutecloisonner les services qui composent une organisation afin de creacuteer un lieu de travail plus collabo-ratif et de creacuteer ainsi une synergie qui en bout de chaicircne profite agrave lrsquoutilisateur final Car crsquoest un fait aveacutereacute la creacuteation
6 Chapter 1 Introduction agrave Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
et la conservation de relations solides avec les clients offrent des avantages exponentiels dont une diminution de laperte de clientegravele et des sources de revenus potentiellement plus nombreuses
Car le Devops est avant tout un concept il nrsquoexiste par UN outil de Devops agrave proprement parler mais un faisceaudrsquooutils permettant drsquoinstaurer et drsquoentretenir une culture Devops Il regroupe agrave la fois des outils open source etproprieacutetaires deacutedieacutes agrave des tacircches speacutecifiques dans les processus de deacuteveloppement et de deacuteploiement
Drsquoailleurs en parlant de processus eacutevoquons un instant le deacuteploiement continu
Le deacuteploiement continu repose entiegraverement sur des processus et lrsquoautomatisation y joue un rocircle cleacute Les processus dedeacuteploiement continu sont lrsquoun des eacuteleacutements fondamentaux drsquoune transformation Devops Le deacuteploiement continu etle Devops permettent aux eacutequipes de deacuteveloppement drsquoacceacuteleacuterer consideacuterablement la livraison de logiciels Gracircce auxprocessus de deacuteploiement continu et agrave la culture Devops les eacutequipes peuvent offrir en permanence du code sucircr testeacuteet precirct agrave ecirctre utiliseacute en production Cela inclut la publication de mises agrave jour logicielles ce qui dans une entreprise deteacuteleacutecommunication peut parfois survenir trois fois par jour voire plus
123 Deacutefinition 3 extrait p53 MISC N95 Janvierfeacutevrier 2018 ldquoNe pas preacutevoir crsquoestdeacutejagrave geacutemirrdquo
Lrsquoegravere des hyperviseurs est-elle reacutevolue La bataille commerciale autour de la seacutecuriteacute et de la performance persiste-t-elle
Crsquoest agrave preacutesent un conflit deacutepasseacute car la seacutecuriteacute est prise en compte deacutesormais dans les conteneurs au niveau despreacuterequis
Lrsquoimportance du choix de la seacutecuriteacute reacuteside davantage dans lrsquoeacutedifice construit et son eacutevolution
Il devient eacutevident que la virtualisation leacutegegravere va gagner du terrain les hyperviseurs vont alors devenir obsolegravetes etcrsquoest dans ce contexte qursquoil fait repenser lrsquoaction des eacutequipes de seacutecuriteacute
En faisant avancer les vrais eacutechanges entre Dev et Ops le Devops a changeacute la donne et la production beacuteneacuteficie enfinde lrsquoagiliteacute procircneacutee depuis quelques anneacutees
En inteacutegrant la seacutecuriteacute dans le SecDevops et en srsquoassurant drsquoavoir des composants seacutecuriseacutes au maximum lrsquoaspectseacutecuritaire devient alors une composante agrave valeur ajouteacutee pour la production
Certains pensent qursquoutiliser les systegravemes qui ont fait leur preuve dans le temps serait le gage drsquoune seacutecuriteacute beaucoupplus fiable et plus simple agrave mettre en œuvre
Il semble aujourdrsquohui de plus en plus eacutevident pour un responsable de systegravemes drsquoinformation que manquer ce tournantde la technologie des conteneurs serait une assurance drsquoecirctre rapidement mis agrave lrsquoeacutecart des eacutevolutions en cours
1231 Citations
12311 Ne pas preacutevoir crsquoest deacutejagrave geacutemir
ldquoNe pas preacutevoir crsquoest deacutejagrave geacutemirrdquo Leacuteonard de vinci
12312 La vie crsquoest comme une bicyclette il faut avancer pour ne pas perdre lrsquoeacutequilibre
La vie crsquoest comme une bicyclette il faut avancer pour ne pas perdre lrsquoeacutequilibre Albert Einstein
12 Deacutefinitions concernant lrsquoagiliteacute et le mouvement Devops 7
Tutoriel Docker Release 2019-02-28T143129517726+0100
124 Devops inteacutegration et deacuteploiement continus pourquoi est-ce capital et com-ment y aller
See also
bull httpsactualfa-safetyfrdevopsdevops-integration-et-deploiement-continus-pourquoi-est-ce-capital-et-comment-y-aller
Fig 2 Inteacutegration continue
laquo Inteacutegration continue raquo (CI) laquo deacuteploiement continu raquo (CD) laquo Devops raquo autant de termes que lrsquoon entend tregravesfreacutequemment degraves que lrsquoon parle drsquoapplications Web et de transformation numeacuterique et pourtant ce sont des conceptsencore mal connus dans leur mise en œuvre
De quoi srsquoagit-il Tout simplement drsquoassurer la sortie de nouvelles fonctionnaliteacutes drsquoune application sur un rythmebeaucoup plus reacutegulier et rapide
Traditionnellement un rythme de deacuteploiement standard sur une application classique est drsquoune agrave deux versions ma-jeures par an Pour chaque version majeure on regroupe un ensemble de nouvelles fonctionnaliteacutes ce qui donne deacutelaide 6 agrave 12 mois entre deux nouveauteacutes
Entretemps on se contente de corriger les bugs de sortir des versions mineures Crsquoest terriblement long surtout agravelrsquoegravere drsquointernet Lrsquoobjectif est drsquoassurer la coheacuterence des eacutevolutions regrouper les testss seacutecuriser la production etlimiter les migrations pour les clients mais cela peacutenalise les deacutelais
Ce deacutelai srsquoexplique par le fait que crsquoest un processus seacutequentiel impliquant diffeacuterentes eacutequipes et qursquoagrave chaque eacutetapeil faut synchroniser les acteurs faire des demandes les planifier tout cela geacuteneacuterant des deacutelais
Le deacuteploiement continu prend le contrepied et permet drsquopermet drsquoacceacuteleacuterer ce rythme en
bull deacutecoupant les versions en un plus grand nombre de livraisons de moindre taille et moins complexes agrave tester
bull automatisant au maximum les eacutetapes de tests et passages en production drsquoune nouvelle version afin de reacuteduireles cycles
bull permettant un deacuteploiement tregraves reacutegulier des nouveauteacutes
8 Chapter 1 Introduction agrave Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
125 Agiliteacute et Devops Extrait p 35 de [Programmez] Ndeg214 janvier 2018
See also
bull httpswwwprogrammezcommagazinearticleagilite-developpeursDevops-une-bonne-idee
Les deacuteveloppeurs doivent eacutevoluer pour suivre ces deux mouvements populaires (Agiliteacute + Devops) qui se deacuteploienttregraves rapidement au sein de lrsquoensemble des DSI franccedilaises Lrsquoagiliteacute et le Devops sont de tregraves bonnes eacutevolutions tantelles apportent aux DSI et au produit final
126 What is a DevOps Engineer
See also
httpblogshippablecomhow-to-be-a-great-devops-engineer
A major part of adopting DevOps is to create a better working relationship between development and operations teams
Some suggestions to do this include seating the teams together involving them in each otherrsquos processes and work-flows and even creating one cross-functional team that does everything
In all these methods Dev is still Dev and Ops is still Ops
The term DevOps Engineer tries to blur this divide between Dev and Ops altogether and suggests that the best approachis to hire engineers who can be excellent coders as well as handle all the Ops functions
In short a DevOps engineer can be a developer who can think with an Operations mindset and has the followingskillset
bull Familiarity and experience with a variety of Ops and Automation tools
bull Great at writing scripts
bull Comfortable with dealing with frequent testing and incremental releases
bull Understanding of Ops challenges and how they can be addressed during design and development
bull Soft skills for better collaboration across the team
According to Amazon CTO Werner Vogels
Giving developers operational responsibilities has greatly enhancedthe quality of the services both from a customer and a technologypoint of viewThe traditional model is that you take your software to the wallthat separates development and operations and throw it over andthen forget about it Not at Amazon You build it you run itThis brings developers into contact with the day-to-day operationof their software It also brings them into day-to-day contact withthe customer This customer feedback loop is essential for improvingthe quality of the service
It is easier than ever before for a developer to move to a DevOps role Software delivery automation is getting betterevery day and DevOps platforms like Shippable are making it easy to implement automation while also giving you aSingle Pane of Glass view across your entire CICD pipeline
Can an Ops engineer move to a DevOps role Definitely but it can be a little more challenging since you will needto learn design and programming skills before making that transformation However with the upsurge in number ofcoding bootcamps it is probably an easier transition to make than it was a few years ago Ops engineers can bringmuch needed insights into how software design can cause Ops challenges so once you get past the initial learningcurve for designcoding yoursquore likely to become a valued DevOps engineer
12 Deacutefinitions concernant lrsquoagiliteacute et le mouvement Devops 9
Tutoriel Docker Release 2019-02-28T143129517726+0100
13 Deacutefinitions concernant Docker
See also
bull httpswwwdockercomwhat-docker
131 Deacutefinition de Docker sur Wikipedia en franccedilais
Docker est un logiciel libre qui automatise le deacuteploiement drsquoapplications dans des conteneurs logiciels Selon la firmede recherche sur lrsquoindustrie 451 Research
Docker est un outil qui peut empaqueter une application et sesdeacutependances dans un conteneur isoleacute qui pourra ecirctre exeacutecuteacute surnimporte quel serveur
Ceci permet drsquoeacutetendre la flexibiliteacute et la portabiliteacute drsquoexeacutecution drsquoune application que ce soit sur la machine localeun cloud priveacute ou public une machine nue etc
132 Docker est ldquoagilerdquo
Ameacuteliorations des temps de deacuteveloppement et de deacuteplpoiement par 13
133 Docker est portable
Docker est portable ce qui permet drsquoavoir des environnements de deacuteveloppement test et production pratiquementidentiques
134 Docker est seacutecuriseacute
135 Les conteneurs Docker sont plus leacutegers et rapides que les machinesvirtuelles
1351 Containers
Containers are an abstraction at the app layer that packages code and dependencies together Multiple containers canrun on the same machine and share the OS kernel with other containers each running as isolated processes in userspace
Containers take up less space than VMs (container images are typically tens of MBs in size) and start almost instantly
1352 Virtual machines (VMs)
Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers
The hypervisor allows multiple VMs to run on a single machine
Each VM includes a full copy of an operating system one or more apps necessary binaries and libraries - taking uptens of GBs
VMs can also be slow to boot
10 Chapter 1 Introduction agrave Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 3 Source httpswwwdockercomwhat-docker
13 Deacutefinitions concernant Docker 11
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 4 Source httpswwwdockercomwhat-docker
12 Chapter 1 Introduction agrave Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 5 Source httpswwwdockercomwhat-docker
13 Deacutefinitions concernant Docker 13
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 6 Source httpswwwdockercomwhat-container
1353 Docker can run your applications in production at native speed
Source p255 du livre ldquoPython Microservices Developmentrdquo de Tarek Ziadeacute
that is where VMs are a great solution to run your applications
In the past ten years many software projects that required an elaborate setup to run started to provide read-to-run VMsusing tools such as VMWare or VirtualBox Those VMs included the whole stack like prefilled databases Demosbecame easyly runnable on most platforms with a single command That was progress
However some of those tools were not fully open source virtualization tool and they were very slow to run and greedyin memory and CPU and terrible with disk IO It was unthinkable to run them in production and they were mostlyused for demos
The big revolution came with Docker an open source virtualization tool which wa first released in 2013 and becamehugley popular Moreover unlike VMWare or VirtualBox Docker can run your applications in production at nativespeed
14 Dossier Docker dans le dossier MISC Ndeg95 de janvierfeacutevrier 2018
See also
bull httpswwwmiscmagcommisc-n95-references-de-larticle-docker-les-bons-reflexes-a-adopter
14 Chapter 1 Introduction agrave Docker
CHAPTER
TWO
INSTALLATION DE DOCKER
See also
bull httpsdocsdockercominstall
15
Tutoriel Docker Release 2019-02-28T143129517726+0100
16 Chapter 2 Installation de docker
CHAPTER
THREE
QUI UTILISE DOCKER EN PRODUCTION
See also
bull httpsactualfa-safetyfrdevopsdocker-en-production
Contents
bull Qui utilise Docker en production
ndash Historique
Janvier 2018
ndash Paypal
Challenges
Solution
31 Historique
311 Janvier 2018
See also
bull httpsblogdockercom2018015-tips-learn-docker-2018
As the holiday season ends many of us are making New Yearrsquos resolutions for 2018 Now is a great time to thinkabout the new skills or technologies yoursquod like to learn So much can change each year as technology progresses andcompanies are looking to innovate or modernize their legacy applications or infrastructure
At the same time the market for Docker jobs continues to grow as companies such as Visa MetLife and Splunk adoptDocker Enterprise Edition ( EE) in production
32 Paypal
See also
bull httpswwwdockercomcustomerspaypal-uses-docker-containerize-existing-apps-save-money-and-boost-security
17
Tutoriel Docker Release 2019-02-28T143129517726+0100
321 Challenges
Today PayPal is leveraging OpenStack for their private cloud and runs more than 100000 VMs This private cloudruns 100 of their web and mid-tier applications and services One of the biggest desires of the PayPal business isto modernize their datacenter infrastructure making it more on demand improving its security meeting complianceregulations and lastly making everything cost efficient
They wanted to refactor their existing Java and C++ legacy applications by dockerizing them and deploying them ascontainers
This called for a technology that provides a distributed application deployment architecture and can manage work-loads but must also be deployed in both private and eventually public cloud environments Being cost efficient wasextremely important for the company Since PayPal runs their own cloud they pay close attention to how much moneythey are spending on actually running their datacenter infrastructure
Functioning within the online payment industry PayPal must ensure the security of their internal data (binaries andartifacts with the source code of their applications) This makes them a very security-conscious company
Their sensitive data needs to be kept on-premises where their security teams can run ongoing scans and sign their codebefore deploying out to production PayPalrsquos massive popularity is a good thing but it also means they must handlethe deluge of demands from their users At times they process more than 200 payments per second When includingBraintree and Venmo the companies that PayPal acquired that number continues to soar even higher Recently it wasannounced that Braintree is processing more than a billion a month when it comes to mobile payments That addsquite a bit of extra pressure on their infrastructure
322 Solution
Today PayPal uses Dockerrsquos commercial solutions to enable them to not only provide gains for their developers interms of productivity and agility but also for their infrastructure teams in the form of cost efficiency and enterprise-grade security
The tools being used in production today include
bull Docker Commercially Supported engine (CS Engine)
bull Docker Trusted Registry
bull as well as Docker Compose
The company believes that containers and VMs can coexist and combine the two technologies Leveraging Dockercontainers and VMs together gives PayPal the ability to run more applications while reducing the number of totalVMs optimizing their infrastructure This also allows PayPal to spin up a new application much more quickly and onan ldquoas neededrdquo basis
Since containers are more lightweight and instantiate in a fraction of a second while VMs take minutes they can rollout a new application instance quickly patch an existing application or even add capacity for holiday readiness tocompensate for peak times within the year
This helps drive innovation and help them outpace competition Docker Trusted Registry gives their team enterprisesecurity features like granular role based access controls and image signing that ensures that all of PayPalrsquos checksand balances are in place
The tool provides them with the on-premises enterprise-grade registry service they need in order to provide securecollaboration for their image content There security team can run ongoing scans and sign code before deploying toproduction
With Docker the company has gained the ability to scale quickly deploy faster and one day even provide localdesktop-based development environments with Docker For that they are looking to Docker for Mac and Docker forWindows which offer Docker as a local development environment to their 4000+ developers located across the globe
18 Chapter 3 Qui utilise Docker en production
CHAPTER
FOUR
DOCKER ENGINE CE (COMMUNITY EDITION)
See also
bull httpsgithubcomdockerdocker-ce
bull httpsdocsdockercomenginedeprecated
Contents
bull docker engine CE (Community Edition)
ndash docker engine versions
41 docker engine versions
411 docker engine versions
See also
bull httpsgithubcomdockerdocker-cereleases
bull httpsgithubcomdockerdockergithubiotreevnext-engine
bull httpsdocsdockercomenginedeprecated
Contents
bull docker engine versions
ndash Future
ndash Versions
4111 Future
See also
bull httpsgithubcomdockerdockergithubiotreevnext-engine
bull httpsgithubcomdockerdocker-cecommitsmaster
19
Tutoriel Docker Release 2019-02-28T143129517726+0100
4112 Versions
41121 1809-ce (2018-11-08)
See also
bull httpsgithubcomdockerdocker-cetreev18090
bull httpsgithubcomdockerdocker-cereleasestagv18090
bull httpsdocsdockercomenginerelease-notes1809
41122 18061-ce (2018-08-21)
See also
bull httpsgithubcomdockerdocker-cetreev18061-ce
41123 18060-ce (2018-07-18)
See also
bull httpsgithubcomdockerdocker-cetreev18060-ce
41124 18031-ce (2018-04-26 9ee9f40)
See also
bull httpsgithubcomdockerdocker-cetreev18031-ce
41125 17121-ce (2018-02-27)
See also
bull httpsgithubcomdockerdocker-cetreev17121-ce
41126 17060-ce (2017-06-23 02c1d87)
See also
bull httpsgithubcomdockerdocker-cetreev17060-ce
20 Chapter 4 docker engine CE (Community Edition)
CHAPTER
FIVE
DOCKER COMPOSE
See also
bull httpsgithubcomdockercompose
bull httpsdocsdockercomcompose
bull httpsdocsdockercomcomposesamples-for-compose
bull httpswwwaquaseccomwikidisplaycontainersDocker+Compose
Contents
bull Docker compose
ndash Concepts cleacutes
Other definition
ndash Other links
heroku
ndash docker-compose commands
ndash docker-compose for production
ndash docker-compose TIPS
ndash docker-compose versions
ndash Exemples
51 Concepts cleacutes
Key concepts these samples cover
The samples should help you to
bull define services based on Docker images using Compose files docker-composeyml and docker-stackyml files
bull understand the relationship between docker-composeyml and Dockerfiles
bull learn how to make calls to your application services from Compose files
bull learn how to deploy applications and services to a swarm
21
Tutoriel Docker Release 2019-02-28T143129517726+0100
511 Other definition
Source httpsblogsixeyedcomwindows-dockerfile-26
You define applications in Compose in terms of services rather than containers Services will be deployed as containers- but a service could be multiple instances of a single container so itrsquos an abstraction beyond managing containers onhosts
52 Other links
See also
bull httpswwwaquaseccomwikidisplaycontainersDocker+Compose
521 heroku
See also
bull httpsdevcenterherokucomarticleslocal-development-with-docker-compose
53 docker-compose commands
531 docker-compose commands
See also
bull httpsdocsdockercomcomposeoverview
bull httpsdocsdockercomcomposereference
bull httpsdocsdockercomcomposecompose-file
bull httpsdocsdockercomcomposesamples-for-compose
Contents
bull docker-compose commands
ndash docker-compose help
ndash docker-compose build
docker-compose -f docker-composeyml build django
ndash docker-compose ps
ndash docker-compose up
5311 docker-compose help
docker-compose help
22 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
Define and run multi-container applications with Docker
Usagedocker-compose [-f ltarggt] [options] [COMMAND] [ARGS]docker-compose -h|--help
Options-f --file FILE Specify an alternate compose file
(default docker-composeyml)-p --project-name NAME Specify an alternate project name
(default directory name)--verbose Show more output--log-level LEVEL Set log level (DEBUG INFO WARNING ERROR CRITICAL)--no-ansi Do not print ANSI control characters-v --version Print version and exit-H --host HOST Daemon socket to connect to
--tls Use TLS implied by --tlsverify--tlscacert CA_PATH Trust certs signed only by this CA--tlscert CLIENT_CERT_PATH Path to TLS certificate file--tlskey TLS_KEY_PATH Path to TLS key file--tlsverify Use TLS and verify the remote--skip-hostname-check Dont check the daemons hostname against the
name specified in the client certificate--project-directory PATH Specify an alternate working directory
(default the path of the Compose file)--compatibility If set Compose will attempt to convert deploy
keys in v3 files to their non-Swarm equivalent
Commandsbuild Build or rebuild servicesbundle Generate a Docker bundle from the Compose fileconfig Validate and view the Compose filecreate Create servicesdown Stop and remove containers networks images and volumesevents Receive real time events from containersexec Execute a command in a running containerhelp Get help on a commandimages List imageskill Kill containerslogs View output from containerspause Pause servicesport Print the public port for a port bindingps List containerspull Pull service imagespush Push service imagesrestart Restart servicesrm Remove stopped containersrun Run a one-off commandscale Set number of containers for a servicestart Start servicesstop Stop servicestop Display the running processesunpause Unpause servicesup Create and start containersversion Show the Docker-Compose version information
53 docker-compose commands 23
Tutoriel Docker Release 2019-02-28T143129517726+0100
5312 docker-compose build
See also
bull httpsdocsdockercomcomposereferencebuild
$ docker-compose help build
Build or rebuild services
Services are built once and then tagged as `project_service`eg `composetest_db` If you change a services `Dockerfile` or thecontents of its build directory you can run `docker-compose build` to rebuild it
Usage build [options] [--build-arg key=val] [SERVICE]
Options--compress Compress the build context using gzip--force-rm Always remove intermediate containers--no-cache Do not use cache when building the image--pull Always attempt to pull a newer version of the image-m --memory MEM Sets memory limit for the build container--build-arg key=val Set build-time variables for services
53121 docker-compose -f docker-composeyml build django
docker-compose -f docker-composeyml build django
5313 docker-compose ps
See also
bull httpsdocsdockercomcomposereferenceup
bull Check container status
$ docker-compose help ps
List containers
Usage ps [options] [SERVICE]
Options-q --quiet Only display IDs--services Display services--filter KEY=VAL Filter services by a property
5314 docker-compose up
See also
bull httpsdocsdockercomcomposereferenceup
bull Launching Our First Stack with Compose
24 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
docker-compose help up
Builds (re)creates starts and attaches to containers for a service
Unless they are already running this command also starts any linked services
The `docker-compose up` command aggregates the output of each container Whenthe command exits all containers are stopped Running `docker-compose up -d`starts the containers in the background and leaves them running
If there are existing containers for a service and the services configurationor image was changed after the containers creation `docker-compose up` picksup the changes by stopping and recreating the containers (preserving mountedvolumes) To prevent Compose from picking up changes use the `--no-recreate`flag
If you want to force Compose to stop and recreate all containers use the`--force-recreate` flag
Usage up [options] [--scale SERVICE=NUM] [SERVICE]
Options-d --detach Detached mode Run containers in the background
print new container names Incompatible with--abort-on-container-exit
--no-color Produce monochrome output--quiet-pull Pull without printing progress information--no-deps Dont start linked services--force-recreate Recreate containers even if their configuration
and image havent changed--always-recreate-deps Recreate dependent containers
Incompatible with --no-recreate--no-recreate If containers already exist dont recreate
them Incompatible with --force-recreate and -V--no-build Dont build an image even if its missing--no-start Dont start the services after creating them--build Build images before starting containers--abort-on-container-exit Stops all containers if any container was
stopped Incompatible with -d-t --timeout TIMEOUT Use this timeout in seconds for container
shutdown when attached or when containers arealready running (default 10)
-V --renew-anon-volumes Recreate anonymous volumes instead of retrievingdata from the previous containers
--remove-orphans Remove containers for services not definedin the Compose file
--exit-code-from SERVICE Return the exit code of the selected servicecontainer Implies --abort-on-container-exit
--scale SERVICE=NUM Scale SERVICE to NUM instances Overrides the`scale` setting in the Compose file if present
53 docker-compose commands 25
Tutoriel Docker Release 2019-02-28T143129517726+0100
54 docker-compose for production
541 Docker compose in production
See also
bull httpsdocsdockercomcomposeproduction
bull httpsdocsdockercomcomposeproductionmodify-your-compose-file-for-production
Contents
bull Docker compose in production
ndash Articles
Simple continuous deployment with docker compose docker machine and Gitlab CI (2017-06-26)
5411 Articles
54111 Simple continuous deployment with docker compose docker machine and Gitlab CI (2017-06-26)
See also
bull httpsmediumcomEmpanadosimple-continuous-deployment-with-docker-compose-docker-machine-and-gitlab-ci-9047765322e1
For local development of microservice-based systems running on docker wersquove found that docker compose is probablythe best way to go for local development with the docker compose yaml file format being very usable for configurationas well And for some projects there really is no need to scale up to having multiple containers of a service as yoursquollbe just fine with running all your containers on a single host For these projects you want to get to production assmooth (or simple) as possible
So after spending time learning about Mesos Kubernetes Amazon ECS and other proprietary technologies and learn-ing a ton of new concepts I concluded that theyrsquore all awesome but not really suitable for a simple move from localdevelopment with docker compose They all have their own configuration formats (largely for good reasons) and all ofthem do orchestration quite a bit different than docker compose to facilitate more complex deployment environments
55 docker-compose TIPS
551 docker-compose tips
5511 docker-compose tips 2018
Contents
bull docker-compose tips 2018
ndash 3 Docker Compose features for improving team development workflow
Environment variables
26 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
Templating
Control your Compose Command Scope
55111 3 Docker Compose features for improving team development workflow
See also
bull httpswwworeillycomideas3-docker-compose-features-for-improving-team-development-workflow
bull httpstwittercomBretFisher
Environment variables
See also
bull httpsdocsdockercomcomposecompose-filevariable-substitution
Eventually yoursquoll need a compose file to be flexible and yoursquoll learn that you can use environment variables inside theCompose file
Note this is not related to the YAML object ldquoenvironmentrdquo which you want to send to the container on startup Withthe notation of $VARNAME you can have Compose resolve these values dynamically during the processing of thatYAML file The most common examples of when to use this are for setting the container image tag or published port
As an example if your docker-composeyml file looks like this
version 2services
ghostimage ghost$GHOST_VERSION
then you can control the image version used from the CLI like so
GHOST_VERSION=2 docker-compose up
You can also set those variables in other ways by storing them in a env file by setting them at the CLI with exportor even setting a default in the YAML itself with $GHOST_VERSION-2
You can read more about variable substitution and various ways to set them in the Docker docs
Templating
See also
bull httpsdocsdockercomcomposecompose-fileextension-fields
A relatively new and lesser-known feature is Extension Fields which lets you define a block of text in Compose filesthat is reused throughout the file itself
This is mostly used when you need to set the same environment objects for a bunch of microservices and you want tokeep the file DRY (Donrsquot Repeat Yourself)
I recently used it to set all the same logging options for each service in a Compose file like so
55 docker-compose TIPS 27
Tutoriel Docker Release 2019-02-28T143129517726+0100
version 34
x-loggingampmy-loggingoptionsmax-size 1mmax-file 5
servicesghostimage ghostlogging my-logging
nginximage nginxlogging my-logging
Yoursquoll notice a new section starting with an x- which is the template that you can then name with the amp and call fromanywhere in your Compose file with and the name Once you start to use microservices and have hundreds or morelines in your Compose file this will likely save you considerable time and ensure consistency of options throughout
See more details in the Docker docs
Control your Compose Command Scope
The docker-compose CLI controls one or more containers volumes networks etc within its scope
It uses two things to create that scope the Compose YAML config file (it defaults to docker-composeyml) and theproject name (it defaults to the directory name holding the YAML config file) Normally you would start a projectwith a single docker-composeyml file and execute commands like docker-compose up in the directory with that filebut therersquos a lot of flexibility here as complexity grows
As things get more complex you may have multiple YAML config files for different setups and want to control whichone the CLI uses like docker-compose -f custom-composeyml up This command ignores the default YAML file andonly uses the one you specify with the -f option
You can combine many Compose files in a layered override approach Each one listed in the CLI will override thesettings of the previous (processed left to right)
docker-compose -f docker-composeyml -f docker-overrideyml
If you manually change the project name you can use the same Compose file in multiple scopes so they donrsquot ldquoclashrdquoClashing happens when Compose tries to control a container that already has another one running with the same name
You likely have noticed that containers networks and other objects that Compose creates have a naming standardThe standard comprises three parts projectname_servicename_index We can change the projectname which againdefaults to the directory name with a -p at the command line So if we had a docker-composeyml file like this
version 2
servicesghostimage ghost$GHOST_VERSIONports
- $GHOST_PORT2368
Then we had it in a directory named ldquoapp1rdquo and we started the ghost app with inline environment variables like this
28 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
app1gt GHOST_VERSION=2 GHOST_PORT=8080 docker-compose up
Wersquod see a container running named this
app1_ghost_1
Now if we want to run an older version of ghost side-by-side at the same time we could do that with this sameCompose file as long as we change two things
bull First we need to change the project name to ensure the container name will be different and not conflict withour first one
bull Second we need to change the published port so they donrsquot clash with any other running containers
app1gt GHOST_VERSION=1 GHOST_PORT=9090 docker-compose -p app2 up
If I check running containers with a docker container ls I see
app1_ghost_1 running ghost2 on port 8080app2_ghost_1 running ghost1 on port 9090
Now you could pull up two browser windows and browse both 8080 and 9090 with two separate ghost versions (anddatabases) running side by side
Most of what Irsquove learned on advanced Compose workflows has come from trying things Irsquove learned in the Dockerdocs as well as the teams I work with to make development testing and deployments easier
I share these learnings everywhere I can and I encourage you to do the same
What other features or team standards have you found useful with Docker Compose Please share with me and thecommunity on Twitter BretFisher
56 docker-compose versions
561 docker-compose versions
Contents
bull docker-compose versions
ndash Versions
5611 Versions
56111 docker-compose 122 (2018-07-18)
Contents
bull docker-compose 122 (2018-07-18)
ndash docker-compose 122 (2018-07-18)
56 docker-compose versions 29
Tutoriel Docker Release 2019-02-28T143129517726+0100
docker-compose 122 (2018-07-18)
See also
bull httpsgithubcomdockercomposetree1220
56112 docker-compose 121 (2018-04-09)
Contents
bull docker-compose 121 (2018-04-09)
ndash docker-compose 1212 (2018-05-02)
docker-compose 1212 (2018-05-02)
See also
bull httpsgithubcomdockercomposetree1212
$ docker-compose version
docker-compose version 1212 build a133471docker-py version 330CPython version 365OpenSSL version OpenSSL 101t 3 May 2016
57 Exemples
571 Quickstart Compose and Django
See also
bull httpsdocsdockercomcomposedjango
bull httpsdocsdockercomcomposeinstall
bull httpsdocsdockercomenginetutorialsdockerimagesbuilding-an-image-from-a-dockerfile
bull httpsdocsdockercomenginereferencebuilder
bull httpsstoredockercomimagespython
bull httpsdocsdockercomcomposecompose-file
bull httpsdocsdjangoprojectcomen111refsettingsallowed-hosts
bull httpsdocsdockercomcomposereferencedown
Contents
bull Quickstart Compose and Django
30 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
ndash Overview of Docker Compose
ndash Introduction
ndash Define the project components
mkdir django_app
Create a Dockerfile
middot Les images Python
Create a requirementstxt in your project directory
Create a file called docker-composeyml in your project directory
middot Les images postresql
ndash Create a Django project
cd django_app
docker-compose run web django-adminpy startproject composeexample
middot tree a f
ndash Connect the database
Edit the composeexamplesettingspy file
django_appgt docker-compose up
docker ps
docker-compose down
ndash Compose file examples
5711 Overview of Docker Compose
See also
bull httpsgithubcomdockercompose
bull httpsgithubcomdockerdockergithubioblobmastercomposedjangomd
bull httpsdocsdockercomcomposeoverview
bull httpsdocsdockercomcomposecompose-file
bull httpsgithubcomdockerdockergithubioblobmastercomposeoverviewmdcommon-use-cases
Looking for Compose file reference Find the latest version here
Compose is a tool for defining and running multi-container Docker applications
With Compose you use a YAML file to configure your applicationrsquos services
Then with a single command you create and start all the services from your configuration To learn more about allthe features of Compose see the list of features
Compose works in all environments
bull production
bull staging
bull development
57 Exemples 31
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull testing
bull as well as CI workflows
You can learn more about each case in Common Use Cases
Using Compose is basically a three-step process
bull Define your apprsquos environment with a Dockerfile so it can be reproduced anywhere
bull Define the services that make up your app in docker-composeyml so they can be run together in an isolatedenvironment
bull Lastly run docker-compose up and Compose will start and run your entire app
5712 Introduction
This quick-start guide demonstrates how to use Docker Compose to set up and run a simple DjangoPostgreSQL app
Before starting yoursquoll need to have Compose installed
5713 Define the project components
For this project you need to create a Dockerfile a Python dependencies file and a docker-composeyml file (You canuse either a yml or yaml extension for this file)
57131 mkdir django_app
Create an empty project directory
You can name the directory something easy for you to remember This directory is the context for your applicationimage The directory should only contain resources to build that image
mkdir django_app
57132 Create a Dockerfile
Create a new file called Dockerfile in your project directory
1 FROM python32 ENV PYTHONUNBUFFERED 13 RUN mkdir code4 WORKDIR code5 ADD requirementstxt code6 RUN pip install -r requirementstxt7 ADD code
The Dockerfile defines an applicationrsquos image content via one or more build commands that configure that image
Once built you can run the image in a container
For more information on Dockerfile see the Docker user guide and the Dockerfile reference
This Dockerfile starts with a Python 3 parent image
32 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
Les images Python
Fig 1 Les images Python voir httpsstoredockercomimagespython
Le tag python3 correspond agrave la version courante en 2018 crsquoest agrave dire 36
The parent image is modified by adding a new code directory The parent image is further modified by installing thePython requirements defined in the requirementstxt file
57133 Create a requirementstxt in your project directory
This file is used by the RUN pip install -r requirementstxt command in your Dockerfile
57 Exemples 33
Tutoriel Docker Release 2019-02-28T143129517726+0100
1 django2 psycopg2
57134 Create a file called docker-composeyml in your project directory
See also
bull httpsdocsdockercomcomposecompose-file
bull httpsstoredockercomimagespostgres
The docker-composeyml file describes the services that make your app
1 version 32
3 services4 db5 image postgres6 web7 build 8 command python3 managepy runserver 000080009 volumes
10 - code11 ports12 - 8000800013 depends_on14 - db
This file defines two services The db service and the web service
Les images postresql
Fig 2 Les images PostgreSQL voir httpsstoredockercomimagespostgres
The compose file also describes which Docker images these services use how they link together any volumes theymight need mounted inside the containers
See the docker-composeyml reference for more information on how this file works
34 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
5714 Create a Django project
In this step you create a Django starter project by building the image from the build context defined in the previousprocedure
57141 cd django_app
Change to the root of your project directory
57142 docker-compose run web django-adminpy startproject composeexample
This instructs Compose to run django-adminpy startproject composeexample in a container using the web servicersquosimage and configuration
Because the web image doesnrsquot exist yet Compose builds it from the current directory as specified by the build linein docker-composeyml
docker-compose run web django-adminpy startproject composeexample
Fig 3 docker-compose run web django-adminpy startproject composeexample
Pulling db (postgreslatest)latest Pulling from librarypostgres723254a2c089 Pull complete39ec0e6c372c Pull completeba1542fb91f3 Pull completec7195e642388 Pull complete95424deca6a2 Pull complete2d7d4b3a4ce2 Pull completefbde41d4a8cc Pull complete880120b92add Pull complete9a217c784089 Pull completed581543fe8e7 Pull completee5eff8940bb0 Pull complete462d60a56b09 Pull complete135fa6b9c139 Pull completeDigest sha2563f4441460029e12905a5d447a3549ae2ac13323d045391b0cb0cf8b48ea17463Status Downloaded newer image for postgreslatestCreating djangoapp_db_1 doneBuilding web
(continues on next page)
57 Exemples 35
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
Step 17 FROM python33 Pulling from librarypythonf49cf87b52c1 Already exists7b491c575b06 Pull completeb313b08bab3b Pull complete51d6678c3f0e Pull complete09f35bd58db2 Pull complete0f9de702e222 Pull complete73911d37fcde Pull complete99a87e214c92 Pull completeDigest sha25698149ed5f37f48ea3fad26ae6c0042dd2b08228d58edc95ef0fce35f1b3d9e9fStatus Downloaded newer image for python3---gt c1e459c00dc3
Step 27 ENV PYTHONUNBUFFERED 1---gt Running in 94847219310a
Removing intermediate container 94847219310a---gt 221d2e9ab9e4
Step 37 RUN mkdir code---gt Running in a65c8bf5e5a9
Removing intermediate container a65c8bf5e5a9---gt 589950689c7a
Step 47 WORKDIR codeRemoving intermediate container f7b978400775---gt e039064473fb
Step 57 ADD requirementstxt code---gt 4305caf141b9
Step 67 RUN pip install -r requirementstxt---gt Running in 0705839561d0
Collecting django (from -r requirementstxt (line 1))Downloading Django-201-py3-none-anywhl (71MB)
Collecting psycopg2 (from -r requirementstxt (line 2))Downloading psycopg2-2732-cp36-cp36m-manylinux1_x86_64whl (27MB)
Collecting pytz (from django-gt-r requirementstxt (line 1))Downloading pytz-20173-py2py3-none-anywhl (511kB)
Installing collected packages pytz django psycopg2Successfully installed django-201 psycopg2-2732 pytz-20173Removing intermediate container 0705839561d0---gt fa8182703037
Step 77 ADD code---gt 72d70c82ea04
Successfully built 72d70c82ea04Successfully tagged djangoapp_weblatestWARNING Image for service web was built because it did not already existTo rebuild this image you must use `docker-compose build` or `docker-compose up --rarr˓build`
Once the web service image is built Compose runs it and executes the django-adminpy startproject command in thecontainer This command instructs Django to create a set of files and directories representing a Django project
tree a f
$ tree a f
YPROJECTS_ID3P5N001XLOGCA135_TUTORIAL_DOCKERTUTORIAL_rarr˓DOCKERCOMPOSEDJANGODJANGO_APP
(continues on next page)
36 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
| docker-composeyml| Dockerfile| managepy| requirementstxt|---composeexample
settingspyurlspywsgipy__init__py
5715 Connect the database
See also
bull httpsstoredockercomimagespostgres
In this section you set up the database connection for Django
57151 Edit the composeexamplesettingspy file
In your project directory edit the composeexamplesettingspy file
Replace the DATABASES = with the following
DATABASES = default
ENGINE djangodbbackendspostgresqlNAME postgresUSER postgresHOST dbPORT 5432
These settings are determined by the postgres Docker image specified in docker-composeyml
57152 django_appgt docker-compose up
Run the docker-compose up command from the top level directory for your project
django_appgtdocker-compose up
WARNING The Docker Engine youre using is running in swarm mode
Compose does not use swarm mode to deploy services to multiple nodes in a swarm Allrarr˓containers will be scheduled on the current node
To deploy your application across the swarm use `docker stack deploy`
djangoapp_db_1 is up-to-dateCreating djangoapp_web_1 doneAttaching to djangoapp_db_1 djangoapp_web_1
(continues on next page)
57 Exemples 37
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
db_1 | The files belonging to this database system will be owned by user postgresdb_1 | This user must also own the server processdb_1 |db_1 | The database cluster will be initialized with locale en_USutf8db_1 | The default database encoding has accordingly been set to UTF8db_1 | The default text search configuration will be set to englishdb_1 |db_1 | Data page checksums are disableddb_1 |db_1 | fixing permissions on existing directory varlibpostgresqldata okdb_1 | creating subdirectories okdb_1 | selecting default max_connections 100db_1 | selecting default shared_buffers 128MBdb_1 | selecting dynamic shared memory implementation posixdb_1 | creating configuration files okdb_1 | running bootstrap script okdb_1 | performing post-bootstrap initialization okdb_1 | syncing data to disk okdb_1 |db_1 | WARNING enabling trust authentication for local connectionsdb_1 | You can change this by editing pg_hbaconf or using the option -A ordb_1 | --auth-local and --auth-host the next time you run initdbdb_1 |db_1 | Success You can now start the database server usingdb_1 |db_1 | pg_ctl -D varlibpostgresqldata -l logfile startdb_1 |db_1 | db_1 | WARNING No password has been set for the databasedb_1 | This will allow anyone with access to thedb_1 | Postgres port to access your database Indb_1 | Dockers default configuration this isdb_1 | effectively any other container on the samedb_1 | systemdb_1 |db_1 | Use -e POSTGRES_PASSWORD=password to setdb_1 | it in docker rundb_1 | db_1 | waiting for server to start2018-01-18 095104629 UTC [37] LOGrarr˓listening on IPv4 address 127001 port 5432db_1 | 2018-01-18 095104630 UTC [37] LOG could not bind IPv6 address 1rarr˓Cannot assign requested addressdb_1 | 2018-01-18 095104630 UTC [37] HINT Is another postmaster alreadyrarr˓running on port 5432 If not wait a few seconds and retrydb_1 | 2018-01-18 095104755 UTC [37] LOG listening on Unix socket varrunrarr˓postgresqlsPGSQL5432db_1 | 2018-01-18 095104916 UTC [38] LOG database system was shut down at 2018-rarr˓01-18 095102 UTCdb_1 | 2018-01-18 095104976 UTC [37] LOG database system is ready to acceptrarr˓connectionsdb_1 | donedb_1 | server starteddb_1 | ALTER ROLEdb_1 |db_1 |db_1 | usrlocalbindocker-entrypointsh ignoring docker-entrypoint-initdbddb_1 |
(continues on next page)
38 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
db_1 | 2018-01-18 095105165 UTC [37] LOG received fast shutdown requestdb_1 | waiting for server to shut down2018-01-18 095105224 UTC [37] LOGrarr˓aborting any active transactionsdb_1 | 2018-01-18 095105226 UTC [37] LOG worker process logical replicationrarr˓launcher (PID 44) exited with exit code 1db_1 | 2018-01-18 095105228 UTC [39] LOG shutting downdb_1 | 2018-01-18 095105860 UTC [37] LOG database system is shut downdb_1 | donedb_1 | server stoppeddb_1 |db_1 | PostgreSQL init process complete ready for start updb_1 |db_1 | 2018-01-18 095105947 UTC [1] LOG listening on IPv4 address 0000rarr˓port 5432db_1 | 2018-01-18 095105947 UTC [1] LOG listening on IPv6 address portrarr˓5432db_1 | 2018-01-18 095106080 UTC [1] LOG listening on Unix socket varrunrarr˓postgresqlsPGSQL5432db_1 | 2018-01-18 095106278 UTC [55] LOG database system was shut down at 2018-rarr˓01-18 095105 UTCdb_1 | 2018-01-18 095106340 UTC [1] LOG database system is ready to acceptrarr˓connectionsweb_1 | Performing system checksweb_1 |web_1 | System check identified no issues (0 silenced)web_1 |web_1 | You have 14 unapplied migration(s) Your project may not work properly untilrarr˓you apply the migrations for app(s) admin auth contenttypes sessionsweb_1 | Run python managepy migrate to apply themweb_1 | January 18 2018 - 104637web_1 | Django version 201 using settings composeexamplesettingsweb_1 | Starting development server at http00008000web_1 | Quit the server with CONTROL-C
At this point your Django app should be running at port 8000 on your Docker host
On Docker for Mac and Docker for Windows go to httplocalhost8000 on a web browser to see the Django welcomepage
57153 docker ps
Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockergtdocker ps
CONTAINER ID IMAGE COMMAND CREATEDrarr˓STATUS PORTS NAMES30b4922c00b2 djangoapp_web python3 managepy r About an hour agorarr˓ Up About an hour 00008000-gt8000tcp djangoapp_web_10883a9ef1c3b postgres docker-entrypoints 2 hours agorarr˓ Up 2 hours 5432tcp djangoapp_db_1
57 Exemples 39
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 4 httplocalhost800040 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
57154 docker-compose down
$ docker-compose down
Stopping djangoapp_web_1 doneStopping djangoapp_db_1 doneRemoving djangoapp_web_1 doneRemoving djangoapp_web_run_1 doneRemoving djangoapp_db_1 doneRemoving network djangoapp_default
5716 Compose file examples
57161 Compose file examples
Compose file example 1
See also
bull httpsgithubcompydannycookiecutter-djangoissues1258
Contents
bull Compose file example 1
ndash baseyml
ndash devyml
baseyml
version 32services
postgresbuild composepostgresenvironment- POSTGRES_USER_FILE=runsecretspg_username- POSTGRES_PASSWORD_FILE=runsecretspg_password
secrets- pg_username- pg_password
djangocommand gunicornshenvironment- USE_DOCKER=$DAPI_VAR-yes- DATABASE_URL=postgresusernamepasswordpostgres5432username- SECRETS_FILE=runsecretsdjango_s- POSTGRES_USER_FILE=runsecretspg_username- POSTGRES_PASSWORD_FILE=runsecretspg_password
My Deploy
(continues on next page)
57 Exemples 41
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
deployreplicas 1restart_policy
condition on-failuresecrets- pg_username- pg_password- django_s
secretsdjango_s
external Truepg_username
external Truepg_password
external True
devyml
version 32
volumespostgres_data_dev postgres_backup_dev
servicespostgres
image apple_postgresvolumes- postgres_data_devvarlibpostgresqldata- postgres_backup_devbackups
djangoimage apple_djangobuildcontext dockerfile composedjangoDockerfile-dev
command start-devshvolumes- app
ports- 80008000
secrets- pg_username- pg_password- source django_s
target appenv
nodeimage apple_nodeuser $USER-0buildcontext dockerfile composenodeDockerfile-dev
(continues on next page)
42 Chapter 5 Docker compose
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
volumes- app- $PWDgulpfilejsappgulpfilejs httpjdlminfoarticles20160306lessons-building-node-app-dockerhtml- appnode_modules- appvendor
command gulpports BrowserSync port- 30003000 BrowserSync UI port- 30013001
Compose file example 2
See also
bull httpramkulkarnicomblogdocker-project-for-python3-djaongo-and-apache2-setup
Contents
bull Compose file example 2
572 gitlab ARM
See also
bull httpsgitlabcomulm0gitlabinstall-gitlab-using-docker-compose
Contents
bull gitlab ARM
ndash Overview of Docker Compose
5721 Overview of Docker Compose
57 Exemples 43
Tutoriel Docker Release 2019-02-28T143129517726+0100
44 Chapter 5 Docker compose
CHAPTER
SIX
COMPOSE-FILE
See also
bull httpsdocsdockercomcomposeoverview
bull httpsdocsdockercomcomposereference
bull httpsdocsdockercomcomposecompose-file
bull httpsdocsdockercomcomposesamples-for-compose
bull httpsgithubcomsearchq=in3Apath+docker-composeyml+extension3Aymlamptype=Code
bull docker-compose versions
Contents
bull compose-file
ndash Versions
37
36
61 Versions
See also
httpsdocsdockercomcomposecompose-filecompose-versioning
611 37
See also
bull httpsdocsdockercomcomposecompose-filecompose-versioningversion-37
An upgrade of version 3 that introduces new parameters
It is only available with Docker Engine version 18060 and higher
Introduces the following additional parameters
bull init in service definitions
bull rollback_config in deploy configurations
45
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull Support for extension fields at the root of service network volume secret and config definitions
612 36
See also
bull httpsdocsdockercomcomposecompose-filecompose-versioningversion-36
An upgrade of version 3 that introduces new parameters It is only available with Docker Engine version 18020 andhigher
Introduces the following additional parameters
tmpfs size for tmpfs-type mounts
46 Chapter 6 compose-file
CHAPTER
SEVEN
BONNES PRATIQUES DOCKER
Contents
bull Bonnes pratiques Docker
ndash actualfa-safetyfr
ndash Best practices for writing Dockerfiles
ndash Best practices for writing Dockerfiles from Nick Janetakis
71 actualfa-safetyfr
See also
bull httpsactualfa-safetyfrdevopsdocker-en-production
Docker est largement utiliseacute en deacuteveloppement mais bien souvent les choses se compliquent en production
bull drsquoabord lrsquoapplication ne fonctionne pas toujours correctement en prod
bull les performances ne suivent pas
bull ensuite on srsquoaperccediloit que lrsquoon a oublieacute de prendre en compte un certain nombre drsquoeacuteleacutements indispensables enproduction monitoring scalabiliteacute contraintes reacuteseaux
La faciliteacute est alors de dire Docker fonctionne bien en Dev mais nrsquoest pas un outil adapteacute agrave la production Bienau contraire Docker en production doit permettre de faciliter et seacutecuriser les deacuteploiements tout en rendant votreapplication scalable
Mais pour cela il faut bien fonctionner en mode Devops et respecter un certain nombre de bonnes pratiques Crsquoest entant que telle une compeacutetence ou expertise Docker en production qursquoil faut deacutevelopper
Enfin quand votre production atteint une certaine complexiteacute et que le nombre de conteneurs que vous geacuterez se compteen dizaines il faut envisager de passer sur un orchestrateur de conteneurs
Avant drsquoattaquer le vif du sujet vous pouvez revenir sur notre preacuteceacutedent article sur les bases de Docker
72 Best practices for writing Dockerfiles
See also
bull httpsdocsdockercomengineuserguideeng-imagedockerfile_best-practices
47
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull httpsdocsdockercomenginereferencebuilder
Docker can build images automatically by reading the instructions from a Dockerfile a text file that contains all thecommands in order needed to build a given image Dockerfiles adhere to a specific format and use a specific set ofinstructions
You can learn the basics on the Dockerfile Reference page If yoursquore new to writing Dockerfiles you should start there
This document covers the best practices and methods recommended by Docker Inc and the Docker community forbuilding efficient images
To see many of these practices and recommendations in action check out the Dockerfile for buildpack-deps
Note for more detailed explanations of any of the Dockerfile commands mentioned here visit the Dockerfile Refer-ence page
721 9-pillars-of-containers-best-practices
See also
bull httpscontainerjournalcom201810169-pillars-of-containers-best-practices
73 Best practices for writing Dockerfiles from Nick Janetakis
731 Docker Best practices from Nick Janetakis
See also
bull Nick Janetakis
bull httpsnickjanetakiscomblogbest-practices-when-it-comes-to-writing-docker-related-files
bull httpsgithubcomnickjjdocker-web-framework-examples
bull httpsdevtonickjjbest-practices-when-it-comes-to-writing-docker-related-files-ek3
bull httpsgithubcomnickjjdocker-web-framework-examples
Contents
bull Docker Best practices from Nick Janetakis
ndash Dockerfile
ndash docker-composeyml
ndash dockerignore
ndash Example Apps for Popular Web Frameworks
ndash Flask example
Flask Dockerfile
env file
Flask docker-composeyml
48 Chapter 7 Bonnes pratiques Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
helloapppy
gitignore
7311 Dockerfile
bull Use Alpine as a base image unless you canrsquot due to technical reasons
bull Pin versions to at least the minor version example 25-alpine not 2-alpine
bull Add a maintainer LABEL to keep tabs on who initially made the image
bull Only include ARG and ENV instructions if you really need them
bull Use app to store your apprsquos code and set it as the WORKDIR (if it makes sense)
bull When installing packages take advantage of Dockerrsquos layer caching techniques
bull If your app is a web service EXPOSE 8000 unless you have a strong reason not to
bull Include a wget driven HEALTHCHECK (if it makes sense)
bull Stick to the [] syntax when supplying your CMD instructions
7312 docker-composeyml
bull List your services in the order you expect them to start
bull Alphabetize each servicersquos properties
bull Double quote all strings and use for empty hashes dictionaries
bull Pin versions to at least the minor version example 104-alpine not 10-alpine
bull Use instead of $PWD for when you need the current directoryrsquos path
bull Prefer build ldquordquo unless you need to use args or some other sub-property
bull If your service is a web service publish port 8000 unless it doesnrsquot make sense to
7313 dockerignore
bull Donrsquot forget to create this file D
bull Donrsquot forget to add the git folder
bull Donrsquot forget to add any sensitive files such as envproduction
7314 Example Apps for Popular Web Frameworks
Irsquove put together a few example applications that stick to these best practices
You can find them all on httpsgithubcomnickjjdocker-web-framework-examples Fully working Docker Composebased examples that you can reference
bull Flask
bull Node Express
bull Phoenix
73 Best practices for writing Dockerfiles from Nick Janetakis 49
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull Rails
bull Webpack
If you donrsquot see your favorite web framework listed above open up a PR This repo is meant to be a communityeffort where we can work together to make high quality example apps that demonstrate Dockerizing popular webframeworks and libraries
7315 Flask example
See also
bull httpsgithubcomnickjjdocker-web-framework-examplestreemasterflask
73151 Flask Dockerfile
FROM python27-alpineLABEL maintainer=Nick Janetakis ltnickjanetakisgmailcomgt
If you plan to use PostgreSQL then you must add this package postgresql-devRUN apk update ampamp apk add build-base
WORKDIR app
COPY requirementstxt requirementstxtRUN pip install -r requirementstxt
COPY
EXPOSE 8000HEALTHCHECK CMD wget -q -O devnull httplocalhost8000healthy || exit 1
CMD [gunicorn -c pythonconfiggunicorn helloappcreate_app()]
73152 env file
COMPOSE_PROJECT_NAME=flaskhelloPYTHONUNBUFFERED=true
73153 Flask docker-composeyml
version 36
serviceswebbuild command gt
gunicorn --reload -c pythonconfiggunicorn helloappcreate_app()env_file
- envports
- 80008000
(continues on next page)
50 Chapter 7 Bonnes pratiques Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
volumes- app
73154 helloapppy
from flask import Flaskfrom werkzeugdebug import DebuggedApplication
def create_app(settings_override=None)Create a Flask application using the app factory pattern
param settings_override Override settingsreturn Flask appapp = Flask(__name__ instance_relative_config=True)
appconfigfrom_object(configsettings)appconfigfrom_pyfile(settingspy silent=True)
if settings_overrideappconfigupdate(settings_override)
if appdebugappwsgi_app = DebuggedApplication(appwsgi_app evalex=True)
approute()def index()
return Hello world with DEBUG=0format(appconfig[DEBUG])
approute(healthy)def healthy()
return
return app
73155 gitignore
See also
bull httpswwwgitignoreioapi
Created by httpswwwgitignoreioapipythonosx
OSX
DS_StoreAppleDoubleLSOverride
Icon must end with two rIcon
(continues on next page)
73 Best practices for writing Dockerfiles from Nick Janetakis 51
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
Thumbnails_
Files that might appear in the root of a volumeDocumentRevisions-V100fseventsdSpotlight-V100TemporaryItemsTrashesVolumeIconicnscomappletimemachinedonotpresent
Directories potentially created on remote AFP shareAppleDBAppleDesktopNetwork Trash FolderTemporary Itemsapdisk
Python Byte-compiled optimized DLL files__pycache__
py[cod]
$pyclass
C extensions
so
Distribution packagingPythonbuilddevelop-eggsdistdownloadseggseggsliblib64partssdistvarwheels
egg-infoinstalledcfg
egg
PyInstaller Usually these files are written by a python script from a template before PyInstaller builds the exe so as to inject dateother infos into it
manifest
spec
Installer logspip-logtxtpip-delete-this-directorytxt
Unit test coverage reports(continues on next page)
52 Chapter 7 Bonnes pratiques Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
htmlcovtoxcoveragecoveragecachepytest_cachenosetestsxmlcoveragexml
coverhypothesis
Translations
mo
pot
Flask stuffinstancesettingspywebassets-cache
Scrapy stuffscrapy
celery beat schedule filecelerybeat-schedule
End of httpswwwgitignoreioapipythonosx
73 Best practices for writing Dockerfiles from Nick Janetakis 53
Tutoriel Docker Release 2019-02-28T143129517726+0100
54 Chapter 7 Bonnes pratiques Docker
CHAPTER
EIGHT
DOCKER MACHINE
See also
bull httpsdocsdockercommachineoverview
Contents
bull Docker machine
55
Tutoriel Docker Release 2019-02-28T143129517726+0100
56 Chapter 8 Docker machine
CHAPTER
NINE
DOCKER SWARM
See also
bull httpsdocsdockercomengineswarm
91 Docker swarm articles
See also
bull httpsdocsdockercomengineswarm
911 Docker swarm articles 2018
See also
bull httpsdocsdockercomengineswarm
9111 Only one host for production environment What to use docker-compose or single nodeswarm
See also
bull Bret Fischer
bull httpsgithubcomBretFisheramaissues8
bull httpstwittercomBretFisher
Contents
bull Only one host for production environment What to use docker-compose or single node swarm
ndash Question
ndash Response
91111 Question
We have recently moved all our corporative services to run ONE DigitalOcean server having all services in a dockerenvironment redmine dokuwiki opends mattermost a docker registry portainer
57
Tutoriel Docker Release 2019-02-28T143129517726+0100
The way we did it was creating all the needed docker-compose files (one by service and having all the neededcontainers in each one RoR+postgresql Node+Mongo+redis ) add all the needed mountpoints for the volumes(and almost all containers must be persistent) and include the option in all of them with ldquorestart alwaysrdquo
All this apps were started with lsquodocker-compose -d uprdquo and in this way this only ONE server is able to run all services(and all of them get started with server startup) We donrsquot need a cluster right now
We donrsquot know if this approach is a good one or it shouldnrsquot be used for production (and why in this case) We wantto have one server to pay the less as possible and taking into account that it can manage all our apps Should wecreate a swarm move all containers to be swarm services but only have one manager and no workers I would be thatapproach a better option
If this is true what should we use to replace the use of jwildernginx-proxy (and docker-letsencrypt-nginx-proxy-companion) to manage http redirections and automatic generation of letsencrypt certificates
Thanks in advance
91112 Response
I always recommend single-node Swarm with the assumptions you know the risks of a single node of anything andyoursquore backing up persistent data keyssecrets etc
My top reasons for a single-node Swarm over docker-compose
bull It only takes a single command to create a Swarm from that docker host docker swarm init
bull It saves you from needing to manually installupdate docker-compose on that server Docker engine is installableand updatable via common Linux package managers (apt yum) via httpsstoredockercom but docker-composeis not
bull When yoursquore ready to become highly-available you wonrsquot need to start from scratch Just add two more nodesto a well-connected network with the 1st node Ensure firewall ports are open between them Then use dockerswarm join-token manager on 1st node and run that output on 2nd3rd Now you have a fully redundant raftlog and managers Then you can change your compose file for multiple replicas of each of your services andre-apply with docker stack deploy again and yoursquore playinrsquo with the big dogs
bull You get a lot of extra features out-of-the-box with Swarm including secrets configs auto-recovery of serivcesrollbacks healtchecks and ability to use Docker Cloud Swarms BYOS to easily connect to swarm without SSH
bull Healthchecks healthchecks healthchecks docker run and docker-compose wonrsquot re-create containers that faileda built-in healthcheck You only get that with Swarm and it should always be used for production on allcontainers
bull Rolling updates Swarmrsquos docker service update command (which is also used by docker stack deploy whenupdating yaml changes) has TONS of options for controlling how you replace containers during an updateIf yoursquore running your own code on a Swarm updates will be often so you want to make sure the process issmooth depends on healthchecks for being ldquoreadyrdquo maybe starts a new one first before turning off old containerand rolls back if therersquos a problem None of that happens without Swarmrsquos orchestration and scheduling
bull Local docker-compose for development works great in the workflow of getting those yaml files into productionSwarm servers
bull Docker and Swarm are the same daemon so no need to worry about version compatibility of production toolsSwarm isnrsquot going to suddenly make your single production server more complex to manage and maintain
Therersquos more but thatrsquos my big ticket heavy hitters
58 Chapter 9 Docker swarm
CHAPTER
TEN
DOCKER COMMANDS
See also
bull httpsdocsdockercomenginereferencecommandlinedockerdescription
Contents
bull Docker commands
ndash docker help
ndash docker attach
ndash docker build
Description
docker build ndashno-cache
ndash docker commit
ndash docker cp
ndash docker diff
ndash docker exec
ndash docker export
ndash docker history
ndash docker inspect
ndash docker images
ndash docker kill
ndash docker login
ndash docker logs
Description
ndash docker ps
docker ps ndashfilter
ndash docker pull
ndash docker rename
ndash docker run
59
Tutoriel Docker Release 2019-02-28T143129517726+0100
detach-keys
downloading images
labels
entrypoint
ndash docker search
Description
ndash docker system
docker system prune
ndash docker stop
ndash docker tag
ndash docker volume
101 docker help
bull httpsdocsdockercomenginereferencecommandlinehelp
docker help
Usage docker COMMAND
A self-sufficient runtime for containers
Options--config string Location of client config files (default homepvergain
rarr˓docker)-D --debug Enable debug mode-H --host list Daemon socket(s) to connect to-l --log-level string Set the logging level (debug|info|warn|error|fatal
rarr˓) (default info)--tls Use TLS implied by --tlsverify--tlscacert string Trust certs signed only by this CA (default home
rarr˓pvergaindockercapem)--tlscert string Path to TLS certificate file (default homepvergain
rarr˓dockercertpem)--tlskey string Path to TLS key file (default homepvergaindockerkey
rarr˓pem)--tlsverify Use TLS and verify the remote
-v --version Print version information and quit
Management Commandsconfig Manage Docker configscontainer Manage containersimage Manage imagesnetwork Manage networksnode Manage Swarm nodesplugin Manage pluginssecret Manage Docker secretsservice Manage services
(continues on next page)
60 Chapter 10 Docker commands
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
swarm Manage Swarmsystem Manage Dockertrust Manage trust on Docker imagesvolume Manage volumes
Commandsattach Attach local standard input output and error streams to a running
rarr˓containerbuild Build an image from a Dockerfilecommit Create a new image from a containers changescp Copy filesfolders between a container and the local filesystemcreate Create a new containerdiff Inspect changes to files or directories on a containers filesystemevents Get real time events from the serverexec Run a command in a running containerexport Export a containers filesystem as a tar archivehistory Show the history of an imageimages List imagesimport Import the contents from a tarball to create a filesystem imageinfo Display system-wide informationinspect Return low-level information on Docker objectskill Kill one or more running containersload Load an image from a tar archive or STDINlogin Log in to a Docker registrylogout Log out from a Docker registrylogs Fetch the logs of a containerpause Pause all processes within one or more containersport List port mappings or a specific mapping for the containerps List containerspull Pull an image or a repository from a registrypush Push an image or a repository to a registryrename Rename a containerrestart Restart one or more containersrm Remove one or more containersrmi Remove one or more imagesrun Run a command in a new containersave Save one or more images to a tar archive (streamed to STDOUT by default)search Search the Docker Hub for imagesstart Start one or more stopped containersstats Display a live stream of container(s) resource usage statisticsstop Stop one or more running containerstag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEtop Display the running processes of a containerunpause Unpause all processes within one or more containersupdate Update configuration of one or more containersversion Show the Docker version informationwait Block until one or more containers stop then print their exit codes
Run docker COMMAND --help for more information on a command
102 docker attach
See also
bull httpsdocsdockercomenginereferencecommandlineattach
102 docker attach 61
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull View only the IDs of the containers
103 docker build
See also
bull httpsdocsdockercomenginereferencecommandlinebuild
bull httpsdocsdockercomdevelopdevelop-imagesdockerfile_best-practicesbuild-context
1031 Description
The docker build command builds Docker images from a Dockerfile and a context A buildrsquos context is the set of fileslocated in the specified PATH or URL The build process can refer to any of the files in the context For example yourbuild can use a COPY instruction to reference a file in the context The URL parameter can refer to three kinds ofresources
bull Git repositories
bull pre-packaged tarball contexts
bull and plain text files
docker build --tag gdevopsmydjango4
1032 docker build ndashno-cache
You can force a rebuild with docker build ndashno-cache
104 docker commit
See also
bull httpsdocsdockercomenginereferencecommandlinecommit
bull Commit our changes into a new image
bull Exploring a crashed container (docker commit + docker run ndashti ndashentrypoint)
105 docker cp
See also
bull httpsdocsdockercomenginereferencecommandlinecp
bull Commit our changes into a new image
62 Chapter 10 Docker commands
Tutoriel Docker Release 2019-02-28T143129517726+0100
106 docker diff
See also
bull httpsdocsdockercomenginereferencecommandlinediff
bull Inspect the changes
bull Viewing filesystem changes
107 docker exec
See also
bull httpsdocsdockercomenginereferencecommandlineexec
bull How to run a shell in our running container
Examples
docker run -d -p 80005000 -p 80015001 --name myany test_sqlanywherelatestdocker exec -ti myany bash
108 docker export
See also
bull httpsdocsdockercomenginereferencecommandlineexport
bull Obtaining a complete dump (docker export)
109 docker history
See also
bull httpsdocsdockercomenginereferencecommandlinehistory
bull Using image and viewing history
docker history gdevopsmydjango4
1010 docker inspect
See also
bull httpsdocsdockercomenginereferencecommandlineinspect
bull Naming and inspecting containers
bull Inspecting a container
bull Using ndashformat
106 docker diff 63
Tutoriel Docker Release 2019-02-28T143129517726+0100
1011 docker images
See also
bull httpsdocsdockercomenginereferencecommandlineimages
bull Showing current images
docker images
REPOSITORY TAG IMAGE ID CREATED SIZEgdevopsmydjango4 latest 105b33d63fe8 5 minutes ago 984MBpython 36 29d2f3226daf 3 weeks ago 911MB
1012 docker kill
See also
bull httpsdocsdockercomenginereferencecommandlinekill
bull Stop our container
1013 docker login
See also
bull httpsdocsdockercomenginereferencecommandlinelogin
bull Logging into our Docker Hub account
1014 docker logs
See also
bull httpsdocsdockercomenginereferencecommandlinelogs
bull View the logs of a container
10141 Description
Fetch the logs of a container
Usage
docker logs [OPTIONS] CONTAINER
docker logs apache
64 Chapter 10 Docker commands
Tutoriel Docker Release 2019-02-28T143129517726+0100
1015 docker ps
See also
bull httpsdocsdockercomenginereferencecommandlineps
bull List running containers
bull View only the IDs of the containers
bull Using labels to select containers (docker ps ndashfilter)
10151 docker ps ndashfilter
See also
bull Using labels to select containers (docker ps ndashfilter)
1016 docker pull
See also
bull httpsdocsdockercomenginereferencecommandlinepull
bull Downloading images
1017 docker rename
See also
bull httpsdocsdockercomenginereferencecommandlinerename
bull Renaming containers
1018 docker run
See also
bull httpsdocsdockercomenginereferencecommandlinerun
bull Avril 2018 container training from Jeacuterocircme Petazzoni
bull Specifying a name
bull Using labels
bull Detaching from a container
bull Exploring a crashed container (docker commit + docker run ndashti ndashentrypoint)
10181 detach-keys
See also
bull Detaching from a container
1015 docker ps 65
Tutoriel Docker Release 2019-02-28T143129517726+0100
10182 downloading images
See also
bull Downloading images
10183 labels
See also
bull Using labels
10184 entrypoint
See also
bull Exploring a crashed container (docker commit + docker run ndashti ndashentrypoint)
1019 docker search
See also
bull httpsdocsdockercomenginereferencecommandlinesearch
10191 Description
Search the Docker Hub for images
Usage
docker search [OPTIONS] TERM
docker search apache
NAME DESCRIPTIONrarr˓ STARS OFFICIAL AUTOMATEDtomcat Apache Tomcat is an open sourcerarr˓implementati 2063 [OK]httpd The Apache HTTP Server Projectrarr˓ 2038 [OK]cassandra Apache Cassandra is an open-sourcerarr˓distribut 868 [OK]maven Apache Maven is a software projectrarr˓managemen 698 [OK]solr Solr is the popular blazing-fastrarr˓open sour 586 [OK]zookeeper Apache ZooKeeper is an open-sourcerarr˓server wh 484 [OK]eboraasapache-php PHP5 on Apache (with SSL support)rarr˓built on 139 [OK]eboraasapache Apache (with SSL support) built onrarr˓Debian 90 [OK]webdevopsphp-apache-dev PHP with Apache for Development (egrarr˓with xd 78 [OK] (continues on next page)
66 Chapter 10 Docker commands
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
webdevopsphp-apache Apache with PHP-FPM (based onrarr˓webdevopsphp) 74 [OK]groovy Apache Groovy is a multi-facetedrarr˓language fo 58 [OK]tomee Apache TomEE is an all-Apache Java EErarr˓certif 56 [OK]nimmisapache-php5 This is docker images of Ubuntu 1404rarr˓LTS wi 53 [OK]apacheigniteignite Apache Ignite In-Memory docker imagerarr˓ 44 [OK]bitnamiapache Bitnami Apache Docker Imagerarr˓ 42 [OK]linuxserverapache An Apache container brought to you byrarr˓Linux 18apachenutch Apache Nutchrarr˓ 15 [OK]1and1internetubuntu-16-apache-php-70 ubuntu-16-apache-php-70rarr˓ 13 [OK]webdevopsapache Apache containerrarr˓ 11 [OK]antageapache2-php5 Docker image for running Apache 2xrarr˓with PHP 10 [OK]lephareapache Apache containerrarr˓ 4 [OK]newdeveloperapache-php apache-php72rarr˓ 3mastertinnerapache-directory-index-resource A Concourse resource for the apacherarr˓director 1 [OK]secoresearchapache-varnish Apache+PHP+Varnish50rarr˓ 0 [OK]jelasticapachephp An image of the Apache PHP applicationrarr˓serve 0
1020 docker system
See also
bull httpsdocsdockercomenginereferencecommandlinesystem
10201 docker system prune
docker systemp prune
1021 docker stop
See also
bull httpsdocsdockercomenginereferencecommandlinestop
bull Stop our container
1020 docker system 67
Tutoriel Docker Release 2019-02-28T143129517726+0100
1022 docker tag
See also
bull httpsdocsdockercomenginereferencecommandlinetag
bull Tagging images
1023 docker volume
See also
bull httpsdocsdockercomenginereferencecommandlinevolume
$ docker help volume
Usage docker volume COMMAND
Manage volumes
Options
Commandscreate Create a volumeinspect Display detailed information on one or more volumesls List volumesprune Remove all unused local volumesrm Remove one or more volumes
Run docker volume COMMAND --help for more information on a command
68 Chapter 10 Docker commands
CHAPTER
ELEVEN
DOCKERFILE
See also
bull httpsdocsdockercomenginereferencebuilder
bull httpsdocsdockercomenginedeprecated
Contents
bull Dockerfile
ndash Deprecated
MAINTAINER
111 Deprecated
1111 MAINTAINER
bull httpsdocsdockercomenginedeprecatedmaintainer-in-dockerfile
MAINTAINER was an early very limited form of LABEL which should be used instead
The recommended solution is to use LABEL instead eg LABEL authors=rdquofirst authorsecond authorrdquo
69
Tutoriel Docker Release 2019-02-28T143129517726+0100
70 Chapter 11 Dockerfile
CHAPTER
TWELVE
DOCKER NETWORK
See also
bull httpsgithubcomvrdenotestreemasterdocker-playground
bull httpsgithubcomdockerlabstreemasternetworking
Contents
bull Docker network
ndash Las networking
121 Las networking
See also
bull httpsgithubcomdockerlabstreemasternetworking
71
Tutoriel Docker Release 2019-02-28T143129517726+0100
72 Chapter 12 Docker network
CHAPTER
THIRTEEN
VOLUMES DOCKER
See also
bull httpsdocsdockercomengineadminvolumesvolumes
bull httpwwwlemagitfrconseilDocker-quelles-sont-les-options-pour-le-stockage-persistant
bull httpxatazdeveloppezcomtutorielsutilisation-docker
Contents
bull Volumes Docker
ndash Use volumes
ndash Create and manage volumes
docker volume create
docker volume ls
131 Use volumes
Estimated reading time 12 minutes
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers
While bind mounts are dependent on the directory structure of the host machine volumes are completely managed byDocker
Volumes have several advantages over bind mounts
bull Volumes are easier to back up or migrate than bind mounts
bull You can manage volumes using Docker CLI commands or the Docker API
bull Volumes work on both Linux and Windows containers
bull Volumes can be more safely shared among multiple containers
bull Volume drivers allow you to store volumes on remote hosts or cloud providers to encrypt the contents ofvolumes or to add other functionality
bull A new volumersquos contents can be pre-populated by a container
In addition volumes are often a better choice than persisting data in a containerrsquos writable layer because using avolume does not increase the size of containers using it and the volumersquos contents exist outside the lifecycle of agiven container
73
Tutoriel Docker Release 2019-02-28T143129517726+0100
132 Create and manage volumes
Unlike a bind mount you can create and manage volumes outside the scope of any container
1321 docker volume create
Create a volume
docker volume create my-vol
1322 docker volume ls
Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockertutorielspipenvgtrarr˓docker volume ls
DRIVER VOLUME NAMElocal 03f1a1ed0555015e51863dbed5f6c7847099fd33449b9d83919bd7028cdfdd9blocal 4bc5fb631c6af81f5ba84a8465b3c2805ca713541fe736faf3a232ef4b24ae72local 56295a3bb8a90d260864c258e6b174755338543a614f206e5082c066d22eb197local 67871ba2f3b3a9e75fdbfcf2fe5ec36ba7a10cd5930a60e8227abc7110e62ca4local b6432532ff915143ede0b7169abf7690790ce0227277013d7c5ab00007d68703local bbef076d429a90ca7bfd7a751d7c8aa1ea3d08e0b7b4036bb296681545940a0blocal bf69b1f1164c09d7dc0f3e6011f3116e7bc197e0e9341e645a15fdc7566489f3local cee0d9feda75150bda5e6b32c5eeaad4e433afe01165bf822eae8413b1f4e861local pgdatalocal postgresql_postgres_datalocal vote_db-data
74 Chapter 13 Volumes Docker
CHAPTER
FOURTEEN
REGISTRY
See also
bull httpsdocsdockercomregistryintroduction
Contents
bull Registry
ndash Definition
ndash Understanding image naming
ndash Use cases
ndash Implementations
ndash Examples
141 Definition
The registry is the ldquoshiprdquo part of the build ship run workflow
You package your app in a Docker image using a Dockerfile and docker image build and the output is an image onyour machine (or the CI server that ran the build)
To make the image available to other users you ship it to a registry with docker image push The default registry isDocker Hub which is a free public registry service
If you want to keep your images private so theyrsquore only accessible within your own network you can use a commercialregistry like Docker Trusted Registry - which also provides security scanning and image signing
142 Understanding image naming
See also
bull httpsdocsdockercomregistryintroduction
Image names as used in typical docker commands reflect their origin
bull docker pull ubuntu instructs docker to pull an image named ubuntu from the official Docker Hub This is simplya shortcut for the longer docker pull dockeriolibraryubuntu command
75
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull docker pull myregistrydomainportfoobar instructs docker to contact the registry located at myregistrydo-mainport to find the image foobar
143 Use cases
Running your own Registry is a great solution to integrate with and complement your CICD system In a typicalworkflow a commit to your source revision control system would trigger a build on your CI system which would thenpush a new image to your Registry if the build is successful A notification from the Registry would then trigger adeployment on a staging environment or notify other systems that a new image is available
Itrsquos also an essential component if you want to quickly deploy a new image over a large cluster of machines
Finally itrsquos the best way to distribute images inside an isolated network Requirements
You absolutely need to be familiar with Docker specifically with regard to pushing and pulling images You mustunderstand the difference between the daemon and the cli and at least grasp basic concepts about networking
Also while just starting a registry is fairly easy operating it in a production environment requires operational skillsjust like any other service You are expected to be familiar with systems availability and scalability logging and logprocessing systems monitoring and security 101
Strong understanding of http and overall network communications plus familiarity with golang are certainly useful aswell for advanced operations or hacking
144 Implementations
1441 Docker Registry implementations
14411 Gitlab Container Registry
See also
bull httpsdocsgitlabcomeeuserprojectcontainer_registryhtml
bull httpsdocsgitlabcomeecidockerusing_docker_buildhtmlusing-the-gitlab-container-registry
Contents
bull Gitlab Container Registry
ndash Historique
2016-05-23 GitLab Container Registry
Introduction
Docker Basics
Summary
ndash Administration
ndash Examples
76 Chapter 14 Registry
Tutoriel Docker Release 2019-02-28T143129517726+0100
144111 Historique
2016-05-23 GitLab Container Registry
See also
bull httpsaboutgitlabcom20160523gitlab-container-registry
Introduction
Yesterday we released GitLab 88 super powering GitLabrsquos built-in continuous integration With it you can build apipeline in GitLab visualizing your builds tests deploys and any other stage of the life cycle of your software Today(and already in GitLab 88) wersquore releasing the next step GitLab Container Registry
GitLab Container Registry is a secure and private registry for Docker images Built on open source software GitLabContainer Registry isnrsquot just a standalone registry itrsquos completely integrated with GitLab
GitLab is all about having a single integrated experience and our registry is no exception You can now easily useyour images for GitLab CI create images specific for tags or branches and much more
Our container registry is the first Docker registry that is fully integrated with Git repository management and comesout of the box with GitLab 88 So if yoursquove upgraded you already have it This means our integrated ContainerRegistry requires no additional installation It allows for easy upload and download of images from GitLab CI Anditrsquos free
Docker Basics
The main component of a Docker-based workflow is an image which contains everything needed to run an applicationImages are often created automatically as part of continuous integration so they are updated whenever code changesWhen images are built to be shared between developers and machines they need to be stored somewhere and thatrsquoswhere a container registry comes in
The registry is the place to store and tag images for later use Developers may want to maintain their own registry forprivate company images or for throw-away images used only in testing
Using GitLab Container Registry means you donrsquot need to set up and administer yet another service or use a publicregistry
Summary
GitLab Container Registry is the latest addition to GitLabrsquos integrated set of tools for the software development lifecycle and comes with GitLab 88 and up
With GitLab Container Registry testing and deploying Docker containers has never been easier GitLab ContainerRegistry is available on-premises in GitLab CE and GitLab EE at no additional cost and installs in the same infras-tructure as the rest of your GitLab instance
Container Registry is enabled on GitLabcom itrsquos completely free and you can start using it right now
144112 Administration
See also
bull httpsdocsgitlabcomceadministrationcontainer_registryhtml
144 Implementations 77
Tutoriel Docker Release 2019-02-28T143129517726+0100
144113 Examples
Gitlab Container Registry examples
Un registry Docker priveacute avec GitLab
See also
bull httpslumaoeupostgitlab-private-registry-docker
145 Examples
1451 Docker Registry examples
14511 Running Your Own Registry
See also
bull httpsblogsixeyedcomwindows-weekly-dockerfile-20-running-your-own-registry
78 Chapter 14 Registry
CHAPTER
FIFTEEN
GLOSSAIRE DOCKER
See also
bull httpsdocsanacondacomanacondaglossary
Agile Software Development A set of concepts practices and principles for the development of software under whichboth requirements and the software that meets them evolve during the development life-cycle by processes ofcollaboration as opposed to being defined at milestones within it
Containers Running instances of Docker images mdash containers run the actual applications A container includes anapplication and all of its dependencies It shares the kernel with other containers and runs as an isolated processin user space on the host OS You created a container using docker run which you did using the alpine imagethat you downloaded A list of running containers can be seen using the docker ps command
Docker
Deacutefinition 1 (anglais) Docker allows us to easily create clean pre-installed images of our application in anisolated state like a binary application build rather than having to worry about virtual environments andsystem packages of whatever server we are deploying to This build can then be tested and deployed as ifit was an isolated artifact in and of itself
Source httpspeakwinternetblogmodern-devops-django
Deacutefinition 2 With Docker you can run your Django project on an Ubuntu server in a container on your laptopand because Docker is available for Mac Linux and Windows your choice of operating system reallycomes down to preference When it comes time to push your code to a staging or production server youcan be sure itrsquoll run exactly the same as it did on your laptop because you can configure a Dockerfiletoexactly match these environments
Source httpsmediumcomadamzeitcodea-simple-recipe-for-django-development-in-docker-bonus-testing-with-selenium-6a038ec19ba5
Docker daemon The background service running on the host that manages building running and distributing Dockercontainers
Docker client The command line tool that allows the user to interact with the Docker daemon
docker-composeyml
Definition 1 (franccedilais) Le docker compose est un fichier de configuration de lrsquoensemble des Dockers que voussouhaitez deacuteployer pour votre application il sert agrave les deacuteployer et agrave geacuterer les liens entre les conteneursainsi que les volumes de data
Definition 2 (anglais) The file where you can set up your database automatically start your server when youstart your container and cool stuff like that
Source httpswwwrevsyscomtidbitsbrief-intro-docker-djangonauts
Deacutefinition 3 (anglais) Docker Compose lets you run more than one container in a Docker application Itrsquosespecially useful if you want to have a database like Postgres running in a container alongside your web
79
Tutoriel Docker Release 2019-02-28T143129517726+0100
app (Dockerrsquos overview of Compose is helpful) Compose allows you to define several services that willmake up your app and run them all together
Source httpswwwrevsyscomtidbitsbrief-intro-docker-djangonauts
Dockerfile
Definition 1 (franccedilais) Crsquoest le fichier texte qui deacutecrit la configuration de votre docker en geacuteneacuteral on partdrsquoune image standard et on ajoute les eacuteleacutements propres agrave la configuration de lrsquoapplication que lrsquoon veutdeacuteployer une fois le Dockerfile finaliseacute on build le conteneur
Definition 2 (anglais) The name of the file that contains the instructions for setting up your image Sourcehttpswwwrevsyscomtidbitsbrief-intro-docker-djangonauts
Docker image
Definition 1 (franccedilais) Crsquoest lrsquoeacuteleacutement de base drsquoun docker on utilise une Docker image agrave deux stades
bull Au deacutepart on va chercher une image de base standard pour lrsquoapplicatif choisi (Nginx Php Redis)le plus souvent dans un repository public on complegravete ensuite cette image standard des eacuteleacutementsde configuration de votre application vous pouvez ensuite enregistrer la nouvelle image dans unrepository public ou priveacute
Definition 2 (anglais) The file system and configuration of our application which are used to create containersTo find out more about a Docker image run
docker inspect alpine
In the demo above you used the docker pull command to download the alpine image When you executedthe command docker run hello-world it also did a docker pull behind the scenes to download the hello-world image
Definition 3 (anglais) A lightweight stand-alone executable package that includes everything needed torun a piece of software You will set up a specific image for each project you work on that will tell Dockerwhich packages your project needs where your code lives etc
Source httpswwwrevsyscomtidbitsbrief-intro-docker-djangonauts
Docker Store A registry of Docker images where you can find trusted and enterprise ready containers plugins andDocker editions Yoursquoll be using this later in this tutorial
hyperviseur
Hyperviseur En informatique un hyperviseur est une plate-forme de virtualisation qui permet agrave plusieurs systegravemesdrsquoexploitation de travailler sur une mecircme machine physique en mecircme temps
Hyper-V Microsoft Hyper-V codenamed Viridian and formerly known as Windows Server Virtualization is a nativehypervisor it can create virtual machines on x86-64 systems running Windows
Hyper-V eacutegalement connu sous le nom de Windows Server Virtualisation est un systegraveme de virtualisation baseacutesur un hyperviseur 64 bits de la version de Windows Server 2008
Orchestrateur de conteneurs Lrsquoorchestrateur est un peu au conteneur ce que vSpherevCenter est agrave VMware pourdes VMs crsquoest le logiciel de gestion de lrsquoensemble des conteneurs sur un pool de ressources serveurs avecdavantage de fonctionnaliteacutes que vSpherevCenter Crsquoest en quelque sorte un PaaS pour les conteneurs
reverse proxy
proxy inverse Un proxy inverse (reverse proxy) est un type de serveur habituellement placeacute en frontal de serveursweb Contrairement au serveur proxy qui permet agrave un utilisateur drsquoacceacuteder au reacuteseau Internet le proxy inversepermet agrave un utilisateur drsquoInternet drsquoacceacuteder agrave des serveurs internes une des applications courantes du proxyinverse est la reacutepartition de charge (load-balancing)
80 Chapter 15 Glossaire Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 1 Un orchestrateur gegravere un pool de ressources serveurs et reacuteseau seealso httpsactualfa-safetyfrdevopsdocker-en-production
Le proxy inverse est installeacute du cocircteacute des serveurs Internet Lrsquoutilisateur du Web passe par son intermeacutediaire pouracceacuteder aux applications de serveurs internes Le proxy inverse est parfois appeleacute substitut (surrogate)
See also
httpsfrwikipediaorgwikiProxy_inverse
Essaim
Swarm
swarm A swarm is a cluster of one or more Docker Engines running in swarm mode En franccedilais swarm est un essaim
Fig 2 Un essaim de docker engines
Virtual machine Have you ever seen someone boot up Windows on a Mac That process of running one completeOS on top of another OS called running a virtual machine
See also
httperickmatsenorg20180419dockerhtml
81
Tutoriel Docker Release 2019-02-28T143129517726+0100
82 Chapter 15 Glossaire Docker
CHAPTER
SIXTEEN
DOCKER FAQ
See also
bull httpsdocsdockercomcomposefaq
Contents
bull docker FAQ
ndash How to delete all your docker images
ndash How to run a shell in our running container
ndash How to delete stopped containers
ndash Where can I find example compose files
161 How to delete all your docker images
docker rm $(docker ps -a -q)
162 How to run a shell in our running container
See also
bull Getting inside a container
bull Getting a shell in a running container
bull Getting a shell in a stopped container
There are 2 methods
bull docker exec
$ docker exec -ti ticktock sh
bull overriding the Dockerfile entrypoint see httpsavril2018containertrainingintroymlhtml194
$ docker run -it --entrypoint bash figlet
83
Tutoriel Docker Release 2019-02-28T143129517726+0100
163 How to delete stopped containers
See also
bull Getting inside a container
$ docker system prune
WARNING This will remove- all stopped containers- all networks not used by at least one container- all dangling images- all build cache
Are you sure you want to continue [yN] yDeleted Containers9a47c35465927f391fefd3faeec5b88a6926430ba7bf49160e08cfbf61d9aeaba1919f59bab55b472597c00051c5be57aac64e2f5d5e40deba0cbe5f9f4448ff49268904d59e18f3b4b33f1ff11122cc3d6cefc5dbec0a0242f20f4f2dee219fa061133b8ff0e07b63285573b2f3e4dc9ac598c36737d32c42ff0d80af7d5668
Deleted Networksch4-message-board-app_default
Deleted Imagesdeleted sha256e43bb6363c1ff911ce34c76475cfbc4020df989221710052a8be91f7702afcabdeleted sha25646ee23e3a5a944b87b11ba03fda425d9b79a922c9df4e958def47785a5303965deleted sha256d373c573904be4c45edce0494c202f7a1cf44c87515ad24b2c2c80824b734115deleted sha256aee4f1ad67db567e681ed8847ab56c87489ab44bfd1cc183f9a75fc1164ce4a7deleted sha256724bf0a6facc9e4efd4e865c995a683e586981deb6310115269f864cda772836
Total reclaimed space 8349kB
164 Where can I find example compose files
There are many examples of Compose files on github
84 Chapter 16 docker FAQ
CHAPTER
SEVENTEEN
HEacuteBERGEURS DOCKER
Contents
bull Heacutebergeurs Docker
ndash Gitlab
ndash Amazon
171 Gitlab
Gitlab peut heacuteberger des images Docker
172 Amazon
See also
bull httpwwwjournaldunetcomsolutionscloud-computing1205896-comment-aws-supporte-t-il-vraiment-docker
85
Tutoriel Docker Release 2019-02-28T143129517726+0100
86 Chapter 17 Heacutebergeurs Docker
CHAPTER
EIGHTEEN
DOCKER DOCUMENTATION
181 Docker aquasec documentation
See also
bull httpswwwaquaseccomwiki
1811 About this Site
This website brings together thousands of online resources about container technology
Containers are nothing new as early as 1982 Unix administrators could launch isolated processes similar to todayrsquoscontainers using the chroot command
The first modern container was probably Linux-VServer released in 2001
Containers matured considerably in the 12 years that followed until the rise of Docker which finally took containersto the mainstream
Today cloud computing deployment DevOps and agile development are almost synonymous with containers Somuch has been written on this complex subject and few have attempted to organize this corpus into a meaningfulformat
At Aqua Security a pioneer in container security we took upon ourselves to fill this gap and collect the most importantwritings about container technology - from conceptual articles and best practices to vendor information and howto guides - to help the growing community make sense of the space The end result will include over 200 sub-topics around containers container platforms container orchestration and more With a special focus on Docker andKubernetes which are becoming ubiquitous in modern container setups
87
Tutoriel Docker Release 2019-02-28T143129517726+0100
88 Chapter 18 Docker documentation
CHAPTER
NINETEEN
DOCKER PEOPLE
191 Bret Fischer
See also
bull httpstwittercomBretFisher
bull httpsgithubcomBretFisheramaissues
1911 News
19111 2018
See also
bull Only one host for production environment What to use docker-compose or single node swarm
192 Nick Janetakis
See also
bull httpsgithubcomnickjj
bull httpsgalaxyansiblecomnickjj
bull httpstwittercomnickjanetakis
bull httpsnickjanetakiscomblog
1921 Best practices
See also
bull Docker Best practices from Nick Janetakis
193 Mickael Bright
See also
bull httpsgithubcommjbright
89
Tutoriel Docker Release 2019-02-28T143129517726+0100
90 Chapter 19 Docker people
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull httpsmediumcommjbrightfr
bull httpstwittercommjbright
bull httpsmjbrightgithubioTalks
bull httpsmjbrightblogspotcom
Contents
bull Mickael Bright
ndash Activiteacutes septembre 2018 agrave Grenoble
193 Mickael Bright 91
Tutoriel Docker Release 2019-02-28T143129517726+0100
1931 Activiteacutes septembre 2018 agrave Grenoble
See also
bull Kubernetes news 2018-09
194 Steacutephane Beuret
See also
bull httpstwittercomSaphoooo
bull httpsconnected-diamondcomauteurview73156-beuret_stephane
bull httpsgithubcomde13
bull httpswwwmeetupcomfr-FRLuxembourg-Rancher-Meetupmembers216544162
Contents
bull Steacutephane Beuret
ndash Activiteacutes 2018
GNULinux Mag hors seacuterie Ndeg98 septembre 2018
GNUlinux mag Ndeg217 juillet 2018
GNUlinux mag Ndeg214 avril 2018
GNUlinux mag Ndeg211 janvier 2018
GNUlinux mag Ndeg204 mai 2017
1941 Activiteacutes 2018
19411 GNULinux Mag hors seacuterie Ndeg98 septembre 2018
See also
bull Mardi 4 septembre 2018 Lrsquoeacutedito du hors-seacuterie Ndeg98 speacutecial conteneurs
bull httpsboutiqueed-diamondcomen-kiosque1356-gnulinux-magazine-hs-98html
19412 GNUlinux mag Ndeg217 juillet 2018
See also
bull httpsconnected-diamondcomGNU-Linux-MagazineGLMF-217Vous-avez-dit-event-driven
19413 GNUlinux mag Ndeg214 avril 2018
See also
bull httpsconnected-diamondcomGNU-Linux-MagazineGLMF-214Stockage-persistant-dans-Kubernetes-avec-Rook
92 Chapter 19 Docker people
Tutoriel Docker Release 2019-02-28T143129517726+0100
19414 GNUlinux mag Ndeg211 janvier 2018
See also
bull httpsconnected-diamondcomGNU-Linux-MagazineGLMF-211Introduction-Serverless-et-Function-as-a-Service-FaaS
19415 GNUlinux mag Ndeg204 mai 2017
See also
bull httpsconnected-diamondcomGNU-Linux-MagazineGLMF-204Deployez-Kubernetes-sur-vos-Raspberry-Pi-avec-Kubeadm
194 Steacutephane Beuret 93
Tutoriel Docker Release 2019-02-28T143129517726+0100
94 Chapter 19 Docker people
CHAPTER
TWENTY
LINUX TECHNIQUES
Contents
bull linux techniques
ndash namespaces
ndash cgroups
201 namespaces
202 cgroups
95
Tutoriel Docker Release 2019-02-28T143129517726+0100
96 Chapter 20 linux techniques
CHAPTER
TWENTYONE
DOCKER VIDEOS
See also
bull httpsdocsdockercomdocker-for-windows
211 2018
See also
bull httpswwwyoutubecomwatchv=YFl2mCHdv24
97
Tutoriel Docker Release 2019-02-28T143129517726+0100
98 Chapter 21 Docker videos
CHAPTER
TWENTYTWO
ACTIONSNEWS
221 Actionsnews 2018
2211 Actionsnews 2018-11
22111 Jeudi 8 novembre 2018 sortie de Docker 1809
See also
bull 1809-ce (2018-11-08)
2212 Actionsnews 2018-09
Contents
bull Actionsnews 2018-09
ndash Deacutemonstration de Mickael Bright agrave Grenoble
22121 Deacutemonstration de Mickael Bright agrave Grenoble
See also
bull Kubernetes news 2018-09
2213 Actionsnews 2018-08
Contents
bull Actionsnews 2018-08
ndash ~jpetazzoDeacuterisquer son infrastructure avec les conteneurs
99
Tutoriel Docker Release 2019-02-28T143129517726+0100
22131 ~jpetazzoDeacuterisquer son infrastructure avec les conteneurs
See also
bull httpsjpetazzogithubio20180801containers-cloud-immutable-infrastructure-orchestration
Liens
bull httpscodefbcomwebrapid-release-at-massive-scale
2214 Actionsnews 2018-06
Contents
bull Actionsnews 2018-06
ndash Et je suis passeacute agrave https avec Docker et Traefik (https letsencrypt)
Conclusion
ndash Interesting Dockerfile and docker-compose files
Joe Jasinski
Jeff Triplett
cookiecutter-django docker-postgres backups
ndash Introducing an Easier Way To Design Applications in Docker Desktop
ndash Docker adoption
22141 Et je suis passeacute agrave https avec Docker et Traefik (https letsencrypt)
See also
bull httpswwwit-warscompostsperformancedocker-traefik-letsencrypt
221411 Conclusion
Jrsquoutilise Traefik depuis quelques temps deacutejagrave pour la partie Docker de mon infrastructure son support natif de Letsec-nrypt pour passer mon site web existant en httpshttp2 a eacuteteacute reacutealiseacute en moins de 10 min
Je mesure un gain de performance et je suis maintenant tranquille par rapport agrave la politique de Google concernant lessites non-https
22142 Interesting Dockerfile and docker-compose files
221421 Joe Jasinski
See also
bull httpsgithubcomJoeJasinskidocker-django-demoblobblogpostdocker-composeyml
bull httpsgithubcomJoeJasinskidocker-django-demoblobblogpostDockerfile
100 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull httpsgithubcomJoeJasinskidocker-django-demoblobblogpostdddemosettingsbasepy
221422 Jeff Triplett
See also
bull httpsrawgithubusercontentcomjefftriplettdjango-startprojectmasterproject_templateDockerfile
bull httpsgithubcomjefftriplettdjango-startprojectblobmasterproject_templatedocker-composeyml
bull httpsgithubcomjefftriplettdjango-startprojectblobmasterproject_templateconfigsettingspy-tpl
221423 cookiecutter-django docker-postgres backups
See also
bull httpscookiecutter-djangoreadthedocsioenlatestindexhtml
bull httpscookiecutter-djangoreadthedocsioenlatestdeveloping-locally-dockerhtml
bull httpscookiecutter-djangoreadthedocsioenlatestdocker-postgres-backupshtml
bull httpscookiecutter-djangoreadthedocsioenlatestdeployment-with-dockerhtml
22143 Introducing an Easier Way To Design Applications in Docker Desktop
See also
bull httpsblogdockercom201806design-applications-in-docker-desktop
22144 Docker adoption
See also
bull httpswwwdatadoghqcomdocker-adoption
2215 Actionsnews mai 2018
Contents
bull Actionsnews mai 2018
ndash Tutoriel pour preacuteparer son environnement de deacuteveloppement ROS avec Docker de Mickael Baron
ndash DjangoCon 2018 - An Intro to Docker for Djangonauts by Lacey Williams
ndash hard-multi-tenancy-in-kubernetes
ndash containers-security-and-echo-chambers
ndash Aly Sivji Joe Jasinski tathagata dasgupta (t) - Docker for Data Science - PyCon 2018
Description
ndash Creacuteez un cluster hybride ARMAMD64 (GNULinux Ndeg215 mai 2018)
221 Actionsnews 2018 101
Tutoriel Docker Release 2019-02-28T143129517726+0100
22151 Tutoriel pour preacuteparer son environnement de deacuteveloppement ROS avec Docker de MickaelBaron
See also
bull Tutoriel pour preacuteparer son environnement de deacuteveloppement ROS avec Docker de Mickael Baron
22152 DjangoCon 2018 - An Intro to Docker for Djangonauts by Lacey Williams
See also
bull httpswwwyoutubecomwatchv=v5jfDDg55xsampfeature=youtubeampa=
bull A Brief Intro to Docker for Djangonauts par Lacey Williams
22153 hard-multi-tenancy-in-kubernetes
See also
bull httpsblogjessfrazcomposthard-multi-tenancy-in-kubernetes
22154 containers-security-and-echo-chambers
See also
bull httpsblogjessfrazcompostcontainers-security-and-echo-chambers
22155 Aly Sivji Joe Jasinski tathagata dasgupta (t) - Docker for Data Science - PyCon 2018
See also
bull httpsgithubcomdocker-for-data-sciencedocker-for-data-science-tutorial
bull httpswwwyoutubecomwatchv=jbb1dbFaovg
bull httpstcoZW7g1JY3va
221551 Description
Jupyter notebooks simplify the process of developing and sharing Data Science projects across groups and organiza-tions However when we want to deploy our work into production we need to extract the model from the notebookand package it up with the required artifacts (data dependencies configurations etc) to ensure it works in otherenvironments
Containerization technologies such as Docker can be used to streamline this workflow
This hands-on tutorial presents Docker in the context of Reproducible Data Science - from idea to application deploy-ment
You will get a thorough introduction to the world of containers learn how to incorporate Docker into various DataScience projects and walk through the process of building a Machine Learning model in Jupyter and deploying it as acontainerized Flask REST API
102 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
22156 Creacuteez un cluster hybride ARMAMD64 (GNULinux Ndeg215 mai 2018)
2216 Actionsnews avril 2018
Contents
bull Actionsnews avril 2018
ndash Les slides de Petazzoni pour les formations docker et kubernetes drsquoavril 2018
Le reacutepertoire source des slides
Autres confeacuterences passeacutees et futures
ndash Docker for the busy researcher (from Erik Matsen)
Why Docker
22161 Les slides de Petazzoni pour les formations docker et kubernetes drsquoavril 2018
bull httpsavril2018containertraining
bull httpsavril2018containertrainingintroymlhtml1 (Introduction to containers 662 slides)
bull httpsavril2018containertrainingkubeymlhtml1 (introduction to orchtestration with kubernetes 384 slides)
221611 Le reacutepertoire source des slides
bull httpsgithubcomjpetazzocontainertraining
221612 Autres confeacuterences passeacutees et futures
bull httpcontainertraining
22162 Docker for the busy researcher (from Erik Matsen)
See also
bull httperickmatsenorg20180419dockerhtml
221621 Why Docker
Have you ever been frustrated because a software packagersquos installation instructions were incomplete Or have youwanted to try out software without going through a complex installation process Or have you wanted to execute yoursoftware on some remote machine in a defined environment
Docker can help
In my group we use Docker to make sure that our code compiles properly in a defined environment and analyses arereproducible We automatically create Docker images through Dockerfiles This provides a clear list of dependencieswhich are guaranteed to work starting from a defined starting point
Once a Docker image is built it can be run anywhere that runs the Docker engine
221 Actionsnews 2018 103
Tutoriel Docker Release 2019-02-28T143129517726+0100
2217 Actionsnews mars 2018
22171 Jeudi 29 mars 2018 Running Your Own Registry
See also
bull httpsblogsixeyedcomwindows-weekly-dockerfile-20-running-your-own-registry
221711 Docker Registry
The registry is the ldquoshiprdquo part of the build ship run workflow
You package your app in a Docker image using a Dockerfile and docker image build and the output is an image onyour machine (or the CI server that ran the build)
22172 Jeudi 29 mars 2018 Article de Jeacuterocircme Petazzoni Containers par ougrave commencer
See also
bull httpsjpetazzogithubio20180328containers-par-ou-commencer
2218 Actionsnews feacutevrier 2018
22181 Mardi 13 feacutevrier 2018 import drsquoune nouvelle base de donneacutees donneacutees db_id3_intranet
Contents
bull Mardi 13 feacutevrier 2018 import drsquoune nouvelle base de donneacutees donneacutees db_id3_intranet
ndash Suppression du volume djangoid3_intranet_volume (docker volume rm djangoid3_intranet_volume)
ndash Import de la nouvelle base de donneacutees (docker-compose -f docker-compose_for_existing_databaseymlup ndashbuild)
ndash Accegraves agrave la nouvelle base de donneacutees (docker-compose exec db bash)
ndash Arrecirct du service (docker-compose -f docker-compose_for_existing_databaseyml down)
221811 Suppression du volume djangoid3_intranet_volume (docker volume rm djan-goid3_intranet_volume)
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockertutorielsdjango_rarr˓id3gt docker volume ls
DRIVER VOLUME NAMElocal djangoid3_intranet_volumelocal postgresql_volume_intranet
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockertutorielsdjango_rarr˓id3gt docker volume rm djangoid3_intranet_volume
104 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
djangoid3_intranet_volume
221812 Import de la nouvelle base de donneacutees (docker-compose -f docker-compose_for_existing_databaseyml up ndashbuild)
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockertutorielsdjango_rarr˓id3gt docker-compose -f docker-compose_for_existing_databaseyml up --build
WARNING The Docker Engine youre using is running in swarm mode
Compose does not use swarm mode to deploy services to multiple nodes in a swarmrarr˓All containers will be scheduled on the current node
To deploy your application across the swarm use `docker stack deploy`
Creating network djangoid3_default with the default driverCreating volume djangoid3_intranet_volume with default driverBuilding dbStep 13 FROM postgres102---gt 6e3b6a866c37
Step 23 RUN localedef -i fr_FR -c -f UTF-8 -A usrsharelocalelocalealiasrarr˓fr_FRUTF-8
---gt Using cache---gt 65da73d90928
Step 33 ENV LANG fr_FRutf8---gt Using cache---gt a932c8fcf807
Successfully built a932c8fcf807Successfully tagged djangoid3_dblatestCreating container_database doneAttaching to container_databasecontainer_database | Les fichiers de ce cluster appartiendront aacute lutilisateur frac12
rarr˓postgres container_database | Le processus serveur doit eacutegalement lui appartenircontainer_database |container_database | Linstance sera initialiseacutee avec la locale frac12 fr_FRutf8 container_database | Lencodage par deacutefaut des bases de donneacutees a eacuteteacute configureacute
rarr˓en conseacutequencecontainer_database | avec frac12 UTF8 container_database | La configuration de la recherche plein texte a eacuteteacute
rarr˓initialiseacutee aacute frac12 french container_database |container_database | Les sommes de contr les des pages de donneacutees sont
rarr˓deacutesactiveacuteescontainer_database |container_database | correction des droits sur le reacutepertoire existant varlib
rarr˓postgresqldata okcontainer_database | creacuteation des sous-reacutepertoires okcontainer_database | seacutelection de la valeur par deacutefaut de max_connections 100container_database | seacutelection de la valeur par deacutefaut pour shared_buffers
rarr˓128MBcontainer_database | seacutelection de limpleacutementation de la meacutemoire partageacutee
rarr˓dynamiqueposixcontainer_database | creacuteation des fichiers de configuration okcontainer_database | lancement du script bootstrapok
(continues on next page)
221 Actionsnews 2018 105
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
container_database | exeacutecution de linitialisation apregraves bootstrapokcontainer_database | synchronisation des donneacutees sur disqueokcontainer_database |container_database | ATTENTION active lauthentification frac12 trust pour les
rarr˓connexionscontainer_database | localescontainer_database | Vous pouvez changer cette configuration en eacuteditant le
rarr˓fichier pg_hbaconfcontainer_database | ou en utilisant loption -A ou --auth-local et --auth-host
rarr˓au prochaincontainer_database | lancement dinitdbcontainer_database |container_database | Succegraves Vous pouvez maintenant lancer le serveur de bases de
rarr˓donneacutees en utilisant container_database |container_database | pg_ctl -D varlibpostgresqldata -l fichier de trace
rarr˓startcontainer_database |container_database | container_database | WARNING No password has been set for the databasecontainer_database | This will allow anyone with access to thecontainer_database | Postgres port to access your database Incontainer_database | Dockers default configuration this iscontainer_database | effectively any other container on the samecontainer_database | systemcontainer_database |container_database | Use -e POSTGRES_PASSWORD=password to setcontainer_database | it in docker runcontainer_database | container_database | en attente du deacutemarrage du serveur2018-02-14 125243
rarr˓323 UTC [38] LOG en eacutecoute sur IPv4 adresse frac12 127001 port 5432container_database | 2018-02-14 125243342 UTC [38] LOG na pas pu lier IPv6
rarr˓ aacute ladresse frac12 1 Ne peut attribuer ladresse demandeacuteecontainer_database | 2018-02-14 125243342 UTC [38] ASTUCE Un autre
rarr˓postmaster fonctionne-til deacutej aacute sur le port 5432 container_database | Sinon attendez quelques secondes et reacuteessayezcontainer_database | 2018-02-14 125243508 UTC [38] LOG eacutecoute sur la socket
rarr˓Unix frac12 varrunpostgresqlsPGSQL5432container_database | 2018-02-14 125243693 UTC [39] LOG le systegraveme de bases
rarr˓de donneacutees a eacuteteacute arr notteacute aacute 2018-02-14 125240 UTCcontainer_database | 2018-02-14 125243791 UTC [38] LOG le systegraveme de bases
rarr˓de donneacutees est pr nott pour accepter les connexionscontainer_database | effectueacutecontainer_database | serveur deacutemarreacutecontainer_database | ALTER ROLEcontainer_database |container_database |container_database | usrlocalbindocker-entrypointsh running docker-
rarr˓entrypoint-initdbddump_id3_intranetsqlcontainer_database | CREATE ROLEcontainer_database | SETcontainer_database | SETcontainer_database | SET
container_database | ALTER TABLEcontainer_database | ALTER TABLE
(continues on next page)
106 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
container_database | ALTER TABLEcontainer_database | GRANTcontainer_database |container_database |container_database | en attente de larr nott du serveur2018-02-14 125339199
rarr˓UTC [38] LOG a re ordmu une demande darr nott rapidecontainer_database | 2018-02-14 125339297 UTC [38] LOG annulation des
rarr˓transactions activescontainer_database | 2018-02-14 125339302 UTC [38] LOG processus de travail
rarr˓logical replication launcher (PID 45) quitte avec le code de sortie 1container_database | 2018-02-14 125339304 UTC [40] LOG arr nott en courscontainer_database | 2018-02-14 125346826 UTC [38] LOG le syst iquestme de
rarr˓base de donn reges est arr nott regcontainer_database | effectu regcontainer_database | serveur arr nott regcontainer_database |container_database | PostgreSQL init process complete ready for start upcontainer_database |container_database | 2018-02-14 125347027 UTC [1] LOG en regcoute sur IPv4
rarr˓adresse frac12 0000 port 5432container_database | 2018-02-14 125347027 UTC [1] LOG en regcoute sur IPv6
rarr˓adresse frac12 port 5432container_database | 2018-02-14 125347252 UTC [1] LOG regcoute sur la socket
rarr˓Unix frac12 varrunpostgresqlsPGSQL5432container_database | 2018-02-14 125347522 UTC [68] LOG le syst iquestme de bases
rarr˓de donn reges a regt reg arr nott reg aacute 2018-02-14 125346 UTCcontainer_database | 2018-02-14 125347648 UTC [1] LOG le syst iquestme de bases
rarr˓de donn reges est pr nott pour accepter les connexions
221813 Accegraves agrave la nouvelle base de donneacutees (docker-compose exec db bash)
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockertutorielsdjango_rarr˓id3gt docker-compose exec db bash
root365f7c4e3096 psql -U postgres
psql (102 (Debian 102-1pgdg90+1))Saisissez laquo help raquo pour laide
postgres= l
Liste desrarr˓bases de donneacutees
Nom | Proprieacutetaire | Encodage | Collationnement | Type caract |rarr˓Droits daccegraves-----------------+--------------+----------+-----------------+--------------+---------rarr˓--------------db_id3_intranet | id3admin | UTF8 | fr_FRUTF-8 | fr_FRUTF-8 |postgres | postgres | UTF8 | fr_FRutf8 | fr_FRutf8 |template0 | postgres | UTF8 | fr_FRutf8 | fr_FRutf8 | =crarr˓postgres +
| | | |rarr˓ | postgres=CTcpostgres
(continues on next page)
221 Actionsnews 2018 107
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 1 Accegraves agrave la base de donneacutees mise agrave jour avec les donneacutees de sybase
108 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
template1 | postgres | UTF8 | fr_FRutf8 | fr_FRutf8 | =crarr˓postgres +
| | | |rarr˓ | postgres=CTcpostgres(4 lignes)
postgres= c db_id3_intranet
Vous ecirctes maintenant connecteacute agrave la base de donneacutees laquo db_id3_intranet raquo en tant qurarr˓utilisateur laquo postgres raquodb_id3_intranet= dt
221814 Arrecirct du service (docker-compose -f docker-compose_for_existing_databaseyml down)
docker-compose -f docker-compose_for_existing_databaseyml down
22182 Mardi 13 feacutevrier 2018 mise en place drsquoune base de donneacutees PostgreSQL 102 avec importde la base de donneacutees db_id3_intranet
Contents
bull Mardi 13 feacutevrier 2018 mise en place drsquoune base de donneacutees PostgreSQL 102 avec import de la base dedonneacutees db_id3_intranet
ndash docker-compose_for_existing_databaseyml
ndash Contenu du reacutepertoire init
Creacuteation de la base db_id3_intranet
Creacuteation de lrsquoutilisateur id3admin
221821 docker-compose_for_existing_databaseyml
La ligne tregraves importante qursquoil fallait trouver est la ligne
- initdocker-entrypoint-initdbd
docker-compose_for_existing_databaseyml Create a new persistant intranet_volume from initdbdump_2018_02_01sqlversion 3services
dbbuildcontext dockerfile dbDockerfile
container_name container_databaseports the 5432 host port is occupied by a local postgressql server- 54335432
(continues on next page)
221 Actionsnews 2018 109
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
volumes- intranet_volumevarlibpostgresqldata First import of the database- initdocker-entrypoint-initdbd
volumesintranet_volume
221822 Contenu du reacutepertoire init
Mode LastWriteTime Length Name---- ------------- ------ -----a---- 13022018 1105 34177687 dbdump_2018_02_01sql
Lrsquoentecircte du fichier SQL eacutetant
---- PostgreSQL database dump--
-- Dumped from database version 101-- Dumped by pg_dump version 101
SET statement_timeout = 0SET lock_timeout = 0SET idle_in_transaction_session_timeout = 0SET client_encoding = UTF8SET standard_conforming_strings = onSET check_function_bodies = falseSET client_min_messages = warningSET row_security = off
---- Name db_id3_intranet Type DATABASE Schema - Owner id3admin--
CREATE DATABASE db_id3_intranet WITH TEMPLATE = template0 ENCODING = UTF8 LC_rarr˓COLLATE = fr_FRUTF-8 LC_CTYPE = fr_FRUTF-8
CREATE USER id3admin WITHLOGINNOSUPERUSERINHERITNOCREATEDBNOCREATEROLENOREPLICATIONpassword id338
ALTER DATABASE db_id3_intranet OWNER TO id3admin
connect db_id3_intranet
SET statement_timeout = 0
(continues on next page)
110 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
SET lock_timeout = 0SET idle_in_transaction_session_timeout = 0SET client_encoding = UTF8SET standard_conforming_strings = onSET check_function_bodies = falseSET client_min_messages = warningSET row_security = off
---- Name db_id3_intranet Type COMMENT Schema - Owner id3admin--
COMMENT ON DATABASE db_id3_intranet IS La base db_id3_intranet
Creacuteation de la base db_id3_intranet
CREATE DATABASE db_id3_intranet WITH TEMPLATE = template0 ENCODING = UTF8 LC_rarr˓COLLATE = fr_FRUTF-8 LC_CTYPE = fr_FRUTF-8
Creacuteation de lrsquoutilisateur id3admin
CREATE USER id3admin WITHLOGINNOSUPERUSERINHERITNOCREATEDBNOCREATEROLENOREPLICATIONpassword id338
22183 Lundi 12 feacutevrier 2018 mise en place drsquoune base de donneacutees PostgreSQL 102
Contents
bull Lundi 12 feacutevrier 2018 mise en place drsquoune base de donneacutees PostgreSQL 102
ndash Dockerfile
ndash docker-composeyml
ndash Accegraves HeidiSQL agrave partir de la machine hocircte
221831 Dockerfile
httpsstoredockercomimagespostgresFROM postgres102 avec cette image on peut mettre en place la locale fr_FRutf8
(continues on next page)
221 Actionsnews 2018 111
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
RUN localedef -i fr_FR -c -f UTF-8 -A usrsharelocalelocalealias fr_FRUTF-8ENV LANG fr_FRutf8
221832 docker-composeyml
version 3services
dbbuildcontext dockerfile Dockerfile
ports the 5432 host port is occupied by a local postgressql server- 54335432
volumes- volume_intranetvarlibpostgresqldata
volumesvolume_intranet
221833 Accegraves HeidiSQL agrave partir de la machine hocircte
Fig 2 Accegraves HeidiSQL agrave partir de la machine hocircte sur le port 5433
2219 Actionsnews janvier 2018
22191 Mercredi 31 janvier 2018 exportimport drsquoune base de donneacutees PostgreSQL (tutoriel Post-greSQL)
See also
bull Mercredi 31 janvier 2018 exportimport drsquoune base de donneacutees PostgreSQL (tutoriel PostgreSQL)
112 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
221911 Dockerfile
FROM postgres101RUN localedef -i fr_FR -c -f UTF-8 -A usrsharelocalelocalealias fr_FRUTF-8ENV LANG fr_FRutf8
221912 docker-composeyml
version 3services
dbbuildcontext dockerfile Dockerfile
image postgres101container_name container_intranetvolumes- volume_intranetvarlibpostgresqldata- code
volumesvolume_intranet
221913 Export
bull pg_dump -U postgres ndashclean ndashcreate -f dbdumpsql db_id3_intranet
221914 Import
bull psql -U postgres -f dbdumpsql
221915 Commandes docker-compose
bull docker-compose up
bull docker-compose down
bull docker-compose exec db bash
22192 Mercredi 31 janvier 2018 Bilan mardi 30 janvier 2018
See also
bull Tutoriel Docker et Postgresql
bull Mardi 30 janvier 2018 eacutecriture des fichiers Dockerfile et docker-composeyml
bull Images PostgreSQL
221 Actionsnews 2018 113
Tutoriel Docker Release 2019-02-28T143129517726+0100
Contents
bull Mercredi 31 janvier 2018 Bilan mardi 30 janvier 2018
ndash Suppression de la base db_id3_intranet
psql -U postgres
l
drop database db_id3_intranet
ndash Bilan mardi 30 janvier 2018
ndash Pour lancer PostgreSQL
ndash Pour acceacuteder au conteneur
docker ps
docker exec -ti caa4db30ee94 bash
ndash Livre PostgreSQL Administration et exploitation de vos bases de donneacutees
221921 Suppression de la base db_id3_intranet
psql -U postgres
rootcaa4db30ee94 psql -U postgres
psql (101)Type help for help
l
postgres= l
List ofrarr˓databases
Name | Owner | Encoding | Collate | Ctype | Accessrarr˓privileges-----------------+----------+----------+------------+------------+--------------------rarr˓---db_id3_intranet | id3admin | UTF8 | en_USutf8 | en_USutf8 |postgres | postgres | UTF8 | en_USutf8 | en_USutf8 |template0 | postgres | UTF8 | en_USutf8 | en_USutf8 | =cpostgresrarr˓ +
| | | | |rarr˓postgres=CTcpostgrestemplate1 | postgres | UTF8 | en_USutf8 | en_USutf8 | =cpostgresrarr˓ +
| | | | |rarr˓postgres=CTcpostgres(4 rows)
114 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
drop database db_id3_intranet
postgres= drop database db_id3_intranet
DROP DATABASE
221922 Bilan mardi 30 janvier 2018
Pour pouvoir importer une base donneacutees PostgreSQL il faut utiliser cette suite de commandes dans le fichier docker-composeyml
version 3
servicesdb
image postgres101container_name container_intranetvolumes- volume_intranetvarlibpostgresqldata- code
volumesvolume_intranet
La commande code permet de voir ce qursquoil y a dans le reacutepertoire du coteacute host
rootcaa4db30ee94 ls -als code
total 338974 drwxr-xr-x 2 root root 4096 Jan 31 0824 4 drwxr-xr-x 1 root root 4096 Jan 30 1346 33776 -rwxr-xr-x 1 root root 34586512 Jan 25 1351 db_id3_intranet_2018_01_25sql1 -rwxr-xr-x 1 root root 214 Jan 30 1346 docker-composeyml24 -rwxr-xr-x 1 root root 23949 Jan 30 1404 postgresqlrst8 -rwxr-xr-x 1 root root 6238 Jan 31 0824 READMEtxt80 -rwxr-xr-x 1 root root 80802 Jan 22 1203 stack_overflow_postgrespng
On voit bien le fichier db_id3_intranet_2018_01_25sql
221923 Pour lancer PostgreSQL
docker-compose up
221924 Pour acceacuteder au conteneur
docker ps
docker ps
221 Actionsnews 2018 115
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 3 docker-compose up
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_rarr˓dockertutorielspostgresqlgt docker ps
CONTAINER ID IMAGE COMMAND CREATEDrarr˓STATUS PORTS NAMEScaa4db30ee94 postgres101 docker-entrypoints 19 hours agorarr˓ Up 34 minutes 5432tcp container_intranet
docker exec -ti caa4db30ee94 bash
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_rarr˓dockertutorielspostgresqlgt docker exec -ti caa4db30ee94 bash
rootcaa4db30ee94 ls -alstotal 804 drwxr-xr-x 1 root root 4096 Jan 30 1346 4 drwxr-xr-x 1 root root 4096 Jan 30 1346 4 drwxr-xr-x 1 root root 4096 Dec 12 0604 bin4 drwxr-xr-x 2 root root 4096 Nov 19 1525 boot4 drwxr-xr-x 2 root root 4096 Jan 31 0822 code0 drwxr-xr-x 5 root root 340 Jan 31 0746 dev4 drwxr-xr-x 2 root root 4096 Dec 12 0604 docker-entrypoint-initdbd0 lrwxrwxrwx 1 root root 34 Dec 12 0605 docker-entrypointsh -gt usrlocalbinrarr˓docker-entrypointsh0 -rwxr-xr-x 1 root root 0 Jan 30 1346 dockerenv4 drwxr-xr-x 1 root root 4096 Jan 30 1346 etc4 drwxr-xr-x 2 root root 4096 Nov 19 1525 home4 drwxr-xr-x 1 root root 4096 Dec 10 0000 lib4 drwxr-xr-x 2 root root 4096 Dec 10 0000 lib644 drwxr-xr-x 2 root root 4096 Dec 10 0000 media4 drwxr-xr-x 2 root root 4096 Dec 10 0000 mnt4 drwxr-xr-x 2 root root 4096 Dec 10 0000 opt0 dr-xr-xr-x 132 root root 0 Jan 31 0746 proc4 drwx------ 1 root root 4096 Jan 30 1432 root4 drwxr-xr-x 1 root root 4096 Dec 12 0605 run4 drwxr-xr-x 1 root root 4096 Dec 12 0604 sbin4 drwxr-xr-x 2 root root 4096 Dec 10 0000 srv0 dr-xr-xr-x 13 root root 0 Jan 31 0746 sys4 drwxrwxrwt 1 root root 4096 Jan 30 1346 tmp4 drwxr-xr-x 1 root root 4096 Dec 10 0000 usr4 drwxr-xr-x 1 root root 4096 Dec 10 0000 var
116 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
221925 Livre PostgreSQL Administration et exploitation de vos bases de donneacutees
De nombreuses informations tregraves inteacuteressantes
bull psql -f nom_fichiersql
bull explications sur les bases template0 et template1
22193 Mardi 30 janvier 2018 eacutecriture des fichiers Dockerfile et docker-composeyml
See also
bull Tutoriel Docker et Postgresql
bull Mercredi 31 janvier 2018 Bilan mardi 30 janvier 2018
Contents
bull Mardi 30 janvier 2018 eacutecriture des fichiers Dockerfile et docker-composeyml
ndash Objectifs pour la journeacutee
ndash Avancement deacutecouverte
ndash Historique
221931 Objectifs pour la journeacutee
Mises et point et premiegraveres exeacutecutions
Dans un premier temps on ne prend pas en charge les secrets
221932 Avancement deacutecouverte
bull je repasse sur le tutoriel postgresql pour essayer de comprendre les volumes
221933 Historique
bull ajout MISC95
CREATE DATABASE db_test WITH OWNER = id3admin ENCODING = UTF8 CONNECTION LIMIT = -1
CTmpgtpsql -U postgres lt create_databasesqlMot de passe pour lutilisateur postgres id338
CREATE DATABASE
22194 Lundi 29 janvier 2018 encore un nouveau tutoriel A Simple Recipe for Django Develop-ment In Docker (Bonus Testing with Selenium) de Jacob Cook
See also
221 Actionsnews 2018 117
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull httpsmediumcomadamzeitcodea-simple-recipe-for-django-development-in-docker-bonus-testing-with-selenium-6a038ec19ba5
221941 Analyse et plan de travail pour la journeacutee
Srsquoinspirer des 4 tutoriels pour creacuteer les fichiers Dockerfile et Docker-composeyml
bull httpsmediumcomadamzeitcodea-simple-recipe-for-django-development-in-docker-bonus-testing-with-selenium-6a038ec19ba5
bull httpspeakwinternetblogmodern-devops-django
bull httpswwwrevsyscomtidbitsbrief-intro-docker-djangonauts
bull httpswsvincentcomdjango-docker-postgresql
221942 Autre projet inteacuteressant
dockerize-all-the-things
See also
bull httpsgithubcomDrewDahlmandockerize-all-the-things
Kill it with fire
bull docker rm $(docker ps -a -q) - Kills all containers
bull docker rmi $(docker images -q) - will toast ALL of your images
Something to keep in mind is that sometimes docker containers and images can get bloated on your machine and youmight have to toast everything
The great thing about using docker like this is that you can quickly rebuild a project and get right back into working
Also when you close a console you are not stopping the container you always need to run docker-compose down whenstopping a project otherwise it will just keep running in the background
docker rm $(docker ps -a -q)
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockeractions_rarr˓news20182018_0101__2018_01_29gt docker rm $(docker ps -a -q)
367ce1d9818ac467c2469b347fb912b6a3e21746a16a91eb6ee9dc365c9d8ae3930ee2d697592a1a70ea8ffcde2f70f63d1169398f02e629ebfc3981ddbe7a8e25027c1afd485479ebe371507dc22b8fff5f4068cb62ace67ba4
(continues on next page)
118 Chapter 22 Actionsnews
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
685915373a4ce150d05313217d6e93a39de5807d38ada261eebf7e801b96
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_dockeractions_rarr˓news20182018_0101__2018_01_29gt docker rmi -f $(docker images -q)
Untagged saleor_celerylatestUntagged saleor_weblatestDeleted sha256fe40ed7484fe2f111dfdc7b8e79d3353534f29cc28c9019a0b0d6fcb2b624ac4Deleted sha256b49f310a4175a6f56d4ad302c60307c989774a7c853a6dd068cbf68fc234926cDeleted sha2565601669ae105acb6a632cd7d3dd473158b25ff6f1c7d65a95b04a2c12bad713dDeleted sha256bf662c677b1ec758f37dac85c90d55c0c005be7f283723f0f85deaf1e0418c1cDeleted sha25608889c646f293f56cf2a4bc2087a7fe3263f745536f9dd6c0d910264b2e10361Deleted sha25664b9f0663d35de8d404374e8574484d60195e55507b3a87897821bc383c1b69dDeleted sha256716475184da4626198a7da0d47d14072b4bb7c96384b1c6e67eb97daecd25b25Deleted sha2569deb54f781dd986aab78aeaebeef6ed8c587837595b02f7fb8b9008eb80006d6Deleted sha256bb6904496c708da82760b2ca6e3f737608180e377ba88129060318a7af311398Deleted sha256bc59713a5080512001bf80eecce306b85096858601f07ce23d8e0a9233ad69d9
222 Actionsnews 2017
2221 Actionsnews aoucirct 2017
22211 4 aoucirct 2017 ldquoDocker et Shorewallrdquo par Guillaume Cheramy
See also
bull httpswwwguillaume-cheramyfrdocker-et-shorewall
bull httpstwittercomcheramy_linux
222111 Creacuteer les regravegles shorewall pour Docker
Il faut creacuteer dans shorewall les regravegles pour que les conteneurs puissent avoir accegraves agrave Internet
222 Actionsnews 2017 119
Tutoriel Docker Release 2019-02-28T143129517726+0100
120 Chapter 22 Actionsnews
CHAPTER
TWENTYTHREE
IMAGES DOCKER (STORE DOCKER EX HUB DOCKER)
See also
bull httpsstoredockercom
bull httpsdocsdockercomengineuserguideeng-image
bull httpsgithubcomdocker-library
bull httpsgithubcomdocker-libraryofficial-images
bull httpshubdockercomexplore
Contents
bull Images Docker (Store Docker ex Hub docker)
ndash Nouveau le docker store httpsstoredockercom
ndash Ancien le hub docker httpshubdockercomexplore
ndash Gitlab registry
ndash Images OS
ndash Images langages
ndash Images webserver serveurs HTTP (serveurs Web)
Images webserver serveurs Web + reverse proxy + load balancer
middot Apache HTTP Server + mod_proxy
middot Nginx
ndash Images authentication authentification
ndash Images db bases de donneacutees
ndash Images message queue
ndash Images outils collaboratifs
ndash Images ldquodocumentationrdquo
ndash Images outils scientifiques
ndash Images apprentissage
121
Tutoriel Docker Release 2019-02-28T143129517726+0100
231 Nouveau le docker store httpsstoredockercom
Fig 1 httpsstoredockercom
232 Ancien le hub docker httpshubdockercomexplore
233 Gitlab registry
2331 GitLab Container Registry
See also
bull httpsdocsgitlabcomceuserprojectcontainer_registryhtml
Contents
bull GitLab Container Registry
ndash Introduction
ndash Private registry
23311 Introduction
With the Docker Container Registry integrated into GitLab every project can have its own space to store its Dockerimages
23312 Private registry
233121 Private GitLab Container Registry
See also
bull httpsdocsgitlabcomceuserprojectcontainer_registryhtml
122 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 2 httpshubdockercomexplore
233 Gitlab registry 123
Tutoriel Docker Release 2019-02-28T143129517726+0100
Contents
bull Private GitLab Container Registry
ndash Utilisation sous GNULinux
etcdockerdaemonjson
docker login
restart docker
ndash docker tag
ndash docker push
Utilisation sous GNULinux
etcdockerdaemonjson
pvergainUC004~$ cat etcdockerdaemonjson
insecure-registries [dockerhubsrvintid3eu5555]
docker login
docker login -u gitlab-ci-token -p XXXXXXXXX dockerhubsrvintid3eu5555
restart docker
sudo systemctl restart dockerservice
docker tag
docker tag be4f0 transactions_colombie4_2_0_dev
docker push
docker push
124 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
234 Images OS
2341 Images Alpine
See also
bull httpsstoredockercomimagesalpine
bull httpshubdockercom_alpine
bull httpswwwalpinelinuxorg
bull httpsfrwikipediaorgwikiAlpine_Linux
bull httpsgithubcomgliderlabsdocker-alpine
bull httpgliderlabsviewdocsiodocker-alpine
Contents
bull Images Alpine
ndash Short Description
ndash Description
ndash Dockerfile
39
Fig 3 Le logo Alpine-linux
23411 Short Description
A minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size
23412 Description
See also
bull httpsfrwikipediaorgwikiAlpine_Linux
Alpine Linux est une distribution Linux ultra-leacutegegravere orienteacutee seacutecuriteacute et baseacutee sur Musl et BusyBox principalementconccedilue pour ldquoUtilisateur intensif qui appreacutecie la seacutecuriteacute la simpliciteacute et lrsquoefficaciteacute des ressourcesrdquo
Elle utilise les patches PaX et Grsecurity du noyau par deacutefaut et compile tous les binaires de lrsquoespace utilisateur etexeacutecutables indeacutependants de la position (dits ldquoportablesrdquo) avec protection de destruction de la pile
Cette distribution se precircte particuliegraverement en raison de sa leacutegegravereteacute agrave la creacuteation drsquoimages de containers Docker
La distribution Alpine Linux est particuliegraverement populaire pour cet usage
234 Images OS 125
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 4 httpsstoredockercomimagesalpine
23413 Dockerfile
234131 39
See also
bull httpsgithubcomgliderlabsdocker-alpineblobc4f4c7a6e14d6efeb9a160da464717e03d2cc3eeversionslibrary-39x86_64Dockerfile
FROM scratchADD rootfstarxz CMD [binsh]
2342 Images Debian
See also
bull httpsstoredockercomimagesdebian
bull httpshubdockercom_debian
bull httpsfrwikipediaorgwikiDebian
Contents
bull Images Debian
126 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
ndash Short Description
ndash Description
ndash Versions
buster
Fig 5 Logo Debian
23421 Short Description
Debian is a Linux distribution thatrsquos composed entirely of free and open-source software
23422 Description
See also
bull httpsfrwikipediaorgwikiDebian
Debian (debjan) est une organisation communautaire et deacutemocratique dont le but est le deacuteveloppement de systegravemesdrsquoexploitation baseacutes exclusivement sur des logiciels libres
Chaque systegraveme lui-mecircme nommeacute Debian reacuteunit autour drsquoun noyau de systegraveme drsquoexploitation de nombreux eacuteleacutementspouvant ecirctre deacuteveloppeacutes indeacutependamment les uns des autres pour plusieurs architectures mateacuterielles Ces eacuteleacutementsprogrammes de base compleacutetant le noyau et logiciels applicatifs se preacutesentent sous forme de laquo paquets raquo qui peuventecirctre installeacutes en fonction des besoins (voir Distribution des logiciels) Lrsquoensemble systegraveme drsquoexploitation plus logicielssrsquoappelle une distribution
On assimile geacuteneacuteralement ces systegravemes drsquoexploitation au systegraveme Debian GNULinux la distribution GNULinux deDebian car jusqursquoen 2009 crsquoeacutetait la seule branche parfaitement fonctionnelle Mais drsquoautres distributions Debian sonten cours de deacuteveloppement en 2013 Debian GNUHurd3 et Debian GNUkFreeBSD5 La version Debian Squeezeest la premiegravere agrave ecirctre distribueacutee avec le noyau kFreeBSD en plus du noyau Linux6
Debian est utiliseacutee comme base de nombreuses autres distributions telles que Knoppix et Ubuntu qui rencontrent ungrand succegraves
23423 Versions
234231 buster
See also
234 Images OS 127
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 6 httpshubdockercom_debian
128 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull httpsgithubcomdebuerreotypedocker-debian-artifactsbloba5e61a4c40a4b366d614715c51f883e0b153afb5busterDockerfile
FROM scratchADD rootfstarxz CMD [bash]
2343 Images Ubuntu
See also
bull httpsstoredockercomimagesubuntu
bull httpshubdockercom_ubuntu
bull httpsfrwikipediaorgwikiUbuntu_(systC3A8me_d27exploitation)
Contents
bull Images Ubuntu
ndash Short Description
ndash Description
ndash La Philosophie drsquoUbuntu
ndash Ubuntu Versions
Disco 1904
Cosmic 1810
Bionic 1804
Fig 7 Le logo Ubuntu
234 Images OS 129
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 8 httpshubdockercom_ubuntu
23431 Short Description
Ubuntu is a Debian-based Linux operating system based on free software
23432 Description
See also
bull httpsfrwikipediaorgwikiUbuntu_(systC3A8me_d27exploitation)
Ubuntu (prononciation ubuntu) est un systegraveme drsquoexploitation GNULinux baseacute sur la distribution Linux DebianIl est deacuteveloppeacute commercialiseacute et maintenu pour les ordinateurs individuels par la socieacuteteacute Canonical
Ubuntu se deacutefinit comme laquo un systegraveme drsquoexploitation utiliseacute par des millions de PC agrave travers le monde raquo10 et avec uneinterface laquo simple intuitive et seacutecuriseacutee raquo
Elle est la distribution la plus consulteacutee sur Internet drsquoapregraves le site Alexa Et est le systegraveme drsquoexploitation le plus utiliseacutesur les systegravemes Cloud ainsi que sur les serveurs informatiques
Ubuntu se divise en deux branches
bull La branche principale stable dit LTS Avec mise agrave niveau tous les six mois et mise agrave jour majeure tous les 2 ansLa derniegravere version 16043 nom de code Xenial Xerus est sortie le 3 aoucirct 2017
bull La branche secondaire instable avec mise agrave jour majeure tous les six mois
130 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
23433 La Philosophie drsquoUbuntu
Le mot ubuntu provient drsquoun ancien mot bantou (famille de langues africaines) qui deacutesigne une personne qui prendconscience que son moi est intimement lieacute agrave ce que sont les autres Autrement dit Je suis ce que je suis gracircce agrave ceque nous sommes tous
Crsquoest un concept fondamental de la laquo philosophie de la reacuteconciliation raquo deacuteveloppeacutee par Desmond Mpilo Tutu aveclrsquoabolition de lrsquoapartheid
Ubuntu signifie par ailleurs en kinyarwanda (langue rwandaise) et en kirundi (langue burundaise) humaniteacute geacuteneacuterositeacuteou gratuiteacute
On dit drsquoune chose qursquoelle est krsquoubuntu si elle est obtenue gratuitement
En informatique on considegravere qursquoune distribution existe aux travers des apports des diffeacuterentes communauteacutes LinuxEt tel qursquoil se trouve expliqueacute dans le travail de la Commission de la veacuteriteacute et de la reacuteconciliation Elles permettentde mieux saisir par exemple la mission de la Fondation Shuttleworth relayeacutee en France par les travaux de philosophescomme Barbara Cassin et Philippe-Joseph Salazar
23434 Ubuntu Versions
234341 Disco 1904
See also
bull httpsgithubcomtianondocker-brew-ubuntu-coreblob1cc295b1507b68a66942b2ff5c2dbf395850208adiscoDockerfile
FROM scratchADD ubuntu-disco-core-cloudimg-amd64-roottargz
a few minor docker-specific tweaks see httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapRUN set -xe
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL40-L48
ampamp echo binsh gt usrsbinpolicy-rcd ampamp echo exit 101 gtgt usrsbinpolicy-rcd ampamp chmod +x usrsbinpolicy-rcd
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL54-L56
ampamp dpkg-divert --local --rename --add sbininitctl ampamp cp -a usrsbinpolicy-rcd sbininitctl ampamp sed -i s^exitexit 0 sbininitctl
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL71-L78
ampamp echo force-unsafe-io gt etcdpkgdpkgcfgddocker-apt-speedup
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL85-L105
ampamp echo DPkgPost-Invoke rm -f varcacheaptarchivesdeb varcacheaptrarr˓archivespartialdeb varcacheaptbin || true gt etcaptaptconfdrarr˓docker-clean
(continues on next page)
234 Images OS 131
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
ampamp echo APTUpdatePost-Invoke rm -f varcacheaptarchivesdeb varrarr˓cacheaptarchivespartialdeb varcacheaptbin || true gtgt etcaptaptrarr˓confddocker-clean
ampamp echo DirCachepkgcache DirCachesrcpkgcache gtgt etcaptaptrarr˓confddocker-clean
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL109-L115
ampamp echo AcquireLanguages none gt etcaptaptconfddocker-no-languages
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL118-L130
ampamp echo AcquireGzipIndexes true AcquireCompressionTypesOrder gz gtrarr˓etcaptaptconfddocker-gzip-indexes
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL134-L151
ampamp echo AptAutoRemoveSuggestsImportant false gt etcaptaptconfdrarr˓docker-autoremove-suggests
delete all the apt list files since theyre big and get stale quicklyRUN rm -rf varlibaptlists this forces apt-get update in dependent images which is also good (see also httpsbugslaunchpadnetcloud-images+bug1699913)
make systemd-detect-virt return docker See httpsgithubcomsystemdsystemdblobrarr˓aa0c34279ee40bce2f9681b496922dedbadfca19srcbasicvirtcL434RUN mkdir -p runsystemd ampamp echo docker gt runsystemdcontainer
overwrite this with CMD [] in a dependent DockerfileCMD [binbash]
234342 Cosmic 1810
See also
bull httpsgithubcomtianondocker-brew-ubuntu-coreblob1cc295b1507b68a66942b2ff5c2dbf395850208acosmicDockerfile
FROM scratchADD ubuntu-cosmic-core-cloudimg-amd64-roottargz
a few minor docker-specific tweaks see httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapRUN set -xe
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL40-L48
ampamp echo binsh gt usrsbinpolicy-rcd ampamp echo exit 101 gtgt usrsbinpolicy-rcd ampamp chmod +x usrsbinpolicy-rcd
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL54-L56 (continues on next page)
132 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
ampamp dpkg-divert --local --rename --add sbininitctl ampamp cp -a usrsbinpolicy-rcd sbininitctl ampamp sed -i s^exitexit 0 sbininitctl
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL71-L78
ampamp echo force-unsafe-io gt etcdpkgdpkgcfgddocker-apt-speedup
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL85-L105
ampamp echo DPkgPost-Invoke rm -f varcacheaptarchivesdeb varcacheaptrarr˓archivespartialdeb varcacheaptbin || true gt etcaptaptconfdrarr˓docker-clean
ampamp echo APTUpdatePost-Invoke rm -f varcacheaptarchivesdeb varrarr˓cacheaptarchivespartialdeb varcacheaptbin || true gtgt etcaptaptrarr˓confddocker-clean
ampamp echo DirCachepkgcache DirCachesrcpkgcache gtgt etcaptaptrarr˓confddocker-clean
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL109-L115
ampamp echo AcquireLanguages none gt etcaptaptconfddocker-no-languages
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL118-L130
ampamp echo AcquireGzipIndexes true AcquireCompressionTypesOrder gz gtrarr˓etcaptaptconfddocker-gzip-indexes
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL134-L151
ampamp echo AptAutoRemoveSuggestsImportant false gt etcaptaptconfdrarr˓docker-autoremove-suggests
delete all the apt list files since theyre big and get stale quicklyRUN rm -rf varlibaptlists this forces apt-get update in dependent images which is also good (see also httpsbugslaunchpadnetcloud-images+bug1699913)
make systemd-detect-virt return docker See httpsgithubcomsystemdsystemdblobrarr˓aa0c34279ee40bce2f9681b496922dedbadfca19srcbasicvirtcL434RUN mkdir -p runsystemd ampamp echo docker gt runsystemdcontainer
overwrite this with CMD [] in a dependent DockerfileCMD [binbash]
234343 Bionic 1804
See also
bull httpsgithubcomtianondocker-brew-ubuntu-coreblob1cc295b1507b68a66942b2ff5c2dbf395850208abionicDockerfile
FROM scratchADD ubuntu-bionic-core-cloudimg-amd64-roottargz
(continues on next page)
234 Images OS 133
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
a few minor docker-specific tweaks see httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapRUN set -xe
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL40-L48
ampamp echo binsh gt usrsbinpolicy-rcd ampamp echo exit 101 gtgt usrsbinpolicy-rcd ampamp chmod +x usrsbinpolicy-rcd
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL54-L56
ampamp dpkg-divert --local --rename --add sbininitctl ampamp cp -a usrsbinpolicy-rcd sbininitctl ampamp sed -i s^exitexit 0 sbininitctl
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL71-L78
ampamp echo force-unsafe-io gt etcdpkgdpkgcfgddocker-apt-speedup
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL85-L105
ampamp echo DPkgPost-Invoke rm -f varcacheaptarchivesdeb varcacheaptrarr˓archivespartialdeb varcacheaptbin || true gt etcaptaptconfdrarr˓docker-clean
ampamp echo APTUpdatePost-Invoke rm -f varcacheaptarchivesdeb varrarr˓cacheaptarchivespartialdeb varcacheaptbin || true gtgt etcaptaptrarr˓confddocker-clean
ampamp echo DirCachepkgcache DirCachesrcpkgcache gtgt etcaptaptrarr˓confddocker-clean
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL109-L115
ampamp echo AcquireLanguages none gt etcaptaptconfddocker-no-languages
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL118-L130
ampamp echo AcquireGzipIndexes true AcquireCompressionTypesOrder gz gtrarr˓etcaptaptconfddocker-gzip-indexes
httpsgithubcomdockerdockerblob9a9fc01af8fb5d98b8eec0740716226fadb3735crarr˓contribmkimagedebootstrapL134-L151
ampamp echo AptAutoRemoveSuggestsImportant false gt etcaptaptconfdrarr˓docker-autoremove-suggests
delete all the apt list files since theyre big and get stale quicklyRUN rm -rf varlibaptlists this forces apt-get update in dependent images which is also good (see also httpsbugslaunchpadnetcloud-images+bug1699913)
make systemd-detect-virt return docker See httpsgithubcomsystemdsystemdblobrarr˓aa0c34279ee40bce2f9681b496922dedbadfca19srcbasicvirtcL434RUN mkdir -p runsystemd ampamp echo docker gt runsystemdcontainer
(continues on next page)
134 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
overwrite this with CMD [] in a dependent DockerfileCMD [binbash]
2344 Images CentOS
See also
bull httpsstoredockercomimagescentos
bull httpshubdockercom_centos
bull httpsfrwikipediaorgwikiCentOS
bull httpswwwcentosorg
Contents
bull Images CentOS
ndash Short Description
ndash Description
ndash Structures
ndash Versions
centos 7
Fig 9 Logo CentOS
23441 Short Description
The official build of CentOS
23442 Description
See also
234 Images OS 135
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 10 httpshubdockercom_centos
bull httpsfrwikipediaorgwikiCentOS
CentOS (Community enterprise Operating System) est une distribution GNULinux principalement destineacutee auxserveurs Tous ses paquets agrave lrsquoexception du logo sont des paquets compileacutes agrave partir des sources de la distributionRHEL (Red Hat Enterprise Linux) eacutediteacutee par la socieacuteteacute Red Hat Elle est donc quasiment identique agrave celle-ci et seveut 100 compatible drsquoun point de vue binaire
Utiliseacutee par 20 des serveurs web Linux elle est lrsquoune des distributions Linux les plus populaires pour les serveursweb Depuis novembre 2013 elle est la troisiegraveme distribution la plus utiliseacutee sur les serveurs web en avril 2017 elleeacutetait installeacutee sur 206 drsquoentre eux les principales autres distributions eacutetaient Debian (318 ) Ubuntu (358 ) etRed Hat (33 )
23443 Structures
La RHEL en version binaire directement installable et exploitable ne peut ecirctre obtenue que par achat drsquoune souscrip-tion aupregraves de Red Hat ou de ses revendeurs La plupart des programmes inclus et livreacutes avec la Red Hat sont publieacutessous la licence GPL qui impose au redistributeur (sous certaines conditions) de fournir les sources CentOS utilisedonc les sources de la RHEL (accessibles librement sur Internet) pour regeacuteneacuterer la Red Hat agrave lrsquoidentique
On peut donc consideacuterer la CentOS comme une version gratuite de la Red Hat Le support technique est de typecommunautaire il se fait gratuitement et ouvertement via les listes de diffusion et les forums de la communauteacuteCentOS
Depuis le 7 janvier 2014 Red Hat et CentOS se sont fortement rapprocheacutees puisque la plupart des principaux membresmaintenant la CentOS ont eacuteteacute embaucheacutes par Red Hat
136 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
23444 Versions
234441 centos 7
See also
bull httpsgithubcomCentOSsig-cloud-instance-imagesbloba77b36c6c55559b0db5bf9e74e61d32ea709a179dockerDockerfile
bull httpsrawgithubusercontentcomCentOSsig-cloud-instance-imagesa77b36c6c55559b0db5bf9e74e61d32ea709a179dockerDockerfile
FROM scratchADD centos-7-dockertarxz
LABEL orglabel-schemaschema-version=10 orglabel-schemaname=CentOS Base Image orglabel-schemavendor=CentOS orglabel-schemalicense=GPLv2 orglabel-schemabuild-date=20181205
CMD [binbash]
235 Images langages
2351 Images Python
See also
bull httpsstoredockercomimagespython
bull httpshubdockercom_python
bull Python tutorial
Contents
bull Images Python
ndash Short Description
ndash What is Python
ndash How to use this image
ndash Versions
erinxoconpybuntu Python 38 (not for mod_wsgi)
380-dev erinxoconpybuntu-docker (not for mod_wsgi)
erinxoconpybuntu Python 37 (237MB)
372 Debian strech
372 strech-slim
372 alpine 39
235 Images langages 137
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 11 Le logo Python
Fig 12 httpsstoredockercomimagespython
138 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
23511 Short Description
Python is an interpreted interactive object-oriented open-source programming language
23512 What is Python
Python is an interpreted interactive object-oriented open-source programming language
It incorporates modules exceptions dynamic typing very high level dynamic data types and classes Python com-bines remarkable power with very clear syntax
It has interfaces to many system calls and libraries as well as to various window systems and is extensible in C orC++
It is also usable as an extension language for applications that need a programmable interface
Finally Python is portable it runs on many Unix variants on the Mac and on Windows 2000 and later
23513 How to use this image
Create a Dockerfile in your Python app project
FROM python3
WORKDIR usrsrcapp
COPY requirementstxt RUN pip install --no-cache-dir -r requirementstxt
COPY
CMD [ python your-daemon-or-scriptpy ]
You can then build and run the Docker image
docker build -t my-python-app
docker run -it --rm --name my-running-app my-python-app
Run a single Python script
For many simple single file projects you may find it inconvenient to write a complete Dockerfile In such cases youcan run a Python script by using the Python Docker image directly
docker run -it --rm --name my-running-script -v $PWDusrsrcmyapp -w usrsrcrarr˓myapp python3 python your-daemon-or-scriptpy
23514 Versions
235141 erinxoconpybuntu Python 38 (not for mod_wsgi)
See also
bull httpsgithubcomerinxoconpybuntu-dockerblobmaster380Dockerfile
235 Images langages 139
Tutoriel Docker Release 2019-02-28T143129517726+0100
Warning not suitable for mod_wsgi because Python is not compiled with the ndashenable-shared option
httpsmodwsgireadthedocsioenlatestuser-guidesinstallation-issueshtml
FROM ubuntu1804
ENV LC_ALL CUTF-8ENV LANG CUTF-8ENV PATH usrlocalbin$PATHENV PYTHON_VERSION 380ENV ALPHA_VERSION a1ENV PYTHON_PIP_VERSION 1902ENV BUILD_DEPS build-essential
libncursesw5-dev libreadline-gplv2-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev libbz2-dev ca-certificates zlib1g-dev wget libffi-dev
ENV REMOVE_DEPS build-essential wget
RUN apt update ampamp apt install --no-install-recommends --no-install-suggests -y $rarr˓BUILD_DEPS
ampamp wget -O- httpswwwpythonorgftppython$PYTHON_VERSIONPython-$PYTHON_rarr˓VERSION$ALPHA_VERSIONtgz | tar xz
ampamp cd Python-$PYTHON_VERSION$ALPHA_VERSION ampamp configure
--without-ensurepip --enable-loadable-sqlite-extensions
ampamp make -j $(nproc) ampamp make install ampamp find usrlocal -depth (
( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + ampamp rm -rf Python-$PYTHON_VERSION$ALPHA_VERSION ampamp python3 --version ampamp cd usrlocalbin ampamp ln -s pydoc3 pydoc ampamp ln -s python3 python ampamp cd set -ex
wget -O get-pippy httpsbootstrappypaioget-pippy
(continues on next page)
140 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
python get-pippy --disable-pip-version-check --cache-dir=pipcache pip==$PYTHON_PIP_VERSION
pip --version find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + rm -f get-pippy ampamp rm -rf pipcache ampamp apt remove --autoremove --purge -y $REMOVE_DEPS ampamp rm -rf varlibaptlists
CMD [python]
docker pull jetblackpopepybuntu38
38 Pulling from jetblackpopepybuntu6cf436f81810 Already exists987088a85b96 Already existsb4624b3efe06 Already existsd42beb8ded59 Already exists522f421070c0 Pull completeDigest sha256f23a99cac7807646b90fe071ea77f09a095aa13431e71046192fe71db94aa292Status Downloaded newer image for jetblackpopepybuntu38
pvergainUC004 gt docker images
REPOSITORY TAG IMAGE ID CREATEDrarr˓ SIZEdockerid3euinformatiquelog latest 3d945b383b70 2 hoursrarr˓ago 855MBjetblackpopepybuntu 38 56a601adcbd4 15rarr˓hours ago 253MB
235142 380-dev erinxoconpybuntu-docker (not for mod_wsgi)
Warning not suitable for mod_wsgi because Python is not compiled with the ndashenable-shared option
httpsmodwsgireadthedocsioenlatestuser-guidesinstallation-issueshtml
FROM ubuntu1804
ENV LC_ALL CUTF-8ENV LANG CUTF-8ENV PATH usrlocalbin$PATH
(continues on next page)
235 Images langages 141
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
ENV PYTHON_VERSION 380ENV ALPHA_VERSION a1ENV PYTHON_PIP_VERSION 1902ENV BUILD_DEPS build-essential
libncursesw5-dev libreadline-gplv2-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev libbz2-dev ca-certificates zlib1g-dev wget curl libffi-dev
ENV REMOVE_DEPS build-essential wget
RUN apt update ampamp apt install --no-install-recommends --no-install-suggests -y $rarr˓BUILD_DEPS
ampamp wget -O- httpswwwpythonorgftppython$PYTHON_VERSIONPython-$PYTHON_rarr˓VERSION$ALPHA_VERSIONtgz | tar xz
ampamp cd Python-$PYTHON_VERSION$ALPHA_VERSION ampamp configure
--without-ensurepip --enable-loadable-sqlite-extensions
ampamp make -j $(nproc) ampamp make install ampamp find usrlocal -depth (
( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + ampamp rm -rf Python-$PYTHON_VERSION$ALPHA_VERSION ampamp python3 --version ampamp cd usrlocalbin ampamp ln -s pydoc3 pydoc ampamp ln -s python3 python ampamp cd set -ex
wget -O get-pippy httpsbootstrappypaioget-pippy python get-pippy
--disable-pip-version-check --cache-dir=pipcache pip==$PYTHON_PIP_VERSION
pip --version find usrlocal -depth
( (continues on next page)
142 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + rm -f get-pippy ampamp rm -rf pipcache
CMD [python]
235143 erinxoconpybuntu Python 37 (237MB)
See also
bull httpsgithubcomerinxoconpybuntu-dockerblobmaster372Dockerfile
Warning not suitable for mod_wsgi because Python is not compiled with the ndashenable-shared option
httpsmodwsgireadthedocsioenlatestuser-guidesinstallation-issueshtml
FROM ubuntu1804
ENV LC_ALL CUTF-8ENV LANG CUTF-8ENV PATH usrlocalbin$PATHENV PYTHON_VERSION 372ENV PYTHON_PIP_VERSION 1902ENV BUILD_DEPS build-essential
libncursesw5-dev libreadline-gplv2-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev libbz2-dev ca-certificates zlib1g-dev wget libffi-dev
ENV REMOVE_DEPS build-essential wget
RUN apt update ampamp apt install --no-install-recommends --no-install-suggests -y $rarr˓BUILD_DEPS
ampamp wget -O- httpswwwpythonorgftppython$PYTHON_VERSIONPython-$PYTHON_rarr˓VERSIONtgz | tar xz
ampamp cd Python-$PYTHON_VERSION ampamp configure
--without-ensurepip --enable-loadable-sqlite-extensions
ampamp make -j $(nproc) ampamp make install ampamp find usrlocal -depth (
(continues on next page)
235 Images langages 143
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + ampamp rm -rf Python-$PYTHON_VERSION ampamp python3 --version ampamp cd usrlocalbin ampamp ln -s pydoc3 pydoc ampamp ln -s python3 python ampamp cd set -ex
wget -O get-pippy httpsbootstrappypaioget-pippy python get-pippy
--disable-pip-version-check --cache-dir=pipcache pip==$PYTHON_PIP_VERSION
pip --version find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + rm -f get-pippy ampamp rm -rf pipcache ampamp apt remove --autoremove --purge -y $REMOVE_DEPS ampamp rm -rf varlibaptlists
CMD [python]
pvergainUC004 gt docker pull jetblackpopepybuntu37
37 Pulling from jetblackpopepybuntu6cf436f81810 Pull complete987088a85b96 Pull completeb4624b3efe06 Pull completed42beb8ded59 Pull completebca0adb5e7c3 Pull completeDigest sha2562de022423a0f3ce94c961177fc5b96c4638b3905cdcc1bd16dc3072baabcb5feStatus Downloaded newer image for jetblackpopepybuntu37
pvergainUC004 gt docker images
REPOSITORY TAG IMAGE ID CREATEDrarr˓ SIZEjetblackpopepybuntu 37 a6c0ab4183ec 13rarr˓hours ago 237MB
144 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
235144 372 Debian strech
See also
bull httpsgithubcomdocker-librarypythonblob344fd4f05b1e81dd97f8334e30035c0359dfde7f37stretchDockerfile
NOTE THIS DOCKERFILE IS GENERATED VIA updatesh PLEASE DO NOT EDIT IT DIRECTLY
FROM buildpack-depsstretch
ensure local python is preferred over distribution pythonENV PATH usrlocalbin$PATH
httpbugspythonorgissue19846 gt At the moment setting LANG=C on a Linux system fundamentally breaks Python 3rarr˓ and thats not OKENV LANG CUTF-8
extra dependencies (over what buildpack-deps already includes)RUN apt-get update ampamp apt-get install -y --no-install-recommends
tk-dev uuid-dev
ampamp rm -rf varlibaptlists
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421DENV PYTHON_VERSION 372
RUN set -ex ampamp wget -O pythontarxz httpswwwpythonorgftppython$PYTHON_VERSION[a-
rarr˓z]Python-$PYTHON_VERSIONtarxz ampamp wget -O pythontarxzasc httpswwwpythonorgftppython$PYTHON_VERSION
rarr˓[a-z]Python-$PYTHON_VERSIONtarxzasc ampamp export GNUPGHOME=$(mktemp -d) ampamp gpg --batch --keyserver hapoolsks-keyserversnet --recv-keys $GPG_KEY ampamp gpg --batch --verify pythontarxzasc pythontarxz ampamp command -v gpgconf gt devnull ampamp gpgconf --kill all || ampamp rm -rf $GNUPGHOME pythontarxzasc ampamp mkdir -p usrsrcpython ampamp tar -xJC usrsrcpython --strip-components=1 -f pythontarxz ampamp rm pythontarxz ampamp cd usrsrcpython ampamp gnuArch=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) ampamp configure
--build=$gnuArch --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip
ampamp make -j $(nproc) ampamp make install
(continues on next page)
235 Images langages 145
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
ampamp ldconfig ampamp find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + ampamp rm -rf usrsrcpython ampamp python3 --version
make some useful symlinks that are expected to existRUN cd usrlocalbin
ampamp ln -s idle3 idle ampamp ln -s pydoc3 pydoc ampamp ln -s python3 python ampamp ln -s python3-config python-config
if this is called PIP_VERSION pip explodes with ValueError invalid truth valuerarr˓ltVERSIONgtENV PYTHON_PIP_VERSION 1901
RUN set -ex wget -O get-pippy httpsbootstrappypaioget-pippy python get-pippy
--disable-pip-version-check --no-cache-dir pip==$PYTHON_PIP_VERSION
pip --version find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + rm -f get-pippy
CMD [python3]
235145 372 strech-slim
See also
httpsgithubcomdocker-librarypythonblob344fd4f05b1e81dd97f8334e30035c0359dfde7f37stretchslimDockerfile
NOTE THIS DOCKERFILE IS GENERATED VIA updatesh PLEASE DO NOT EDIT IT DIRECTLY
(continues on next page)
146 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
FROM debianstretch-slim
ensure local python is preferred over distribution pythonENV PATH usrlocalbin$PATH
httpbugspythonorgissue19846 gt At the moment setting LANG=C on a Linux system fundamentally breaks Python 3rarr˓ and thats not OKENV LANG CUTF-8
runtime dependenciesRUN apt-get update ampamp apt-get install -y --no-install-recommends
ca-certificates netbase
ampamp rm -rf varlibaptlists
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421DENV PYTHON_VERSION 372
RUN set -ex ampamp savedAptMark=$(apt-mark showmanual) ampamp apt-get update ampamp apt-get install -y --no-install-recommends
dpkg-dev gcc libbz2-dev libc6-dev libexpat1-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev make tk-dev uuid-dev wget xz-utils zlib1g-dev
as of Stretch gpg is no longer included by default$(command -v gpg gt devnull || echo gnupg dirmngr)
ampamp wget -O pythontarxz httpswwwpythonorgftppython$PYTHON_VERSION[a-
rarr˓z]Python-$PYTHON_VERSIONtarxz ampamp wget -O pythontarxzasc httpswwwpythonorgftppython$PYTHON_VERSION
rarr˓[a-z]Python-$PYTHON_VERSIONtarxzasc ampamp export GNUPGHOME=$(mktemp -d) ampamp gpg --batch --keyserver hapoolsks-keyserversnet --recv-keys $GPG_KEY ampamp gpg --batch --verify pythontarxzasc pythontarxz ampamp command -v gpgconf gt devnull ampamp gpgconf --kill all || ampamp rm -rf $GNUPGHOME pythontarxzasc ampamp mkdir -p usrsrcpython ampamp tar -xJC usrsrcpython --strip-components=1 -f pythontarxz
(continues on next page)
235 Images langages 147
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
ampamp rm pythontarxz ampamp cd usrsrcpython ampamp gnuArch=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) ampamp configure
--build=$gnuArch --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip
ampamp make -j $(nproc) ampamp make install ampamp ldconfig ampamp apt-mark auto gt devnull ampamp apt-mark manual $savedAptMark ampamp find usrlocal -type f -executable -not ( -name tkinter ) -exec ldd
rarr˓ | awk =gt print $(NF-1) | sort -u | xargs -r dpkg-query --search | cut -d -f1 | sort -u | xargs -r apt-mark manual
ampamp apt-get purge -y --auto-remove -o APTAutoRemoveRecommendsImportant=false ampamp rm -rf varlibaptlists ampamp find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + ampamp rm -rf usrsrcpython ampamp python3 --version
make some useful symlinks that are expected to existRUN cd usrlocalbin
ampamp ln -s idle3 idle ampamp ln -s pydoc3 pydoc ampamp ln -s python3 python ampamp ln -s python3-config python-config
if this is called PIP_VERSION pip explodes with ValueError invalid truth valuerarr˓ltVERSIONgtENV PYTHON_PIP_VERSION 1901
RUN set -ex savedAptMark=$(apt-mark showmanual) apt-get update apt-get install -y --no-install-recommends wget wget -O get-pippy httpsbootstrappypaioget-pippy
(continues on next page)
148 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
apt-mark auto gt devnull [ -z $savedAptMark ] || apt-mark manual $savedAptMark apt-get purge -y --auto-remove -o APTAutoRemoveRecommendsImportant=false rm -rf varlibaptlists python get-pippy
--disable-pip-version-check --no-cache-dir pip==$PYTHON_PIP_VERSION
pip --version find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + rm -f get-pippy
CMD [python3]
235146 372 alpine 39
See also
bull httpsrawgithubusercontentcomdocker-librarypython662514b58264cff440912d93648ecf202a43f31c37alpine39Dockerfile
NOTE THIS DOCKERFILE IS GENERATED VIA updatesh PLEASE DO NOT EDIT IT DIRECTLY
FROM alpine39
ensure local python is preferred over distribution pythonENV PATH usrlocalbin$PATH
httpbugspythonorgissue19846 gt At the moment setting LANG=C on a Linux system fundamentally breaks Python 3rarr˓ and thats not OKENV LANG CUTF-8
install ca-certificates so that HTTPS works consistently other runtime dependencies for Python are installed laterRUN apk add --no-cache ca-certificates
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421DENV PYTHON_VERSION 372
RUN set -ex ampamp apk add --no-cache --virtual fetch-deps
gnupg
(continues on next page)
235 Images langages 149
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
tar xz
ampamp wget -O pythontarxz httpswwwpythonorgftppython$PYTHON_VERSION[a-
rarr˓z]Python-$PYTHON_VERSIONtarxz ampamp wget -O pythontarxzasc httpswwwpythonorgftppython$PYTHON_VERSION
rarr˓[a-z]Python-$PYTHON_VERSIONtarxzasc ampamp export GNUPGHOME=$(mktemp -d) ampamp gpg --batch --keyserver hapoolsks-keyserversnet --recv-keys $GPG_KEY ampamp gpg --batch --verify pythontarxzasc pythontarxz ampamp command -v gpgconf gt devnull ampamp gpgconf --kill all || ampamp rm -rf $GNUPGHOME pythontarxzasc ampamp mkdir -p usrsrcpython ampamp tar -xJC usrsrcpython --strip-components=1 -f pythontarxz ampamp rm pythontarxz ampamp apk add --no-cache --virtual build-deps
bzip2-dev coreutils dpkg-dev dpkg expat-dev findutils gcc gdbm-dev libc-dev libffi-dev libnsl-dev libtirpc-dev linux-headers make ncurses-dev openssl-dev pax-utils readline-dev sqlite-dev tcl-dev tk tk-dev util-linux-dev xz-dev zlib-dev
add build deps before removing fetch deps in case theres overlapampamp apk del fetch-deps ampamp cd usrsrcpython ampamp gnuArch=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) ampamp configure
--build=$gnuArch --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip
ampamp make -j $(nproc) set thread stack size to 1MB so we dont segfault before we hit sysrarr˓getrecursionlimit() httpsgithubcomalpinelinuxaportscommitrarr˓2026e1259422d4e0cf92391ca2d3844356c649d0 (continues on next page)
150 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
EXTRA_CFLAGS=-DTHREAD_STACK_SIZE=0x100000 ampamp make install ampamp find usrlocal -type f -executable -not ( -name tkinter ) -exec scanelf
rarr˓--needed --nobanner --format np | tr n | sort -u | awk system([ -e usrlocallib $1 ]) == 0 next print so $1
rarr˓ | xargs -rt apk add --no-cache --virtual python-rundeps
ampamp apk del build-deps ampamp find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + ampamp rm -rf usrsrcpython ampamp python3 --version
make some useful symlinks that are expected to existRUN cd usrlocalbin
ampamp ln -s idle3 idle ampamp ln -s pydoc3 pydoc ampamp ln -s python3 python ampamp ln -s python3-config python-config
if this is called PIP_VERSION pip explodes with ValueError invalid truth valuerarr˓ltVERSIONgtENV PYTHON_PIP_VERSION 1901
RUN set -ex wget -O get-pippy httpsbootstrappypaioget-pippy python get-pippy
--disable-pip-version-check --no-cache-dir pip==$PYTHON_PIP_VERSION
pip --version find usrlocal -depth
( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name pyc -o -name pyo ) )
) -exec rm -rf + rm -f get-pippy
CMD [python3]
235 Images langages 151
Tutoriel Docker Release 2019-02-28T143129517726+0100
2352 Images pipenv
See also
bull httpshubdockercomrkennethreitzpipenv
Contents
bull Images pipenv
ndash Short Description
ndash What is Python
ndash Dockerfile
ndash How to use this image
23521 Short Description
Pipenv Docker image
23522 What is Python
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler composer npm cargo yarn etc) to thePython world Windows is a firstndashclass citizen in our world
It automatically creates and manages a virtualenv for your projects as well as addsremoves packages from yourPipfile as you installuninstall packages It also generates the everndashimportant Pipfilelock which is used to producedeterministic builds
23523 Dockerfile
See also
bull httpsgithubcompypapipenvblobmasterDockerfile
FROM herokuheroku18-build
ENV DEBIAN_FRONTEND noninteractiveENV LC_ALL CUTF-8ENV LANG CUTF-8
-- Install PipenvRUN apt update ampamp apt upgrade -y ampamp apt install python37-dev -yRUN curl --silent httpsbootstrappypaioget-pippy | python37
Backwards compatilityRUN rm -fr usrbinpython3 ampamp ln usrbinpython37 usrbinpython3
RUN pip3 install pipenv
-- Install Application into containerRUN set -ex ampamp mkdir app
(continues on next page)
152 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
WORKDIR app
-- Adding PipfilesONBUILD COPY Pipfile PipfileONBUILD COPY Pipfilelock Pipfilelock
-- Install dependenciesONBUILD RUN set -ex ampamp pipenv install --deploy --system
-------------------- - Using This File - --------------------
FROM kennethreitzpipenv
COPY app
-- Replace with the correct path to your apps main executable CMD python3 mainpy
23524 How to use this image
See also
bull httppython-responderorgenlatestdeploymenthtmldocker-deployment
from kennethreitzpipenv
COPY appCMD python3 apipy
2353 Images PHP
See also
bull httpsstoredockercomimagesphp
bull httpsenwikipediaorgwikiPHP
Contents
bull Images PHP
ndash Short Description
ndash What is PHP
23531 Short Description
While designed for web development the PHP scripting language also provides general-purpose use
235 Images langages 153
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 13 Le logo PHP
23532 What is PHP
See also
bull httpsenwikipediaorgwikiPHP
PHP is a server-side scripting language designed for web development but which can also be used as a general-purposeprogramming language PHP can be added to straight HTML or it can be used with a variety of templating enginesand web frameworks
PHP code is usually processed by an interpreter which is either implemented as a native module on the web-server oras a common gateway interface (CGI)
2354 Images Ruby
See also
bull httpsstoredockercomimagesruby
bull httpsenwikipediaorgwikiRuby_28programming_language29
Contents
bull Images Ruby
ndash Short Description
ndash What is Ruby
Fig 14 Le logo Ruby
23541 Short Description
Ruby is a dynamic reflective object-oriented general-purpose open-source programming language
154 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
23542 What is Ruby
See also
bull httpsenwikipediaorgwikiRuby_28programming_language29
Ruby is a dynamic reflective object-oriented general-purpose open-source programming language
According to its authors Ruby was influenced by Perl Smalltalk Eiffel Ada and Lisp It supports multiple pro-gramming paradigms including functional object-oriented and imperative It also has a dynamic type system andautomatic memory management
2355 Images Node
See also
bull httpsstoredockercomimagesnode
bull httpsenwikipediaorgwikiRuby_28programming_language29
Contents
bull Images Node
ndash Short Description
ndash What is Nodejs
Fig 15 Le logo Nodejs
23551 Short Description
Nodejs is a JavaScript-based platform for server-side and networking applications
23552 What is Nodejs
See also
bull httpsenwikipediaorgwikiNodejs
Nodejs is a software platform for scalable server-side and networking applications
Nodejs applications are written in JavaScript and can be run within the Nodejs runtime on Mac OS X Windows andLinux without changes
Nodejs applications are designed to maximize throughput and efficiency using non-blocking IO and asynchronousevents
Nodejs applications run single-threaded although Nodejs uses multiple threads for file and network events
Nodejs is commonly used for real-time applications due to its asynchronous nature
235 Images langages 155
Tutoriel Docker Release 2019-02-28T143129517726+0100
Nodejs internally uses the Google V8 JavaScript engine to execute code a large percentage of the basic modules arewritten in JavaScript
Nodejs contains a built-in asynchronous IO library for file socket and HTTP communication
The HTTP and socket support allows Nodejs to act as a web server without additional software such as Apache
2356 Images Go (Golang)
See also
bull httpsstoredockercomimagesgolang
bull httpsenwikipediaorgwikiGo_28programming_language29
Contents
bull Images Go (Golang)
ndash Short Description
ndash What is Go
Fig 16 Le logo Golang
23561 Short Description
Nodejs is a JavaScript-based platform for server-side and networking applications
23562 What is Go
See also
bull httpsenwikipediaorgwikiGo_28programming_language29
156 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
Go (aka Golang) is a programming language first developed at Google
It is a statically-typed language with syntax loosely derived from C but with additional features such as garbagecollection type safety some dynamic-typing capabilities additional built-in types (eg variable-length arrays andkey-value maps) and a large standard library
2357 Images OpenJDK (Java)
See also
bull httpshubdockercom_openjdk
bull httpsenwikipediaorgwikiOpenJDK
bull httpopenjdkjavanet
bull httpsgithubcomdocker-libraryopenjdk
bull httpstwittercomOpenJDK
Contents
bull Images OpenJDK (Java)
ndash Short Description
ndash What is OpenJDK
ndash How to use this image
Fig 17 Le logo OpenJDK
23571 Short Description
OpenJDK is an open-source implementation of the Java Platform Standard Edition
23572 What is OpenJDK
See also
bull httpsenwikipediaorgwikiOpenJDK
OpenJDK (Open Java Development Kit) is a free and open source implementation of the Java Platform StandardEdition (Java SE)
OpenJDK is the official reference implementation of Java SE since version 7
235 Images langages 157
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 18 httpshubdockercom_openjdk
158 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
23573 How to use this image
Start a Java instance in your app
The most straightforward way to use this image is to use a Java container as both the build and runtime environmentIn your Dockerfile writing something along the lines of the following will compile and run your project
FROM openjdk7COPY usrsrcmyappWORKDIR usrsrcmyappRUN javac MainjavaCMD [java Main]
You can then run and build the Docker image
$ docker build -t my-java-app $ docker run -it --rm --name my-running-app my-java-app
236 Images webserver serveurs HTTP (serveurs Web)
See also
bull httpsfrwikipediaorgwikiServeur_HTTP
bull httpsfrwikipediaorgwikiServeur_HTTPLogiciels_de_serveur_HTTP
bull httpsenwikipediaorgwikiWeb_server
Le serveur HTTP le plus utiliseacute est Apache HTTP Server qui sert environ 55 des sites web en janvier 2013 selonNetcraft
Le serveur HTTP le plus utiliseacute dans les 1 000 sites les plus actifs est en revanche Nginx avec 382 de parts demarcheacute en 2016 selon w3techs et 539 en avril 2017
2361 Images Apache HTTPD
See also
bull httpshubdockercom_httpd
bull httpsenwikipediaorgwikiApache_HTTP_Server
bull httpshttpdapacheorg
Contents
bull Images Apache HTTPD
ndash Short Description
ndash What is httpd
ndash Configuration
ndash SSLHTTPS
ndash Versions
236 Images webserver serveurs HTTP (serveurs Web) 159
Tutoriel Docker Release 2019-02-28T143129517726+0100
24 classic
24 Alpine
Fig 19 Le logo Apache HTTPD
Fig 20 httpshubdockercom_httpd
23611 Short Description
The Apache HTTP Server Project
23612 What is httpd
The Apache HTTP Server colloquially called Apache is a Web server application notable for playing a key role inthe initial growth of the World Wide Web
Originally based on the NCSA HTTPd server development of Apache began in early 1995 after work on the NCSAcode stalled
Apache quickly overtook NCSA HTTPd as the dominant HTTP server and has remained the most popular HTTPserver in use since April 1996
23613 Configuration
To customize the configuration of the httpd server just COPY your custom configuration in asusrlocalapache2confhttpdconf
160 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
FROM httpd24COPY my-httpdconf usrlocalapache2confhttpdconf
23614 SSLHTTPS
If you want to run your web traffic over SSL the simplest setup is to COPY or mount (-v) your servercrt and serverkeyinto usrlocalapache2conf and then customize the usrlocalapache2confhttpdconf by removing the commentsymbol from the following lines
LoadModule socache_shmcb_module modulesmod_socache_shmcbsoLoadModule ssl_module modulesmod_sslsoInclude confextrahttpd-sslconf
The confextrahttpd-sslconf configuration file will use the certificate files previously added and tell the daemon toalso listen on port 443
Be sure to also add something like -p 443443 to your docker run to forward the https port
This could be accomplished with a sed line similar to the following
RUN sed -i -e s^(Include httpd-sslconf)1 -e s^(LoadModule mod_sslso)1 -e s^(LoadModule mod_socache_shmcbso)1 confhttpdconf
The previous steps should work well for development but we recommend customizing your conf files for productionsee httpdapacheorg for more information about SSL setup
23615 Versions
See also
bull httpsdocsdockercomsampleslibraryhttpd
236151 24 classic
See also
bull httpsgithubcomdocker-libraryhttpdblob5a6a1d99f1d6e754ecfcdd7a13e12980b86d7b7524Dockerfile
FROM debianstretch-slim
add our user and group first to make sure their IDs get assigned consistentlyrarr˓regardless of whatever dependencies get addedRUN groupadd -r www-data ampamp useradd -r --create-home -g www-data www-data
ENV HTTPD_PREFIX usrlocalapache2ENV PATH $HTTPD_PREFIXbin$PATHRUN mkdir -p $HTTPD_PREFIX
(continues on next page)
236 Images webserver serveurs HTTP (serveurs Web) 161
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
ampamp chown www-datawww-data $HTTPD_PREFIXWORKDIR $HTTPD_PREFIX
install httpd runtime dependencies httpshttpdapacheorgdocs24installhtmlrequirementsRUN set -eux
apt-get update apt-get install -y --no-install-recommends
libapr1-dev libaprutil1-dev libaprutil1-ldap
rm -rf varlibaptlists
ENV HTTPD_VERSION 2438ENV HTTPD_SHA256 7dc65857a994c98370dc4334b260101a7a04be60e6e74a5c57a6dee1bc8f394a
httpshttpdapacheorgsecurityvulnerabilities_24htmlENV HTTPD_PATCHES=
ENV APACHE_DIST_URLS httpsissuesapacheorgjirabrowseINFRA-8753focusedCommentId=14735394comment-rarr˓14735394
httpswwwapacheorgdynclosercgiaction=downloadampfilename= if the version is outdated (or were grabbing the asc file) we might have to pullrarr˓from the distarchive
httpswww-usapacheorgdist httpswwwapacheorgdist httpsarchiveapacheorgdist
see httpshttpdapacheorgdocs24installhtmlrequirementsRUN set -eux
mod_http2 mod_lua mod_proxy_html mod_xml2enc httpsanonscmdebianorgcgitpkg-apacheapache2gittreedebiancontrol
rarr˓id=adb6f181257af28ee67af15fc49d2699a0080d4csavedAptMark=$(apt-mark showmanual) apt-get update apt-get install -y --no-install-recommends
bzip2 ca-certificates dirmngr dpkg-dev gcc gnupg liblua52-dev libnghttp2-dev libpcre3-dev libssl-dev libxml2-dev make wget zlib1g-dev
rm -r varlibaptlists ddist()
(continues on next page)
162 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
local f=$1 shift local distFile=$1 shift local success= local distUrl= for distUrl in $APACHE_DIST_URLS do
if wget -O $f $distUrl$distFile ampamp [ -s $f ] then success=1 break
fi done [ -n $success ]
ddist httpdtarbz2 httpdhttpd-$HTTPD_VERSIONtarbz2 echo $HTTPD_SHA256 httpdtarbz2 | sha256sum -c -
see httpshttpdapacheorgdownloadcgiverifyddist httpdtarbz2asc httpdhttpd-$HTTPD_VERSIONtarbz2asc export GNUPGHOME=$(mktemp -d) for key in
gpg key 791485A8 public key Jim Jagielski (Release Signing Key) ltjimapacheorggtrarr˓ imported
A93D62ECC3C8EA12DB220EC934EA76E6791485A8 gpg key 995E35221AD84DFF public key Daniel Ruggeri (httphomeapacheorg~rarr˓druggeri) ltdruggeriapacheorggt imported
B9E8213AEFB861AF35A41F2C995E35221AD84DFF do
gpg --batch --keyserver hapoolsks-keyserversnet --recv-keys $key done gpg --batch --verify httpdtarbz2asc httpdtarbz2 command -v gpgconf ampamp gpgconf --kill all || rm -rf $GNUPGHOME httpdtarbz2asc mkdir -p src tar -xf httpdtarbz2 -C src --strip-components=1 rm httpdtarbz2 cd src patches()
while [ $ -gt 0 ] do local patchFile=$1 shift local patchSha256=$1 shift ddist $patchFile httpdpatchesapply_to_$HTTPD_VERSION$patchFile echo $patchSha256 $patchFile | sha256sum -c - patch -p0 lt $patchFile rm -f $patchFile
done patches $HTTPD_PATCHES gnuArch=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) configure
--build=$gnuArch --prefix=$HTTPD_PREFIX --enable-mods-shared=reallyall --enable-mpms-shared=all
(continues on next page)
236 Images webserver serveurs HTTP (serveurs Web) 163
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
make -j $(nproc) make install cd rm -r src man manual sed -ri
-e s^(sCustomLog)s+S+1 procselffd1g -e s^(sErrorLog)s+S+1 procselffd2g $HTTPD_PREFIXconfhttpdconf
reset apt-marks manual list so that purge --auto-remove will remove all buildrarr˓dependencies
apt-mark auto gt devnull [ -z $savedAptMark ] || apt-mark manual $savedAptMark find usrlocal -type f -executable -exec ldd
| awk =gt print $(NF-1) | sort -u | xargs -r dpkg-query --search | cut -d -f1 | sort -u | xargs -r apt-mark manual
apt-get purge -y --auto-remove -o APTAutoRemoveRecommendsImportant=false
smoke testhttpd -v
COPY httpd-foreground usrlocalbin
EXPOSE 80CMD [httpd-foreground]
236152 24 Alpine
FROM alpine39
ensure www-data user existsRUN set -x
ampamp addgroup -g 82 -S www-data ampamp adduser -u 82 -D -S -G www-data www-data
82 is the standard uidgid for www-data in Alpine httpsgitalpinelinuxorgcgitaportstreemainapache2apache2pre-installh=v3rarr˓81 httpsgitalpinelinuxorgcgitaportstreemainlighttpdlighttpdpre-installrarr˓h=v381 httpsgitalpinelinuxorgcgitaportstreemainnginxnginxpre-installh=v381
ENV HTTPD_PREFIX usrlocalapache2ENV PATH $HTTPD_PREFIXbin$PATHRUN mkdir -p $HTTPD_PREFIX
ampamp chown www-datawww-data $HTTPD_PREFIXWORKDIR $HTTPD_PREFIX
(continues on next page)
164 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
ENV HTTPD_VERSION 2438ENV HTTPD_SHA256 7dc65857a994c98370dc4334b260101a7a04be60e6e74a5c57a6dee1bc8f394a
httpshttpdapacheorgsecurityvulnerabilities_24htmlENV HTTPD_PATCHES=
ENV APACHE_DIST_URLS httpsissuesapacheorgjirabrowseINFRA-8753focusedCommentId=14735394comment-rarr˓14735394
httpswwwapacheorgdynclosercgiaction=downloadampfilename= if the version is outdated (or were grabbing the asc file) we might have to pullrarr˓from the distarchive
httpswww-usapacheorgdist httpswwwapacheorgdist httpsarchiveapacheorgdist
see httpshttpdapacheorgdocs24installhtmlrequirementsRUN set -eux
runDeps=
apr-dev apr-util-dev apr-util-ldap perl
apk add --no-cache --virtual build-deps
$runDeps ca-certificates coreutils dpkg-dev dpkg gcc gnupg libc-dev mod_proxy_html mod_xml2enclibxml2-dev mod_lualua-dev make mod_http2nghttp2-dev mod_session_cryptoopenssl openssl-dev pcre-dev tar mod_deflatezlib-dev
ddist()
local f=$1 shift local distFile=$1 shift local success= local distUrl= for distUrl in $APACHE_DIST_URLS do
if wget -O $f $distUrl$distFile ampamp [ -s $f ] then success=1
(continues on next page)
236 Images webserver serveurs HTTP (serveurs Web) 165
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
break fi
done [ -n $success ]
ddist httpdtarbz2 httpdhttpd-$HTTPD_VERSIONtarbz2 echo $HTTPD_SHA256 httpdtarbz2 | sha256sum -c -
see httpshttpdapacheorgdownloadcgiverifyddist httpdtarbz2asc httpdhttpd-$HTTPD_VERSIONtarbz2asc export GNUPGHOME=$(mktemp -d) for key in
gpg key 791485A8 public key Jim Jagielski (Release Signing Key) ltjimapacheorggtrarr˓ imported
A93D62ECC3C8EA12DB220EC934EA76E6791485A8 gpg key 995E35221AD84DFF public key Daniel Ruggeri (httpshomeapacheorg~rarr˓druggeri) ltdruggeriapacheorggt imported
B9E8213AEFB861AF35A41F2C995E35221AD84DFF do
gpg --batch --keyserver hapoolsks-keyserversnet --recv-keys $key done gpg --batch --verify httpdtarbz2asc httpdtarbz2 command -v gpgconf ampamp gpgconf --kill all || rm -rf $GNUPGHOME httpdtarbz2asc mkdir -p src tar -xf httpdtarbz2 -C src --strip-components=1 rm httpdtarbz2 cd src patches()
while [ $ -gt 0 ] do local patchFile=$1 shift local patchSha256=$1 shift ddist $patchFile httpdpatchesapply_to_$HTTPD_VERSION$patchFile echo $patchSha256 $patchFile | sha256sum -c - patch -p0 lt $patchFile rm -f $patchFile
done patches $HTTPD_PATCHES gnuArch=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) configure
--build=$gnuArch --prefix=$HTTPD_PREFIX --enable-mods-shared=reallyall --enable-mpms-shared=all
make -j $(nproc) make install cd rm -r src man manual sed -ri
(continues on next page)
166 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
-e s^(sCustomLog)s+S+1 procselffd1g -e s^(sErrorLog)s+S+1 procselffd2g $HTTPD_PREFIXconfhttpdconf
runDeps=$runDeps $(
scanelf --needed --nobanner --format np --recursive usrlocal | tr n | sort -u | awk system([ -e usrlocallib $1 ]) == 0 next print so
rarr˓$1 ) apk add --virtual httpd-rundeps $runDeps apk del build-deps
smoke testhttpd -v
COPY httpd-foreground usrlocalbin
EXPOSE 80CMD [httpd-foreground]
2362 Images Apache HTTPD bitnami
See also
bull httpstwittercomBitnami
bull httpshubdockercomrbitnamiapache
bull httpsgithubcombitnamibitnami-docker-apache
bull httpsenwikipediaorgwikiApache_HTTP_Server
bull httpshttpdapacheorg
Contents
bull Images Apache HTTPD bitnami
ndash Short Description
What is Apache
ndash TLDR
ndash Docker Compose
ndash Dockerfile
ndash Why use Bitnami Images
ndash Adding custom virtual hosts
Step 1 Write your my_vhostconf file with the following content
Step 2 Mount the configuration as a volume
ndash Using custom SSL certificates
236 Images webserver serveurs HTTP (serveurs Web) 167
Tutoriel Docker Release 2019-02-28T143129517726+0100
Step 1 Prepare your certificate files
Step 2 Run the Apache image
ndash Full configuration
Step 1 Run the Apache image
Step 2 Edit the configuration
Step 3 Restart Apache
ndash Logging
ndash Upgrade this image
Step 1 Get the updated image
Step 2 Stop and backup the currently running container
Step 3 Remove the currently running container
Step 4 Run the new image
ndash Notable Changes
2434-r8 (2018-07-24)
2418-r0
2412-4-r01
23621 Short Description
236211 What is Apache
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modernoperating systems including UNIX and Windows NT
The goal of this project is to provide a secure efficient and extensible server that provides HTTP services in sync withthe current HTTP standards
23622 TLDR
$ docker run --name apache bitnamiapachelatest
23623 Docker Compose
$ curl -sSL httpsrawgithubusercontentcombitnamibitnami-docker-apachemasterrarr˓docker-composeyml gt docker-composeyml
$ docker-compose up -d
168 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
23624 Dockerfile
FROM bitnamiminideb-extrasstretch-r158LABEL maintainer Bitnami ltcontainersbitnamicomgt
ENV BITNAMI_PKG_CHMOD=-R g+rwX BITNAMI_PKG_EXTRA_DIRS=bitnamiapacheconf optbitnamiapachetmp optbitnami
rarr˓apacheconf HOME=
Install required system packages and dependenciesRUN install_packages libc6 libexpat1 libffi6 libgmp10 libgnutls30 libhogweed4rarr˓libidn11 libldap-24-2 libnettle6 libp11-kit0 libpcre3 libsasl2-2 libssl11rarr˓libtasn1-6 zlib1gRUN bitnami-pkg unpack apache-2435-0 --checksumrarr˓1e352e2185137fcad60bb6fdf2961368f59a35e2c2cab4ee94c77152f1c37299RUN ln -sf optbitnamiapachehtdocs appRUN ln -sf devstdout optbitnamiapachelogsaccess_logRUN ln -sf devstdout optbitnamiapachelogserror_log
COPY rootfs ENV APACHE_HTTPS_PORT_NUMBER=8443
APACHE_HTTP_PORT_NUMBER=8080 BITNAMI_APP_NAME=apache BITNAMI_IMAGE_VERSION=2435-debian-9-r10 PATH=optbitnamiapachebin$PATH
EXPOSE 8080 8443
WORKDIR appUSER 1001ENTRYPOINT [ app-entrypointsh ]CMD [ runsh ]
23625 Why use Bitnami Images
Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our auto-mated systems
With Bitnami images the latest bug fixes and features are available as soon as possible
Bitnami containers virtual machines and cloud images use the same components and configuration approach - makingit easy to switch between formats based on your project needs
Bitnami images are built on CircleCI and automatically pushed to the Docker Hub
All our images are based on minideb a minimalist Debian based container image which gives you a small base con-tainer image and the familiarity of a leading linux distribution
23626 Adding custom virtual hosts
The default httpdconf includes virtual hosts placed in bitnamiapacheconfvhosts
You can mount a my_vhostconf file containing your custom virtual hosts at this location
236 Images webserver serveurs HTTP (serveurs Web) 169
Tutoriel Docker Release 2019-02-28T143129517726+0100
236261 Step 1 Write your my_vhostconf file with the following content
ltVirtualHost 8080gtServerName wwwexamplecomDocumentRoot appltDirectory appgtOptions Indexes FollowSymLinksAllowOverride AllRequire all granted
ltDirectorygtltVirtualHostgt
236262 Step 2 Mount the configuration as a volume
$ docker run --name apache -v pathtomy_vhostconfbitnamiapacheconfvhostsmy_vhostconfro bitnamiapachelatest
or using Docker Compose
version 2
servicesapacheimage bitnamiapachelatestports
- 808080- 4438443
volumes- pathtomy_vhostconfbitnamiapacheconfvhostsmy_vhostconfro
23627 Using custom SSL certificates
Note The steps below assume that you are using a custom domain name and that you have already configured thecustom domain name to point to your server
This container comes with SSL support already pre-configured and with a dummy certificate in place (servercrt andserverkey files in bitnamiapacheconfbitnamicerts)
If you want to use your own certificate (crt) and certificate key (key) files follow the steps below
236271 Step 1 Prepare your certificate files
In your local computer create a folder called certs and put your certificates files Make sure you rename both files toservercrt and serverkey respectively
$ mkdir pathtoapache-persistenceapacheconfbitnamicerts -p$ cp pathtocertfilecrt pathtoapache-persistenceapacheconfbitnamicertscp pathtokeyfilekey pathtoapache-persistenceapacheconfbitnamicertsserverrarr˓key
170 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
236272 Step 2 Run the Apache image
Run the Apache image mounting the certificates directory from your host
$ docker run --name apache -v pathtoapache-persistenceapacheconfbitnamicertsbitnamiapacheconf
rarr˓bitnamicerts bitnamiapachelatest
or using Docker Compose
version 2
servicesapacheimage bitnamiapachelatestports
- 808080- 4438443
volumes- pathtoapache-persistenceapacheconfbitnamicertsbitnamiapacheconf
rarr˓bitnamicerts
23628 Full configuration
The image looks for configurations in bitnamiapacheconf
You can mount a volume at bitnami and copyedit the configurations in the bitnamiapacheconf The default con-figurations will be populated in the conf directory if itrsquos empty
236281 Step 1 Run the Apache image
Run the Apache image mounting a directory from your host
$ docker run --name apache -v pathtoapache-persistencebitnami bitnamiapachelatest
or using Docker Compose
version 2
servicesapache
image bitnamiapachelatestports- 808080- 4438443
volumes- pathtoapache-persistencebitnami
236282 Step 2 Edit the configuration
Edit the configuration on your host using your favorite editor
236 Images webserver serveurs HTTP (serveurs Web) 171
Tutoriel Docker Release 2019-02-28T143129517726+0100
$ vi pathtoapache-persistenceapacheconfhttpdconf
236283 Step 3 Restart Apache
After changing the configuration restart your Apache container for the changes to take effect
$ docker restart apache
or using Docker Compose
$ docker-compose restart apache
23629 Logging
The Bitnami Apache Docker image sends the container logs to the stdout To view the logs
$ docker logs apache
or using Docker Compose
$ docker-compose logs apache
You can configure the containers logging driver using the ndashlog-driver option if you wish to consume the container logsdifferently
In the default configuration docker uses the json-file driver
236210 Upgrade this image
Bitnami provides up-to-date versions of Apache including security patches soon after they are made upstream Werecommend that you follow these steps to upgrade your container
2362101 Step 1 Get the updated image
$ docker pull bitnamiapachelatest
or if youre using Docker Compose update the value of the imageproperty to bitnamiapachelatest
2362102 Step 2 Stop and backup the currently running container
Stop the currently running container using the command
$ docker stop apache
or using Docker Compose
$ docker-compose stop apache
172 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
Next take a snapshot of the persistent volume pathtoapache-persistence using
$ rsync -a pathtoapache-persistence pathtoapache-persistencebkp$(date +Ymd-rarr˓HMS)
You can use this snapshot to restore the database state should the upgrade fail
2362103 Step 3 Remove the currently running container
$ docker rm -v apache
or using Docker Compose
$ docker-compose rm -v apache
2362104 Step 4 Run the new image
Re-create your container from the new image
$ docker run --name apache bitnamiapachelatest
or using Docker Compose
$ docker-compose up apache
236211 Notable Changes
2362111 2434-r8 (2018-07-24)
See also
bull httpsgithubcombitnamibitnami-docker-apachetree2434-ol-7-r8
The Apache container has been migrated to a non-root user approach
Previously the container ran as the root user and the Apache daemon was started as the apache user
From now on both the container and the Apache daemon run as user 1001
As a consequence the HTTPHTTPS ports exposed by the container are now 80808443 instead of 80443
You can revert this behavior by changing USER 1001 to USER root in the Dockerfile
2362112 2418-r0
The configuration volume has been moved to bitnamiapache
Now you only need to mount a single volume at bitnamiapache for persisting configuration
app is still used for serving content by the default virtual host
The logs are always sent to the stdout and are no longer collected in the volume
236 Images webserver serveurs HTTP (serveurs Web) 173
Tutoriel Docker Release 2019-02-28T143129517726+0100
2362113 2412-4-r01
The app directory is no longer exported as a volume
This caused problems when building on top of the image since changes in the volume are not persisted betweenDockerfile RUN instructions
To keep the previous behavior (so that you can mount the volume in another container) create the container with the-v app option
2363 Images apache Tomcat
See also
bull httpshubdockercom_tomcat
bull httpsfrwikipediaorgwikiApache_Tomcat
Contents
bull Images apache Tomcat
ndash Short Description
ndash What is Apache Tomcat
Fig 21 Le logo Apache Tomcat
23631 Short Description
Apache Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies
23632 What is Apache Tomcat
Apache Tomcat (or simply Tomcat) is an open source web server and servlet container developed by the ApacheSoftware Foundation (ASF)
Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle and provides a ldquopureJavardquo HTTP web server environment for Java code to run in
174 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 22 httpshubdockercom_tomcat
236 Images webserver serveurs HTTP (serveurs Web) 175
Tutoriel Docker Release 2019-02-28T143129517726+0100
In the simplest config Tomcat runs in a single operating system process
The process runs a Java virtual machine (JVM)
Every single HTTP request from a browser to Tomcat is processed in the Tomcat process in a separate thread
2364 Images webserver serveurs Web + reverse proxy + load balancer
See also
bull httpsenwikipediaorgwikiReverse_proxy
bull httpsfrwikipediaorgwikiProxy_inverse
bull httpsenwikipediaorgwikiLoad_balancer
bull httpsenwikipediaorgwikiHTTP_cache
See also
bull httpsenwikipediaorgwikiWeb_server
23641 Apache HTTP Server + mod_proxy
Apache HTTP Server serveur HTTP libre configurable en proxy inverse avec le module mod_proxy
23642 Nginx
236421 Images nginx (engine-x)
See also
bull httpshubdockercom_nginx
bull httpsenwikipediaorgwikiNginx
Contents
bull Images nginx (engine-x)
ndash Short Description
ndash What is nginx
Fig 23 Le logo Nginx
Short Description
Official build of Nginx
176 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
What is nginx
See also
bull httpsenwikipediaorgwikiWeb_server
bull httpsenwikipediaorgwikiReverse_proxy
bull httpsenwikipediaorgwikiLoad_balancer
bull httpsenwikipediaorgwikiHTTP_cache
Nginx (pronounced ldquoengine-xrdquo) is an
bull open source reverse proxy server for HTTP HTTPS SMTP POP3 and IMAP protocols
bull as well as a load balancer HTTP cache
bull and a web server (origin server)
The nginx project started with a strong focus on high concurrency high performance and low memory usage
It is licensed under the 2-clause BSD-like license and it runs on Linux BSD variants Mac OS X Solaris AIXHP-UX as well as on other nix flavors
It also has a proof of concept port for Microsoft Windows
A large fraction of web servers use NGINX often as a load balancer
237 Images authentication authentification
2371 Images LDAP
238 Images db bases de donneacutees
2381 Images PostgreSQL
See also
bull httpsstoredockercomimagespostgres
bull httpshubdockercom_postgres
bull httpsfrwikipediaorgwikiPostgreSQL
bull httpsenwikipediaorgwikiPostgreSQL
Contents
bull Images PostgreSQL
ndash Short Description
ndash Description
ndash What is PostgreSQL
ndash Environment Variables
POSTGRES_PASSWORD
237 Images authentication authentification 177
Tutoriel Docker Release 2019-02-28T143129517726+0100
POSTGRES_USER
PGDATA
POSTGRES_DB
POSTGRES_INITDB_WALDIR
ndash Docker Secrets
ndash How to extend this image
Extends with a Dockerfile
ndash docker-compose up
Fig 24 Le logo PostgreSQL
23811 Short Description
The PostgreSQL object-relational database system provides reliability and data integrity
23812 Description
PostgreSQL est un systegraveme de gestion de base de donneacutees relationnelle et objet (SGBDRO) Crsquoest un outil libredisponible selon les termes drsquoune licence de type BSD
Ce systegraveme est concurrent drsquoautres systegravemes de gestion de base de donneacutees qursquoils soient libres (comme MariaDBMySQL et Firebird) ou proprieacutetaires (comme Oracle Sybase DB2 Informix et Microsoft SQL Server)
Comme les projets libres Apache et Linux PostgreSQL nrsquoest pas controcircleacute par une seule entreprise mais est fondeacute surune communauteacute mondiale de deacuteveloppeurs et drsquoentreprises
178 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 25 httpsstoredockercomimagespostgres
23813 What is PostgreSQL
See also
bull httpsenwikipediaorgwikiPostgreSQL
PostgreSQL often simply ldquoPostgresrdquo is an object-relational database management system (ORDBMS) with an em-phasis on extensibility and standards-compliance
As a database server its primary function is to store data securely and supporting best practices and retrieve it lateras requested by other software applications be it those on the same computer or those running on another computeracross a network (including the Internet)
It can handle workloads ranging from small single-machine applications to large Internet-facing applications withmany concurrent users
Recent versions also provide replication of the database itself for security and scalability
PostgreSQL implements the majority of the SQL2011 standard is ACID-compliant and transactional (including mostDDL statements) avoiding locking issues using multiversion concurrency control (MVCC) provides immunity todirty reads and full serializability handles complex SQL queries using many indexing methods that are not availablein other databases has updateable views and materialized views triggers foreign keys supports functions and storedprocedures and other expandability and has a large number of extensions written by third parties In addition tothe possibility of working with the major proprietary and open source databases PostgreSQL supports migrationfrom them by its extensive standard SQL support and available migration tools And if proprietary extensions hadbeen used by its extensibility that can emulate many through some built-in and third-party open source compatibilityextensions such as for Oracle
238 Images db bases de donneacutees 179
Tutoriel Docker Release 2019-02-28T143129517726+0100
23814 Environment Variables
The PostgreSQL image uses several environment variables which are easy to miss While none of the variables arerequired they may significantly aid you in using the image
238141 POSTGRES_PASSWORD
This environment variable is recommended for you to use the PostgreSQL image This environment variable setsthe superuser password for PostgreSQL The default superuser is defined by the POSTGRES_USER environmentvariable In the above example it is being set to ldquomysecretpasswordrdquo
Note 1 The PostgreSQL image sets up trust authentication locally so you may notice a password is not required whenconnecting from localhost (inside the same container) However a password will be required if connecting from adifferent hostcontainer
Note 2 This variable defines the superuser password in the PostgreSQL instance as set by the initdb script duringinital container startup It has no effect on the PGPASSWORD environment variable that may be used by the psqlclient at runtime as described at
httpswwwpostgresqlorgdocs10staticlibpq-envarshtml PGPASSWORD if used will be specified as a separateenvironment variable
238142 POSTGRES_USER
This optional environment variable is used in conjunction with POSTGRES_PASSWORD to set a user and its pass-word This variable will create the specified user with superuser power and a database with the same name If it is notspecified then the default user of postgres will be used
238143 PGDATA
This optional environment variable can be used to define another location - like a subdirectory - for the database filesThe default is varlibpostgresqldata but if the data volume yoursquore using is a fs mountpoint (like with GCE persistentdisks) Postgres initdb recommends a subdirectory (for example varlibpostgresqldatapgdata ) be created to containthe data
238144 POSTGRES_DB
This optional environment variable can be used to define a different name for the default database that is createdwhen the image is first started If it is not specified then the value of POSTGRES_USER will be used POST-GRES_INITDB_ARGS
This optional environment variable can be used to send arguments to postgres initdb The value is a space separatedstring of arguments as postgres initdb would expect them This is useful for adding functionality like data pagechecksums -e POSTGRES_INITDB_ARGS=rdquondashdata-checksumsrdquo
238145 POSTGRES_INITDB_WALDIR
This optional environment variable can be used to define another location for the Postgres transaction log By defaultthe transaction log is stored in a subdirectory of the main Postgres data folder (PGDATA) Sometimes it can be desire-able to store the transaction log in a different directory which may be backed by storage with different performance orreliability characteristics
180 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
Note on PostgreSQL 9x this variable is POSTGRES_INITDB_XLOGDIR (reflecting the changed name of thendashxlogdir flag to ndashwaldir in PostgreSQL 10+)
23815 Docker Secrets
As an alternative to passing sensitive information via environment variables _FILE may be appended to the pre-viously listed environment variables causing the initialization script to load the values for those variables fromfiles present in the container In particular this can be used to load passwords from Docker secrets stored inrunsecretsltsecret_namegt files For example
$ docker run --name some-postgres -e POSTGRES_PASSWORD_FILE=runsecretspostgres-rarr˓passwd -d postgres
Currently this is only supported for POSTGRES_INITDB_ARGS POSTGRES_PASSWORD POSTGRES_USERand POSTGRES_DB
23816 How to extend this image
If you would like to do additional initialization in an image derived from this one add one or more sql sqlgz orsh scripts under docker-entrypoint-initdbd (creating the directory if necessary)
After the entrypoint calls initdb to create the default postgres user and database it will run any sql files and sourceany sh scripts found in that directory to do further initialization before starting the service
For example to add an additional user and database add the following to docker-entrypoint-initdbdinit-user-dbsh
binbashset -e
psql -v ON_ERROR_STOP=1 --username $POSTGRES_USER ltlt-EOSQLCREATE USER dockerCREATE DATABASE dockerGRANT ALL PRIVILEGES ON DATABASE docker TO docker
EOSQL
These initialization files will be executed in sorted name order as defined by the current locale which defaults toen_USutf8
Any sql files will be executed by POSTGRES_USER which defaults to the postgres superuser
It is recommended that any psql commands that are run inside of a sh script be executed as POSTGRES_USER byusing the ndashusername ldquo$POSTGRES_USERrdquo flag This user will be able to connect without a password due to thepresence of trust authentication for Unix socket connections made inside the container
Additionally as of docker-librarypostgres253 these initialization scripts are run as the postgres user (or as theldquosemi-arbitrary userrdquo specified with the ndashuser flag to docker run see the section titled ldquoArbitrary ndashuser Notesrdquo formore details)
238161 Extends with a Dockerfile
You can also extend the image with a simple Dockerfile to set a different locale The following example will set thedefault locale to de_DEutf8
238 Images db bases de donneacutees 181
Tutoriel Docker Release 2019-02-28T143129517726+0100
FROM postgres94RUN localedef -i de_DE -c -f UTF-8 -A usrsharelocalelocalealias de_DEUTF-8ENV LANG de_DEutf8
Since database initialization only happens on container startup this allows us to set the language before it is created
23817 docker-compose up
FROM postgres101RUN localedef -i fr_FR -c -f UTF-8 -A usrsharelocalelocalealias fr_FRUTF-8ENV LANG fr_FRutf8
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_rarr˓dockertutorielspostgresqlgt docker-compose up
WARNING The Docker Engine youre using is running in swarm mode
Compose does not use swarm mode to deploy services to multiple nodes in a swarm Allrarr˓containers will be scheduled on the current node
To deploy your application across the swarm use `docker stack deploy`
Building dbStep 13 FROM postgres101101 Pulling from librarypostgres723254a2c089 Pull complete39ec0e6c372c Pull completeba1542fb91f3 Pull completec7195e642388 Pull complete95424deca6a2 Pull complete2d7d4b3a4ce2 Pull completefbde41d4a8cc Pull complete880120b92add Pull complete9a217c784089 Pull completed581543fe8e7 Pull completee5eff8940bb0 Pull complete462d60a56b09 Pull complete135fa6b9c139 Pull completeDigest sha2563f4441460029e12905a5d447a3549ae2ac13323d045391b0cb0cf8b48ea17463Status Downloaded newer image for postgres101---gt ec61d13c8566
Step 23 RUN localedef -i fr_FR -c -f UTF-8 -A usrsharelocalelocalealias fr_FRrarr˓UTF-8---gt Running in 18aa6161e381
Removing intermediate container 18aa6161e381---gt a20322020edd
Step 33 ENV LANG fr_FRutf8---gt Running in 0245352c15af
Removing intermediate container 0245352c15af---gt b738f47d14a3
Successfully built b738f47d14a3Successfully tagged postgres101WARNING Image for service db was built because it did not already exist To rebuildrarr˓this image you must use `docker-compose build` or `docker-compose up --build`Creating container_intranet done
(continues on next page)
182 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
Attaching to container_intranetcontainer_intranet | 2018-01-31 120954628 UTC [1] LOG listening on IPv4 addressrarr˓0000 port 5432container_intranet | 2018-01-31 120954628 UTC [1] LOG listening on IPv6 addressrarr˓ port 5432container_intranet | 2018-01-31 120954839 UTC [1] LOG listening on Unix socket rarr˓varrunpostgresqlsPGSQL5432container_intranet | 2018-01-31 120955034 UTC [20] LOG database system was shutrarr˓down at 2018-01-31 120316 UTCcontainer_intranet | 2018-01-31 120955135 UTC [1] LOG database system is readyrarr˓to accept connections
PS Yprojects_id3P5N001XLOGCA135_tutorial_dockertutorial_rarr˓dockertutorielspostgresqlgt docker exec -ti dda260532cd7 bash
rootdda260532cd7 psql -U postgrespsql (101)Saisissez laquo help raquo pour laide
postgres= lListe des bases de
rarr˓donneacuteesNom | Proprieacutetaire | Encodage | Collationnement | Type caract | Droits
rarr˓daccegraves-----------+--------------+----------+-----------------+--------------+---------------rarr˓--------postgres | postgres | UTF8 | en_USutf8 | en_USutf8 |template0 | postgres | UTF8 | en_USutf8 | en_USutf8 | =cpostgresrarr˓ +
| | | | |rarr˓postgres=CTcpostgrestemplate1 | postgres | UTF8 | en_USutf8 | en_USutf8 | =cpostgresrarr˓ +
| | | | |rarr˓postgres=CTcpostgres(3 lignes)
2382 Images MariaDB
See also
bull httpsstoredockercomimagesmariadb
bull httpsenwikipediaorgwikiMariaDB
bull httpsfrwikipediaorgwikiMariaDB
Contents
bull Images MariaDB
ndash Short Description
ndash What is MariaDB
238 Images db bases de donneacutees 183
Tutoriel Docker Release 2019-02-28T143129517726+0100
ndash How to use this image
Fig 26 Le logo MariaDB
Fig 27 httpsstoredockercomimagesmariadb
23821 Short Description
MariaDB is a community-developed fork of MySQL intended to remain free under the GNU GPL
23822 What is MariaDB
MariaDB is a community-developed fork of the MySQL relational database management system intended to remainfree under the GNU GPL
Being a fork of a leading open source software system it is notable for being led by the original developers of MySQLwho forked it due to concerns over its acquisition by Oracle
Contributors are required to share their copyright with the MariaDB Foundation
The intent is also to maintain high compatibility with MySQL ensuring a ldquodrop-inrdquo replacement capability with librarybinary equivalency and exact matching with MySQL APIs and commands It includes the XtraDB storage engine forreplacing InnoDB as well as a new storage engine Aria that intends to be both a transactional and non-transactionalengine perhaps even included in future versions of MySQL
184 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
23823 How to use this image
Start a mariadb server instance
Starting a MariaDB instance is simple
$ docker run --name some-mariadb -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadbtag
where some-mariadb is the name you want to assign to your container my-secret-pw is the password to be set for theMySQL root user and tag is the tag specifying the MySQL version you want
See the list above for relevant tags Connect to MySQL from an application in another Docker container
Since MariaDB is intended as a drop-in replacement for MySQL it can be used with many applications
This image exposes the standard MySQL port (3306) so container linking makes the MySQL instance available toother application containers Start your application container like this in order to link it to the MySQL container
$ docker run --name some-app --link some-mariadbmysql -d application-that-uses-mysql
2383 Docker sybase
See also
bull httpsgithubcomcbsandocker-sybase
bull httpsgithubcomsearchutf8=E29C93ampq=docker+sybaseamptype=
Contents
bull Docker sybase
239 Images message queue
2391 Images rabbitmq
See also
bull httpsstoredockercomimagesrabbitmq
bull httpshubdockercom_rabbitmq
bull httpsenwikipediaorgwikiRabbitMQ
Contents
bull Images rabbitmq
ndash What is RabbitMQ
ndash Rabbitmq and celery
239 Images message queue 185
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 28 Le logo de rabbitmq
23911 What is RabbitMQ
RabbitMQ is open source message broker software (sometimes called message-oriented middleware) that implementsthe Advanced Message Queuing Protocol (AMQP)
The RabbitMQ server is written in the Erlang programming language and is built on the Open Telecom Platform frame-work for clustering and failover Client libraries to interface with the broker are available for all major programminglanguages
23912 Rabbitmq and celery
See also
bull httpdocsceleryprojectorgenlatestgetting-startedbrokersrabbitmqhtml
2310 Images outils collaboratifs
23101 Images Gitlab community edition
See also
bull httpsstoredockercomimagesgitlab-community-edition
bull httpsaboutgitlabcomfeatures
Contents
bull Images Gitlab community edition
ndash Short Description
231011 Short Description
GitLab includes Git repository management issue tracking code review an IDE activity streams wikis and more
Open source collaboration and source control management code test and deploy together More details on featurescan be found on httpsaboutgitlabcomfeatures
23102 Images Redmine
See also
bull httpsstoredockercomimagesredmine
186 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 29 Le logo Gitlab
Contents
bull Images Redmine
ndash Short Description
231021 Short Description
Redmine is a flexible project management web application written using Ruby on Rails framework
23103 Images Wordpress
See also
bull httpsstoredockercomimageswordpress
Contents
bull Images Wordpress
ndash Short Description
231031 Short Description
The WordPress rich content management system can utilize plugins widgets and themes
2310 Images outils collaboratifs 187
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 30 Le logo redmine
Fig 31 Le logo redmine
188 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
2311 Images ldquodocumentationrdquo
23111 Images MiKTeX
See also
bull httpsstoredockercomcommunityimagesmiktexmiktex
bull httpsgithubcomMiKTeXdocker-miktex
bull httpsenwikipediaorgwikiMiKTeX
Contents
bull Images MiKTeX
ndash Short Description
231111 Short Description
MiKTeX is a distribution of the TeXLaTeX typesetting system for Microsoft Windows It also contains a set of relatedprograms
MiKTeX provides the tools necessary to prepare documents using the TeXLaTeX markup language as well as asimple tex editor TeXworks
The name comes from Christian Schenkrsquos login MiK for Micro-Kid
2312 Images outils scientifiques
23121 Images Anaconda3
See also
bull httpsdocsanacondacomanacondauser-guidetasksintegrationdocker
bull httpshubdockercomrcontinuumio
bull httpshubdockercomrcontinuumioanaconda3
bull httpsgithubcomContinuumIOdocker-images
bull httpsdocsanacondacomanacondaglossary
Contents
bull Images Anaconda3
ndash Short Description
ndash Usage
2311 Images ldquodocumentationrdquo 189
Tutoriel Docker Release 2019-02-28T143129517726+0100
Fig 32 Le logo Continuumio
190 Chapter 23 Images Docker (Store Docker ex Hub docker)
Tutoriel Docker Release 2019-02-28T143129517726+0100
231211 Short Description
Powerful and flexible python distribution
231212 Usage
You can download and run this image using the following commands
CTmpgtdocker pull continuumioanaconda3
Using default tag latestlatest Pulling from continuumioanaconda385b1f47fba49 Pull completef4070d96116d Pull complete8b1142e4866d Pull complete924a14505c9a Pull completeDigest sha256c6fb10532fe2efac2f61bd4941896b917ad7b7f197bda9bddd3943aee434d281
Status Downloaded newer image for continuumioanaconda3latest
CTmpgtdocker run -i -t continuumioanaconda3 binbash
root8ffcde2f70f6 uname -a
Linux 8ffcde2f70f6 4960-linuxkit-aufs 1 SMP Mon Nov 6 160012 UTC 2017 x86_64 GNUrarr˓Linux
root8ffcde2f70f6 which python
optcondabinpython
root8ffcde2f70f6 python
Python 363 |Anaconda Inc| (default Oct 13 2017 120249)[GCC 720] on linuxType help copyright credits or license for more informationgtgtgt
2313 Images apprentissage
23131 Image dockersamplesstatic-site
See also
bull httpshubdockercomrdockersamplesstatic-site
Contents
bull Image dockersamplesstatic-site
2313 Images apprentissage 191
Tutoriel Docker Release 2019-02-28T143129517726+0100
23132 Image hello world
See also
bull httpshubdockercom_hello-world
bull httpsstoredockercomimageshello-world
bull httpsgithubcomdockerlabsblobmasterbeginnerchapterssetupmd
Contents
bull Image hello world
ndash Short Description
Fig 33 httpshubdockercom_hello-world
231321 Short Description
Hello World (an example of minimal Dockerization)
192 Chapter 23 Images Docker (Store Docker ex Hub docker)
CHAPTER
TWENTYFOUR
TUTORIELS DOCKER
See also
bull httpsdocsdockercom
bull httpsgithubcomdockerlabs
bull httpstwittercomDockerlistsdocker-captainsmembers
bull httpsgithubcomjpetazzocontainertraining
bull httpshackriotutorialslearn-docker
241 Avril 2018 container training from Jeacuterocircme Petazzoni
See also
bull httpsavril2018containertraining
bull Les conseils et formations de Jeacuterocircme Petazzoni
bull httpsgithubcomjpetazzocontainertraininggraphscontributors
bull httpsgithubcomjpetazzocontainertraining
2411 Intro Avril 2018
See also
bull httpsgithubcomjpetazzocontainertraining
bull httpsavril2018containertrainingintroymlhtml1
bull httpsavril2018containertrainingintroymlhtml16
bull Les conseils et formations de Jeacuterocircme Petazzoni
24111 Overview
See also
bull httpsgithubcomjpetazzocontainertraining
bull httpsavril2018containertrainingintroymlhtml1
bull httpsavril2018containertrainingintroymlhtml16
193
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull Les conseils et formations de Jeacuterocircme Petazzoni
Contents
bull Overview
ndash A brief introduction
ndash About these slides
ndash Docker 30000ft overview
ndash OK Why the buzz around containers
ndash Deployment becomes very complex
ndash Results
ndash Escape dependency hell
ndash On-board developers and contributors rapidly
ndash Implement reliable CI easily
ndash Use container images as build artefacts
ndash Decouple ldquoplumbingrdquo from application logic
ndash Formats and APIs before Docker
ndash Formats and APIs after Docker
ndash Shipping before Docker
ndash Shipping after Docker
ndash Example
ndash Devs vs Ops before Docker
ndash Devs vs Ops after Docker
241111 A brief introduction
See also
bull httpsavril2018containertrainingintroymlhtml3
bull httpsgithubcomjpetazzocontainertraininggraphscontributors
This was initially written to support in-person instructor-led workshops and tutorials
These materials are maintained by Jeacuterocircme Petazzoni and multiple contributors
You can also follow along on your own at your own pace
We included as much information as possible in these slides
We recommend having a mentor to help you
Or be comfortable spending some time reading the Docker documentation
And looking for answers in the Docker forums StackOverflow and other outlets
194 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241112 About these slides
See also
bull httpsavril2018containertrainingintroymlhtml5
All the content is available in a public GitHub repository
bull httpsgithubcomjpetazzocontainertraining
You can get updated ldquobuildsrdquo of the slides there
bull httpcontainertraining
Typos Mistakes Questions Feel free to hover over the bottom of the slide
241113 Docker 30000ft overview
See also
bull httpsavril2018containertrainingintroymlhtml17
In this lesson we will learn about
bull Why containers (non-technical elevator pitch)
bull Why containers (technical elevator pitch)
bull How Docker helps us to build ship and run
bull The history of containers
We wonrsquot actually run Docker or containers in this chapter (yet)
Donrsquot worry we will get to that fast enough
241114 OK Why the buzz around containers
See also
bull httpsavril2018containertrainingintroymlhtml19
The software industry has changed
Before
bull monolithic applications
bull long development cycles
bull single environment
bull slowly scaling up
Now
bull decoupled services
bull fast iterative improvements
bull multiple environments
bull quickly scaling out
241 Avril 2018 container training from Jeacuterocircme Petazzoni 195
Tutoriel Docker Release 2019-02-28T143129517726+0100
241115 Deployment becomes very complex
See also
bull httpsavril2018containertrainingintroymlhtml20
Many different stacks
bull languages
bull frameworks
bull databases
Many different targets
bull individual development environments
bull pre-production QA staging
bull production on prem cloud hybrid
241116 Results
See also
bull httpsavril2018containertrainingintroymlhtml28
bull Dev-to-prod reduced from 9 months to 15 minutes (ING)
bull Continuous integration job time reduced by more than 60 (BBC)
bull Deploy 100 times a day instead of once a week (GILT)
bull 70 infrastructure consolidation (MetLife)
bull 60 infrastructure consolidation (Intesa Sanpaolo)
bull 14x application density 60 of legacy datacenter migrated in 4 months (GE Appliances)
bull etc
241117 Escape dependency hell
See also
bull httpsavril2018containertrainingintroymlhtml30
bull Write installation instructions into an INSTALLtxt file
bull Using this file write an installsh script that works for you
bull Turn this file into a Dockerfile test it on your machine
bull If the Dockerfile builds on your machine it will build anywhere
bull Rejoice as you escape dependency hell and ldquoworks on my machinerdquo
Never again ldquoworked in dev - ops problem nowrdquo
196 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241118 On-board developers and contributors rapidly
See also
bull httpsavril2018containertrainingintroymlhtml31
bull Write Dockerfiles for your application component
bull Use pre-made images from the Docker Hub (mysql redis )
bull Describe your stack with a Compose file
bull On-board somebody with two commands
git clone docker-compose up
With this you can create development integration QA environments in minutes
241119 Implement reliable CI easily
See also
bull httpsavril2018containertrainingintroymlhtml32
bull Build test environment with a Dockerfile or Compose file
bull For each test run stage up a new container or stack
bull Each run is now in a clean environment
bull No pollution from previous tests
Way faster and cheaper than creating VMs each time
2411110 Use container images as build artefacts
See also
bull httpsavril2018containertrainingintroymlhtml33
bull Build your app from Dockerfiles
bull Store the resulting images in a registry
bull Keep them forever (or as long as necessary)
bull Test those images in QA CI integration
bull Run the same images in production
bull Something goes wrong Rollback to previous image
bull Investigating old regression Old image has your back
Images contain all the libraries dependencies etc needed to run the app
241 Avril 2018 container training from Jeacuterocircme Petazzoni 197
Tutoriel Docker Release 2019-02-28T143129517726+0100
2411111 Decouple ldquoplumbingrdquo from application logic
See also
bull httpsavril2018containertrainingintroymlhtml34
bull Write your code to connect to named services (ldquodbrdquo ldquoapirdquo )
bull Use Compose to start your stack
bull Docker will setup per-container DNS resolver for those names
bull You can now scale add load balancers replication without changing your code
Note this is not covered in this intro level workshop
2411112 Formats and APIs before Docker
See also
bull httpsavril2018containertrainingintroymlhtml36
bull No standardized exchange format (No a rootfs tarball is not a format)
bull Containers are hard to use for developers (Wherersquos the equivalent of docker run debian)
bull As a result they are hidden from the end users
bull No re-usable components APIs tools (At best VM abstractions eg libvirt)
Analogy
bull Shipping containers are not just steel boxes
bull They are steel boxes that are a standard size with the same hooks and holes
2411113 Formats and APIs after Docker
See also
bull httpsavril2018containertrainingintroymlhtml37
bull Standardize the container format because containers were not portable
bull Make containers easy to use for developers
bull Emphasis on re-usable components APIs ecosystem of standard tools
bull Improvement over ad-hoc in-house specific tools
2411114 Shipping before Docker
See also
bull httpsavril2018containertrainingintroymlhtml38
bull Ship packages deb rpm gem jar homebrew
bull Dependency hell
bull ldquoWorks on my machinerdquo
bull Base deployment often done from scratch (debootstrap ) and unreliable
198 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
2411115 Shipping after Docker
See also
bull httpsavril2018containertrainingintroymlhtml39
bull Ship container images with all their dependencies
bull Images are bigger but they are broken down into layers
bull Only ship layers that have changed
bull Save disk network memory usage
2411116 Example
See also
bull httpsavril2018containertrainingintroymlhtml40
Layers
bull CentOS
bull JRE
bull Tomcat
bull Dependencies
bull Application JAR
bull Configuration
2411117 Devs vs Ops before Docker
See also
bull httpsavril2018containertrainingintroymlhtml41
bull Drop a tarball (or a commit hash) with instructions
bull Dev environment very different from production
bull Ops donrsquot always have a dev environment themselves
bull and when they do it can differ from the devsrsquo
bull Ops have to sort out differences and make it work
bull or bounce it back to devs
bull Shipping code causes frictions and delays
2411118 Devs vs Ops after Docker
See also
bull httpsavril2018containertrainingintroymlhtml42
bull Drop a container image or a Compose file
bull Ops can always run that container image
241 Avril 2018 container training from Jeacuterocircme Petazzoni 199
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull Ops can always run that Compose file
bull Ops still have to adapt to prod environment but at least they have a reference point
bull Ops have tools allowing to use the same image in dev and prod
bull Devs can be empowered to make releases themselves more easily
24112 History of containers and Docker
See also
bull httpsavril2018containertrainingintroymlhtml44
bull httpsavril2018containertrainingintroymlhtml1
bull Les conseils et formations de Jeacuterocircme Petazzoni
Contents
bull History of containers and Docker
ndash First experimentations
ndash The VPS age (until 2007-2008)
ndash Containers = cheaper than VMs
ndash The PAAS period (2008-2013)
ndash Containers = easier than VMs
ndash First public release of Docker
ndash Docker early days (2013-2014)
ndash First users of Docker
ndash Positive feedback loop
ndash Maturity (2015-2016)
ndash Docker becomes an industry standard
ndash Docker becomes a platform
241121 First experimentations
See also
bull httpsavril2018containertrainingintroymlhtml46
bull IBM VM370 (1972)
bull Linux VServers (2001)
bull Solaris Containers (2004)
bull FreeBSD jails (1999)
Containers have been around for a very long time indeed
200 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241122 The VPS age (until 2007-2008)
See also
bull httpsavril2018containertrainingintroymlhtml47
241123 Containers = cheaper than VMs
See also
bull httpsavril2018containertrainingintroymlhtml48
bull Users hosting providers
bull Highly specialized audience with strong ops culture
241124 The PAAS period (2008-2013)
See also
bull httpsavril2018containertrainingintroymlhtml49
241125 Containers = easier than VMs
See also
bull httpsavril2018containertrainingintroymlhtml50
bull I canrsquot speak for Heroku but containers were (one of) dotCloudrsquos secret weapon
bull dotCloud was operating a PaaS using a custom container engine
bull This engine was based on OpenVZ (and later LXC) and AUFS
bull It started (circa 2008) as a single Python script
241 Avril 2018 container training from Jeacuterocircme Petazzoni 201
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull By 2012 the engine had multiple (~10) Python components
bull (and ~100 other micro-services)
bull End of 2012 dotCloud refactors this container engine
The codename for this project is Docker
241126 First public release of Docker
See also
bull httpsavril2018containertrainingintroymlhtml51
bull March 2013 PyCon Santa Clara ldquoDockerrdquo is shown to a public audience for the first time
bull It is released with an open source license
bull Very positive reactions and feedback
bull The dotCloud team progressively shifts to Docker development
bull The same year dotCloud changes name to Docker
bull In 2014 the PaaS activity is sold
241127 Docker early days (2013-2014)
See also
bull httpsavril2018containertrainingintroymlhtml52
202 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241128 First users of Docker
See also
bull httpsavril2018containertrainingintroymlhtml53
bull PAAS builders (Flynn Dokku Tsuru Deis )
bull PAAS users (those big enough to justify building their own)
bull CI platforms
bull developers developers developers developers
241129 Positive feedback loop
See also
bull httpsavril2018containertrainingintroymlhtml54
bull In 2013 the technology under containers (cgroups namespaces copy-on-write storage ) had many blindspots
bull The growing popularity of Docker and containers exposed many bugs
bull As a result those bugs were fixed resulting in better stability for containers
bull Any decent hostingcloud provider can run containers today
bull Containers become a great tool to deploymove workloads tofrom on-premcloud
2411210 Maturity (2015-2016)
See also
bull httpsavril2018containertrainingintroymlhtml55
2411211 Docker becomes an industry standard
See also
bull httpsavril2018containertrainingintroymlhtml56
bull Docker reaches the symbolic 10 milestone
bull Existing systems like Mesos and Cloud Foundry add Docker support
bull Standardization around the OCI (Open Containers Initiative)
bull Other container engines are developed
bull Creation of the CNCF (Cloud Native Computing Foundation)
2411212 Docker becomes a platform
See also
bull httpsavril2018containertrainingintroymlhtml56
241 Avril 2018 container training from Jeacuterocircme Petazzoni 203
Tutoriel Docker Release 2019-02-28T143129517726+0100
The initial container engine is now known as Docker Engine
Other tools are added
bull Docker Compose (formerly ldquoFigrdquo)
bull Docker Machine
bull Docker Swarm
bull Kitematic
bull Docker Cloud (formerly ldquoTutumrdquo)
bull Docker Datacenter
bull etc
Docker Inc launches commercial offers
2412 Chapter1 Avril 2018
See also
bull httpsavril2018containertrainingintroymlhtml7
bull httpsavril2018containertrainingintroymlhtml16
bull Les conseils et formations de Jeacuterocircme Petazzoni
2413 Chapter2 Avril 2018 container training
See also
bull httpsavril2018containertrainingintroymlhtml8
bull Les conseils et formations de Jeacuterocircme Petazzoni
24131 Our first containers
See also
bull httpsavril2018containertrainingintroymlhtml79
bull Les conseils et formations de Jeacuterocircme Petazzoni
Contents
bull Our first containers
ndash Hello World
ndash Starting another container
204 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241311 Hello World
See also
bull httpsavril2018containertrainingintroymlhtml82
bull docker run
docker run busybox echo hello world
Unable to find image busyboxlatest locallylatest Pulling from librarybusybox07a152489297 Pull completeDigest sha256141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47Status Downloaded newer image for busyboxlatesthello world
241312 Starting another container
See also
bull httpsavril2018containertrainingintroymlhtml92
24132 Backgroud containers
Contents
bull Backgroud containers
ndash Objectives
ndash A non-interactive container
ndash Run a container in the background
ndash List running containers
ndash View only the IDs of the containers
ndash Combining flags
ndash View the logs of a container
ndash View only the tail of the logs
ndash Follow the logs in real time
ndash Stop our container
ndash Stopping our containers
ndash Killing the remaining containers
241321 Objectives
Our first containers were interactive
241 Avril 2018 container training from Jeacuterocircme Petazzoni 205
Tutoriel Docker Release 2019-02-28T143129517726+0100
We will now see how to
bull Run a non-interactive container
bull Run a container in the background
bull List running containers
bull Check the logs of a container
bull Stop a container
bull List stopped containers
241322 A non-interactive container
See also
bull httpsavril2018containertrainingintroymlhtml97
$ docker run jpetazzoclock
Unable to find image jpetazzoclocklatest locallylatest Pulling from jpetazzoclocka3ed95caeb02 Pull complete1db09adb5ddd Pull completeDigest sha256446edaa1594798d89ee2a93f660161b265db91b026491e4671c14371eff5eea0Status Downloaded newer image for jpetazzoclocklatestWed May 30 083423 UTC 2018Wed May 30 083424 UTC 2018Wed May 30 083425 UTC 2018Wed May 30 083426 UTC 2018Wed May 30 083427 UTC 2018Wed May 30 083428 UTC 2018Wed May 30 083429 UTC 2018
241323 Run a container in the background
See also
bull httpsavril2018containertrainingintroymlhtml98
Containers can be started in the background with the -d flag (daemon mode)
$ docker run -d jpetazzoclock
36935b2a967fd69c7fa23788e00855baa1896cc4af111fb78b9cfcc70a4d409c
bull We donrsquot see the output of the container
bull But donrsquot worry Docker collects that output and logs it
bull Docker gives us the ID of the container
241324 List running containers
See also
206 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull httpsavril2018containertrainingintroymlhtml99
bull docker ps
$ docker ps
CONTAINER ID IMAGE COMMAND CREATEDrarr˓STATUS PORTS NAMES36935b2a967f jpetazzoclock binsh -c while d 3 minutes agorarr˓ Up 3 minutes lucid_kapitsa
Docker tells us
bull The (truncated) ID of our container
bull The image used to start the container
bull That our container has been running (Up) for a couple of minutes
bull Other information (COMMAND PORTS NAMES) that we will explain later
241325 View only the IDs of the containers
See also
bull httpsavril2018containertrainingintroymlhtml102
bull docker ps
Many Docker commands will work on container IDs docker stop docker rm
If we want to list only the IDs of our containers (without the other colums or the header line) we can use the -q(ldquoQuietrdquo ldquoQuickrdquo) flag
docker ps -q
241326 Combining flags
See also
bull httpsavril2018containertrainingintroymlhtml102
bull docker ps
We can combine -l and -q to see only the ID of the last container started
$ docker ps -lq
3c181d8dbc4c
At a first glance it looks like this would be particularly useful in scripts
However if we want to start a container and get its ID in a reliable way it is better to use docker run -d which we willcover in a bit
241 Avril 2018 container training from Jeacuterocircme Petazzoni 207
Tutoriel Docker Release 2019-02-28T143129517726+0100
241327 View the logs of a container
See also
bull httpsavril2018containertrainingintroymlhtml104
bull docker logs
We told you that Docker was logging the container output
Letrsquos see that now
docker logs 3c18
Wed May 30 084915 UTC 2018Wed May 30 084916 UTC 2018Wed May 30 084917 UTC 2018Wed May 30 084918 UTC 2018Wed May 30 084919 UTC 2018Wed May 30 084920 UTC 2018Wed May 30 084921 UTC 2018Wed May 30 084922 UTC 2018Wed May 30 084923 UTC 2018Wed May 30 084924 UTC 2018Wed May 30 084925 UTC 2018Wed May 30 084926 UTC 2018Wed May 30 084927 UTC 2018
241328 View only the tail of the logs
See also
bull httpsavril2018containertrainingintroymlhtml104
bull docker logs
To avoid being spammed with eleventy pages of output we can use the ndashtail option
$ docker logs 3c18 --tail 3
Wed May 30 090229 UTC 2018Wed May 30 090230 UTC 2018Wed May 30 090231 UTC 2018
The parameter is the number of lines that we want to see
241329 Follow the logs in real time
See also
bull httpsavril2018containertrainingintroymlhtml106
bull docker logs
Just like with the standard UNIX command tail -f we can follow the logs of our container
$ docker logs --follow 3c18 --tail 1
208 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
Wed May 30 090711 UTC 2018Wed May 30 090712 UTC 2018Wed May 30 090713 UTC 2018Wed May 30 090714 UTC 2018Wed May 30 090715 UTC 2018
bull This will display the last line in the log file
bull Then it will continue to display the logs in real time
bull Use ^C to exit
2413210 Stop our container
See also
bull httpsavril2018containertrainingintroymlhtml107
bull docker stop
There are two ways we can terminate our detached container
bull Killing it using the docker kill command
bull Stopping it using the docker stop command
The first one stops the container immediately by using the KILL signal
The second one is more graceful It sends a TERM signal and after 10 seconds if the container has not stopped itsends KILL
Reminder the KILL signal cannot be intercepted and will forcibly terminate the container
2413211 Stopping our containers
See also
bull httpsavril2018containertrainingintroymlhtml108
bull docker stop
Letrsquos stop one of those containers
$ docker stop 3c1
3c1
This will take 10 seconds
bull Docker sends the TERM signal
bull the container doesnrsquot react to this signal (itrsquos a simple Shell script with no special signal handling)
bull 10 seconds later since the container is still running Docker sends the KILL signal
bull this terminates the container
241 Avril 2018 container training from Jeacuterocircme Petazzoni 209
Tutoriel Docker Release 2019-02-28T143129517726+0100
2413212 Killing the remaining containers
See also
bull httpsavril2018containertrainingintroymlhtml109
bull docker stop
Letrsquos be less patient with the two other containers
$ docker stop 1fe 369
1fe369
The stop and kill commands can take multiple container IDs
Those containers will be terminated immediately (without the 10 seconds delay)
Letrsquos check that our containers donrsquot show up anymore
$ docker ps
CONTAINER ID IMAGE COMMAND CREATEDrarr˓STATUS PORTS NAMES
24133 Restarting and attaching to containers
Contents
bull Restarting and attaching to containers
ndash Introduction
ndash Background and foreground
ndash Detaching from a container
ndash Specifying a custom detach sequence
ndash Attaching to a container
ndash Detaching from non-interactive containers
ndash Restarting a container
241331 Introduction
See also
bull httpsavril2018containertrainingintroymlhtml112
We have started containers in the foreground and in the background
In this chapter we will see how to
bull Put a container in the background
210 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull Attach to a background container to bring it to the foreground
bull Restart a stopped container
241332 Background and foreground
See also
bull httpsavril2018containertrainingintroymlhtml114
The distinction between foreground and background containers is arbitrary
From Dockerrsquos point of view all containers are the same
All containers run the same way whether there is a client attached to them or not
It is always possible to detach from a container and to reattach to a container
Analogy attaching to a container is like plugging a keyboard and screen to a physical server
241333 Detaching from a container
See also
bull httpsavril2018containertrainingintroymlhtml115
If you have started an interactive container (with option -it) you can detach from it
The ldquodetachrdquo sequence is ^P^Q
Otherwise you can detach by killing the Docker client
(But not by hitting ^C as this would deliver SIGINT to the container)
What does -it stand for
bull -t means ldquoallocate a terminalrdquo
bull -i means ldquoconnect stdin to the terminalrdquo
241334 Specifying a custom detach sequence
See also
bull httpsavril2018containertrainingintroymlhtml116
bull You donrsquot like ^P^Q No problem
bull You can change the sequence with docker run ndashdetach-keys
bull This can also be passed as a global option to the engine
Start a container with a custom detach command
$ docker run -ti --detach-keys ctrl-xx jpetazzoclock
Detach by hitting ^X x (This is ctrl-x then x not ctrl-x twice)
Check that our container is still running
$ docker ps -l
241 Avril 2018 container training from Jeacuterocircme Petazzoni 211
Tutoriel Docker Release 2019-02-28T143129517726+0100
CONTAINER ID IMAGE COMMAND CREATEDrarr˓STATUS PORTS NAMES16c9e8ab42c3 jpetazzoclock binsh -c while d 26 seconds agorarr˓ Up 24 seconds unruffled_joliot
241335 Attaching to a container
See also
bull httpsavril2018containertrainingintroymlhtml117
You can attach to a container
$ docker attach ltcontainerIDgt
The container must be running There can be multiple clients attached to the same container If you donrsquot specifyndashdetach-keys when attaching it defaults back to ^P^Q
Try it on our previous container
$ docker attach $(docker ps -lq)
Check that ^X x doesnrsquot work but ^P ^Q does
241336 Detaching from non-interactive containers
See also
bull httpsavril2018containertrainingintroymlhtml118
Warning if the container was started without -it
bull You wonrsquot be able to detach with ^P^Q
bull If you hit ^C the signal will be proxied to the container
Remember you can always detach by killing the Docker client
241337 Restarting a container
When a container has exited it is in stopped state
It can then be restarted with the start command
$ docker start ltyourContainerIDgt
The container will be restarted using the same options you launched it with
You can re-attach to it if you want to interact with it
$ docker attach ltyourContainerIDgt
Use docker ps -a to identify the container ID of a previous jpetazzoclock container and try those commands
212 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
24134 Understanding Docker images
See also
bull httpsavril2018containertrainingintroymlhtml124
Contents
bull Understanding Docker images
ndash Objectives
ndash What is an image
ndash Differences between containers and images
ndash Object-oriented programming
ndash Wait a minute
ndash Creating the first images
ndash Creating other images
docker commit
docker build
ndash Images namespaces
ndash Root namespace
ndash User namespace
ndash Self-Hosted namespace
ndash How do you store and manage images
ndash Showing current images
ndash Searching for images
ndash Downloading images
ndash Pulling an image
ndash Image and tags
ndash When to (not) use tags
Donrsquot specify tags
Do specify tags
ndash Section summary
241341 Objectives
In this section we will explain
bull What is an image
bull What is a layer
bull The various image namespaces
241 Avril 2018 container training from Jeacuterocircme Petazzoni 213
Tutoriel Docker Release 2019-02-28T143129517726+0100
bull How to search and download images
bull Image tags and when to use them
241342 What is an image
See also
bull httpsavril2018containertrainingintroymlhtml127
Image = files + metadata
These files form the root filesystem of our container
The metadata can indicate a number of things eg
bull the author of the image
bull the command to execute in the container when starting it
bull environment variables to be set
bull etc
Images are made of layers conceptually stacked on top of each other
Each layer can add change and remove files andor metadata
Images can share layers to optimize disk usage transfer times and memory use
241343 Differences between containers and images
See also
bull httpsavril2018containertrainingintroymlhtml129
bull An image is a read-only filesystem
bull A container is an encapsulated set of processes running in a read-write copy of that filesystem
bull To optimize container boot time copy-on-write is used instead of regular copy
bull docker run starts a container from a given image
Letrsquos give a couple of metaphors to illustrate those concepts
241344 Object-oriented programming
See also
bull httpsavril2018containertrainingintroymlhtml131
bull Images are conceptually similar to classes
bull Layers are conceptually similar to inheritance
bull Containers are conceptually similar to instances
214 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241345 Wait a minute
See also
bull httpsavril2018containertrainingintroymlhtml132
If an image is read-only how do we change it
bull We donrsquot
bull We create a new container from that image
bull Then we make changes to that container
bull When we are satisfied with those changes we transform them into a new layer
bull A new image is created by stacking the new layer on top of the old image
241346 Creating the first images
See also
bull httpsavril2018containertrainingintroymlhtml134
There is a special empty image called scratch It allows to build from scratch
The docker import command loads a tarball into Docker
bull The imported tarball becomes a standalone image
bull That new image has a single layer
241347 Creating other images
See also
bull httpsavril2018containertrainingintroymlhtml135
docker commit
bull Saves all the changes made to a container into a new layer
bull Creates a new image (effectively a copy of the container)
docker build
bull Performs a repeatable build sequence
bull This is the preferred method
We will explain both methods in a moment
241 Avril 2018 container training from Jeacuterocircme Petazzoni 215
Tutoriel Docker Release 2019-02-28T143129517726+0100
241348 Images namespaces
See also
bull httpsavril2018containertrainingintroymlhtml136
There are three namespaces
bull Official images
ndash eg ubuntu busybox
bull User (and organizations) images
ndash eg jpetazzoclock
bull Self-hosted images
ndash eg registryexamplecom5000my-privateimage
Letrsquos explain each of them
241349 Root namespace
See also
bull httpsavril2018containertrainingintroymlhtml137
The root namespace is for official images They are put there by Docker Inc but they are generally authored andmaintained by third parties
Those images include
bull Small ldquoswiss-army-kniferdquo images like busybox
bull Distro images to be used as bases for your builds like ubuntu fedora
bull Ready-to-use components and services like redis postgresql
2413410 User namespace
See also
bull httpsavril2018containertrainingintroymlhtml138
The user namespace holds images for Docker Hub users and organizations
For example
bull jpetazzoclock
The Docker Hub user is
bull jpetazzo
The image name is
bull clock
216 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
2413411 Self-Hosted namespace
See also
bull httpsavril2018containertrainingintroymlhtml139
This namespace holds images which are not hosted on Docker Hub but on third party registries
They contain the hostname (or IP address) and optionally the port of the registry server
For example
bull localhost5000wordpress
bull localhost5000 is the host and port of the registry
bull wordpress is the name of the image
2413412 How do you store and manage images
See also
bull httpsavril2018containertrainingintroymlhtml140
Images can be stored
bull On your Docker host
bull In a Docker registry
You can use the Docker client to download (pull) or upload (push) images
To be more accurate you can use the Docker client to tell a Docker Engine to push and pull images to and from aregistry
2413413 Showing current images
See also
bull httpsavril2018containertrainingintroymlhtml141
Letrsquos look at what images are on our host now
docker images
REPOSITORY TAG IMAGE ID CREATEDrarr˓ SIZEch4-message-board-app_web latest 376512737492 21 hours agorarr˓ 104GBgdevopsdjango36_ch4 latest b44a8c214cdf 22 hours agorarr˓ 104GBpostgres 104 61d053fc271c 4 days agorarr˓ 236MBbusybox latest 8c811b4aec35 6 days agorarr˓ 115MBpython 36 29d2f3226daf 3 weeks agorarr˓ 911MBubuntu latest 452a96d81c30 4 weeks agorarr˓ 796MBjpetazzoclock latest 12068b93616f 3 years agorarr˓ 243MB (continues on next page)
241 Avril 2018 container training from Jeacuterocircme Petazzoni 217
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
2413414 Searching for images
See also
bull httpsavril2018containertrainingintroymlhtml142
We cannot list all images on a remote registry but we can search for a specific keyword
$ docker search marathon
NAME DESCRIPTIONrarr˓ STARS OFFICIAL AUTOMATEDmesospheremarathon A cluster-wide init and control system forrarr˓s 106 [OK]mesoscloudmarathon Marathonrarr˓ 31 [OK]mesospheremarathon-lb Script to update haproxy based on marathonrarr˓s 22 [OK]mesospheremarathon-lb-autoscale Autoscale your apps on Marathonrarr˓ 5 [OK]thefactorymarathon Tagged images of each Mesos Marathon releaserarr˓ 4 [OK]brndnmtthwsmarathon-lb-autoscale Marathon-lb autoscale demorarr˓ 3 [OK]mesoscloudhaproxy-marathon [DEPRECATED] Generate HAProxy configurationrarr˓ 3 [OK]f5networksmarathon-asp-ctlr Official container repository for F5rarr˓Maratho 3bobrikmarathon-tcp-haproxyrarr˓ 2 [OK]tobilgmarathon-slack Listen to Marathons Event Bus and sendrarr˓sele 2 [OK]f5networksdevelmarathon-bigip-ctlr Container repository for development imagesrarr˓ 1tobilggitlab-ci-runner-marathon A customized Docker image for runningrarr˓scalab 1 [OK]eduser25pg-marathon-watcher PG Marathon watcher application for Marathorarr˓ 1vidazoohubmarathon-rabbit-autoscale autoscale marathon tasks based on rabbitmqrarr˓q 1 [OK]gettyimagesmarathon_exporter Marathon metrics exporter for Prometheusrarr˓ 0skytixmarathon-consul Consul service registration daemon thatrarr˓moni 0hewwmarathon-dns dns for marathon appsrarr˓ 0jeffdecolaresource-marathon-deploy A Concourse resource type that deploys anrarr˓AP 0ryanmehtamarathon-resourcerarr˓ 0praekeltfoundationmarathon-acme Automatically manage ACME certificates forrarr˓a 0 [OK]ckaznochamarathon-resource A Concourse resource to deploy applicationsrarr˓ 0
(continues on next page)
218 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
quintoandardrone-marathon Drone plugin to create marathon deploymentsrarr˓ 0 [OK]jamiecressey89marathon-zookeeper Zookeeper image that uses Marathons APIrarr˓for 0 [OK]alenkaczmarathon-rabbitmq-autoscale Autoscaling capabilities for apps runningrarr˓in 0 [OK]mrbobbytablesmarathon Marathon Mesos Framework containerrarr˓ 0 [OK]
bull ldquoStarsrdquo indicate the popularity of the image
bull ldquoOfficialrdquo images are those in the root namespace
bull ldquoAutomatedrdquo images are built automatically by the Docker Hub
(This means that their build recipe is always available)
2413415 Downloading images
See also
bull httpsavril2018containertrainingintroymlhtml143
There are two ways to download images
bull Explicitly with docker pull
bull Implicitly when executing docker run and the image is not found locally
2413416 Pulling an image
See also
bull httpsavril2018containertrainingintroymlhtml144
$ docker pull debianjessie
jessie Pulling from librarydebian3d77ce4481b1 Pull completeDigest sha256f29d0c98d94d6b2169c740d498091a9a8545fabfa37f2072b43a4361c10064fcStatus Downloaded newer image for debianjessie
In this example jessie indicates which exact version of Debian we would like It is a version tag
2413417 Image and tags
See also
bull httpsavril2018containertrainingintroymlhtml145
bull Images can have tags
bull Tags define image versions or variants
bull docker pull ubuntu will refer to ubuntulatest
bull The latest tag is generally updated often
241 Avril 2018 container training from Jeacuterocircme Petazzoni 219
Tutoriel Docker Release 2019-02-28T143129517726+0100
2413418 When to (not) use tags
See also
bull httpsavril2018containertrainingintroymlhtml146
Donrsquot specify tags
bull When doing rapid testing and prototyping
bull When experimenting
bull When you want the latest version
Do specify tags
bull When recording a procedure into a script
bull When going to production
bull To ensure that the same version will be used everywhere
bull To ensure repeatability later
2413419 Section summary
See also
bull httpsavril2018containertrainingintroymlhtml147
Wersquove learned how to
bull Understand images and layers
bull Understand Docker image namespacing
bull Search and download images
2414 Chapter3 Avril 2018
See also
bull httpsavril2018containertrainingintroymlhtml9
bull Les conseils et formations de Jeacuterocircme Petazzoni
24141 Building images interactively
See also
bull httpsavril2018containertrainingintroymlhtml149
bull Les conseils et formations de Jeacuterocircme Petazzoni
220 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
Contents
bull Building images interactively
ndash Building images interactively
ndash The plan
ndash Setting up our container
ndash Inspect the changes
ndash Docker tracks filesystem changes
ndash Copy-on-write security benefits
ndash Commit our changes into a new image
ndash Testing our new image
ndash Tagging images
ndash Whatrsquos next
241411 Building images interactively
See also
bull httpsavril2018containertrainingintroymlhtml150
In this section we will create our first container image
It will be a basic distribution image but we will pre-install the package figlet
We will
bull Create a container from a base image
bull Install software manually in the container and turn it into a new image
bull Learn about new commands
ndash docker commit
ndash docker tag
ndash and docker diff
241412 The plan
See also
bull httpsavril2018containertrainingintroymlhtml151
bull Create a container (with docker run) using our base distro of choice
bull Run a bunch of commands to install and set up our software in the container
bull (Optionally) review changes in the container with docker diff
bull Turn the container into a new image with docker commit
bull (Optionally) add tags to the image with docker tag
241 Avril 2018 container training from Jeacuterocircme Petazzoni 221
Tutoriel Docker Release 2019-02-28T143129517726+0100
241413 Setting up our container
See also
bull httpsavril2018containertrainingintroymlhtml152
Start an Ubuntu container
$ docker run -it ubuntu
root5d5da832b81a
rootltyourContainerIdgt
root5d5da832b81a apt-get update
Get1 httparchiveubuntucomubuntu bionic InRelease [242 kB]Get2 httparchiveubuntucomubuntu bionic-updates InRelease [832 kB]Get3 httparchiveubuntucomubuntu bionic-backports InRelease [655 kB]Get4 httparchiveubuntucomubuntu bionicuniverse Sources [115 MB]Get5 httpsecurityubuntucomubuntu bionic-security InRelease [832 kB]Get6 httpsecurityubuntucomubuntu bionic-securityuniverse Sources [3786 B]Get7 httpsecurityubuntucomubuntu bionic-securitymain amd64 Packages [886 kB]Get8 httpsecurityubuntucomubuntu bionic-securityuniverse amd64 Packages [188rarr˓kB]Get9 httpsecurityubuntucomubuntu bionic-securitymultiverse amd64 Packagesrarr˓[1066 B]Get10 httparchiveubuntucomubuntu bionicuniverse amd64 Packages [113 MB]Get11 httparchiveubuntucomubuntu bionicmultiverse amd64 Packages [186 kB]Get12 httparchiveubuntucomubuntu bionicrestricted amd64 Packages [135 kB]Get13 httparchiveubuntucomubuntu bionicmain amd64 Packages [1344 kB]Get14 httparchiveubuntucomubuntu bionic-updatesuniverse Sources [287 kB]Get15 httparchiveubuntucomubuntu bionic-updatesuniverse amd64 Packages [793rarr˓kB]Get16 httparchiveubuntucomubuntu bionic-updatesmultiverse amd64 Packagesrarr˓[1660 B]Get17 httparchiveubuntucomubuntu bionic-updatesmain amd64 Packages [127 kB]Fetched 252 MB in 17s (1527 kBs)Reading package lists Done
root5d5da832b81a apt-get install figlet
Reading package lists DoneBuilding dependency treeReading state information DoneThe following NEW packages will be installed
figlet0 upgraded 1 newly installed 0 to remove and 11 not upgradedNeed to get 133 kB of archivesAfter this operation 752 kB of additional disk space will be usedGet1 httparchiveubuntucomubuntu bionicuniverse amd64 figlet amd64 225-3rarr˓[133 kB]Fetched 133 kB in 0s (382 kBs)debconf delaying package configuration since apt-utils is not installedSelecting previously unselected package figlet(Reading database 4035 files and directories currently installed)Preparing to unpack figlet_225-3_amd64deb
(continues on next page)
222 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
(continued from previous page)
Unpacking figlet (225-3) Setting up figlet (225-3) update-alternatives using usrbinfiglet-figlet to provide usrbinfiglet (figlet)rarr˓in auto modeupdate-alternatives warning skip creation of usrsharemanman6figlet6gzrarr˓because associated file usrsharemanman6figlet-figlet6gz (of link grouprarr˓figlet) doesnt exist
241414 Inspect the changes
See also
bull httpsavril2018containertrainingintroymlhtml153
bull Open a new session into the docker server
bull type docker ps to get the container id
[rootintranet-dev ~] docker ps
CONTAINER ID IMAGE COMMAND CREATEDrarr˓STATUS PORTS NAMES814973c3cf61 ubuntu binbash About a minute ago Uprarr˓About a minute sharp_minsky
Now letrsquos run docker diff to see the difference between the base image and our container
[rootintranet-dev ~] docker diff 814
C usrC usrshareA usrsharefigletA usrsharefiglet646-cnflcA usrsharefiglet646-deflcA usrsharefiglet646-gbflcA usrsharefiglet646-ptflcA usrsharefiglet8859-3flcA usrsharefiglet8859-4flcA usrsharefigletkoi8rflcA usrsharefigletscriptflfA usrsharefigletushebrewflcA usrsharefiglet646-es2flcA usrsharefiglet646-huflcA usrsharefiglet646-noflcA usrsharefiglet646-yuflcA usrsharefigletivritflfA usrsharefiglet646-irvflcA usrsharefigletfrangoflc
241415 Docker tracks filesystem changes
See also
bull httpsavril2018containertrainingintroymlhtml154
241 Avril 2018 container training from Jeacuterocircme Petazzoni 223
Tutoriel Docker Release 2019-02-28T143129517726+0100
As explained before
bull An image is read-only
bull When we make changes they happen in a copy of the image
bull Docker can show the difference between the image and its copy
For performance Docker uses copy-on-write systems (ie starting a container based on a big image doesnrsquot incur ahuge copy)
241416 Copy-on-write security benefits
See also
bull httpsavril2018containertrainingintroymlhtml155
bull docker diff gives us an easy way to audit changes (agrave la Tripwire)
bull Containers can also be started in read-only mode (their root filesystem will be read-only but they can still haveread-write data volumes)
241417 Commit our changes into a new image
See also
bull httpsavril2018containertrainingintroymlhtml156
The docker commit command will create a new layer with those changes and a new image using this new layer
$ docker commit 814
sha256c10a9dbc718b49ba25af4fcd99d57c0fddd1dcd87d3ab8f878caaeb135b4521f
The output of the docker commit command will be the ID for your newly created image
We can use it as an argument to docker run
241418 Testing our new image
See also
bull httpsavril2018containertrainingintroymlhtml157
Letrsquos run this image
$ docker run -it c10a
rootd73eb40949d3 figlet hello_ _ _
| |__ ___| | | ___| _ _ | | _ | | | | __ | | (_) ||_| |_|___|_|_|___
224 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241419 Tagging images
See also
bull httpsavril2018containertrainingintroymlhtml158
Referring to an image by its ID is not convenient Letrsquos tag it instead
We can use the tag command
$ docker tag c10a figlet
But we can also specify the tag as an extra argument to commit
$ docker commit c10a figlet
And then run it using its tag
$ docker run -it figlet
2414110 Whatrsquos next
See also
bull httpsavril2018containertrainingintroymlhtml159
Manual process = bad Automated process = good
In the next chapter we will learn how to automate the build process by writing a Dockerfile
24142 Building Docker images with a Dockerfile
See also
bull httpsavril2018containertrainingintroymlhtml161
bull Les conseils et formations de Jeacuterocircme Petazzoni
Contents
bull Building Docker images with a Dockerfile
ndash Objectives
ndash Dockerfile overview
ndash Writing our first Dockerfile
ndash Type this into our Dockerfile
ndash Build it
ndash What happens when we build the image
ndash Sending the build context to Docker
ndash Executing each step
ndash The caching system
241 Avril 2018 container training from Jeacuterocircme Petazzoni 225
Tutoriel Docker Release 2019-02-28T143129517726+0100
ndash Running the image
ndash Using image and viewing history
ndash Introducing JSON syntax
ndash JSON syntax vs string syntax
ndash When to use JSON syntax and string syntax
String syntax
JSON syntax
241421 Objectives
See also
bull httpsavril2018containertrainingintroymlhtml163
We will build a container image automatically with a Dockerfile
At the end of this lesson you will be able to
bull Write a Dockerfile
bull Build an image from a Dockerfile
241422 Dockerfile overview
See also
bull httpsavril2018containertrainingintroymlhtml164
bull A Dockerfile is a build recipe for a Docker image
bull It contains a series of instructions telling Docker how an image is constructed
bull The docker build command builds an image from a Dockerfile
241423 Writing our first Dockerfile
See also
bull httpsavril2018containertrainingintroymlhtml165
Our Dockerfile must be in a new empty directory
1 Create a directory to hold our Dockerfile
bull $ mkdir myimage
2 Create a Dockerfile inside this directory
bull $ cd myimage
bull $ vim Dockerfile
Of course you can use any other editor of your choice
226 Chapter 24 Tutoriels Docker
Tutoriel Docker Release 2019-02-28T143129517726+0100
241424 Type this into our Dockerfile
See also
bull httpsavril2018containertrainingintroymlhtml166
FROM ubuntuRUN apt-get updateRUN apt-get install figlet
bull FROM indicates the base image for our build
bull Each RUN line will be executed by Docker during the build
bull Our RUN commands must be non-interactive (No input can be provided to Docker during the build)
In many cases we will add the -y flag to apt-get
241425 Build it
See also
bull httpsavril2018containertrainingintroymlhtml167
Save our file then execute
$ docker build -t figlet
bull -t indicates the tag to apply to the image
bull indicates the location of the build context
We will talk more about the build context later
To keep things simple for now this is the directory where our Dockerfile is located
241426 What happens when we build the image
The output of docker build looks like this
docker build -t figlet
Sending build context to Docker daemon 2048kBStep 13 FROM ubuntulatest Pulling from libraryubuntua48c500ed24e Already exists1e1de00ff7e1 Already exists0330ca45a200 Already exists471db38bcfbf Already exists0b4aba487617 Already existsDigest sha256c8c275751219dadad8fa56b3ac41ca6cb22219ff117ca98fe82b42f24e1ba64eStatus Downloaded newer image for ubuntulatest---gt 452a96d81c30
Step 23 RUN apt-get update---gt Running in 81dab184c747
Get1 httparchiveubuntucomubuntu bionic InRelease [242 kB]Get2 httparchiveubuntucomubuntu bionic-updates InRelease [832 kB]Get3 httparchiveubuntucomubuntu bionic-backports InRelease [655 kB]
(continues on next page)
241 Avril 2018 container training from Jeacuterocircme Petazzoni 227