Nous pouvons commencer. L'idée pour bien contrôler son environnement
va souvent être de partir d'un environnement assez minimaliste et dans
lequel un notebook jupyter n'aura d'ailleurs aucune chance de
s'exécuter. Je partirai d'une image debian stable que je vais
récupérer à l'aide de la commande =docker pull=.
Nous pouvons commencer. Je partirai d'une image Linux debian stable
que je vais récupérer à l'aide de la commande =docker pull=.
#+begin_src shell :session *shell* :results output :exports both
docker pull debian:stable
...
...
@@ -166,7 +163,7 @@ listée ici: https://hub.docker.com/_/debian. Que puis-je savoir sur
cette image ?
#+begin_src shell :session *shell* :results output :exports both
docker image list
docker images
#+end_src
#+RESULTS:
...
...
@@ -614,7 +611,7 @@ la =844815ed865e= (cet identifiant est le début d'une clé
cryptographique identifiant tout le contenu de cette image).
#+begin_src shell :results output :exports both
docker image list | grep scipy
docker images | grep scipy
#+end_src
#+RESULTS:
...
...
@@ -670,26 +667,1149 @@ cas, une bonne pratique consiste à bien repérer l'identifiant de vos
images et à les spécifier.
* Séquence 2: Créer son propre environnement, automatiser sa construction et le partage
** 2.1 Récupérer une image de base
Nous allons créer un environnement "minimal" en terme de dépendances
et permettant d'exécuter le [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-modele/blob/master/module2/exo5/exo5_fr.ipynb][notebook Jupyter de Challenger]].
L'idée pour bien contrôler son environnement va être de partir d'un
environnement minimaliste, dans lequel notre notebook aura d'ailleurs
peu de chances de s'exécuter, et d'y installer juste les logiciels
dont nous aurons besoin. Je partirai d'une image debian stable.
#+begin_src shell :session *shell* :results output :exports both
Setting up jupyter-nbextension-jupyter-js-widgets (6.0.0-4) ...
/usr/lib/python3.7/runpy.py:125: RuntimeWarning: 'notebook.nbextensions' found in sys.modules after import of package 'notebook', but prior to execution of 'notebook.nbextensions'; this may result in unpredictable behaviour
I: Valid Release signature (key id 126C0D24BD8A2942CC7DF8AC7638D0442B90D010)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://snapshot.debian.org/archive/debian/20171003T094008Z...
I: Retrieving libacl1 2.2.52-3+b1
I: Validating libacl1 2.2.52-3+b1
I: Retrieving adduser 3.116
I: Validating adduser 3.116
I: Retrieving apt 1.5
I: Validating apt 1.5
I: Retrieving libapt-pkg5.0 1.5
I: Validating libapt-pkg5.0 1.5
[..]
I: Unpacking libidn2-0:amd64...
I: Unpacking libtasn1-6:amd64...
I: Unpacking libunistring2:amd64...
I: Unpacking libhogweed4:amd64...
I: Unpacking libnettle6:amd64...
I: Unpacking libp11-kit0:amd64...
I: Configuring the base system...
I: Configuring libunistring2:amd64...
I: Configuring libnettle6:amd64...
I: Configuring libidn2-0:amd64...
I: Configuring gpgv...
I: Configuring libtasn1-6:amd64...
I: Configuring libgmp10:amd64...
I: Configuring debian-archive-keyring...
I: Configuring libstdc++6:amd64...
I: Configuring libffi6:amd64...
I: Configuring adduser...
I: Configuring libapt-pkg5.0:amd64...
I: Configuring libhogweed4:amd64...
I: Configuring libp11-kit0:amd64...
I: Configuring libgnutls30:amd64...
I: Configuring apt...
I: Configuring libc-bin...
I: Base system installed successfully.
#+end_example
Ensuite, on applique les différentes étapes suggérées dans [[https://github.com/debuerreotype/debuerreotype][la
documentation de debuerreotype]]:
#+begin_src shell :results output :exports both :tangle moocrr_debian_snapshot_jupyter/debuerreotype.sh
debuerreotype-minimizing-config rootfs # apply configuration tweaks to make the rootfs minimal and keep it minimal (especially targeted at Docker images, with comments explicitly describing Docker use cases)
debuerreotype-apt-get rootfs update -qq # let's update the package list
debuerreotype-apt-get rootfs dist-upgrade -yqq # let's upgrade any package that would need to be upgraded
debuerreotype-slimify rootfs # remove files such as documentation to create an even smaller rootfs (used for creating slim variants of the Docker images, for example)
#+end_src
#+RESULTS:
#+begin_example
debconf: delaying package configuration, since apt-utils is not installed
Setting up jupyter-nbextension-jupyter-js-widgets (6.0.0-2) ...
/usr/lib/python3.6/runpy.py:125: RuntimeWarning: 'notebook.nbextensions' found in sys.modules after import of package 'notebook', but prior to execution of 'notebook.nbextensions'; this may result in unpredictable behaviour
│┄ Files similar despite different names (score: 25, lower is more similar)
│ @@ -1 +1 @@
│ -{"id":"a5999282c324e3775b5c96c31b64bb8622042ee2ee5dcecc2601ca5020dd4a47","comment":"Imported from -","created":"2019-08-16T15:05:15.637451511Z","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"docker_version":"18.09.1","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"architecture":"amd64","os":"linux"}
│ +{"id":"c4d3eddad284d66137dd67c02e401a3f924ae4a2899ab965c5bbdd30efbbfb4b","comment":"Imported from -","created":"2019-08-16T15:56:19.700804142Z","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"docker_version":"1.13.1","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"architecture":"amd64","os":"linux"}
debuerreotype-minimizing-config rootfs # apply configuration tweaks to make the rootfs minimal and keep it minimal (especially targeted at Docker images, with comments explicitly describing Docker use cases)
debuerreotype-apt-get rootfs update -qq# let's update the package list
debuerreotype-apt-get rootfs dist-upgrade -yqq# let's upgrade any package that would need to be upgraded
debuerreotype-slimify rootfs # remove files such as documentation to create an even smaller rootfs (used for creating slim variants of the Docker images, for example)