• [^] # Re: mises à jours et docker

    Posté par (Mastodon) . En réponse au journal Les outils de l'IT pour un FabLab. Évalué à 4. Dernière modification le 04 novembre 2017 à 20:54.

    Bien sûr que oui elle existe. Et c'est pas un truc que tu rencontres, c'est un truc que tu décides.

    Genre tu prends les images de docker pour des bases comme postgresql ou mariadb ils te montrent des exemples pour monter un volume hébergeant les données :

    postgres:

    $ docker volume create pgdata
    $ docker run -it --rm -v pgdata:/var/lib/postgresql/data postgres
    

    mysql:

    Where to Store Data
    Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the mariadb images to familiarize themselves with the options available, including:
    

    Let Docker manage the storage of your database data by writing the database files to disk on the host system using its own internal volume management. This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers.
    Create a data directory on the host system (outside the container) and mount this to a directory visible from inside the container. This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly.
    The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above:

    Create a data directory on a suitable volume on your host system, e.g. /my/own/datadir.
    Start your mariadb container like this:

    $ docker run --name some-mariadb -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:tag
    The -v /my/own/datadir:/var/lib/mysql part of the command mounts the /my/own/datadir directory from the underlying host system as /var/lib/mysql inside the container, where MySQL by default will write its data files.
    

    Et comme ce sont des paramètres que toute personne utilisant docker plus de 2 minuts connait, ce n'est pas forcément précisé dans les readme de toutes les images fournies par les projets upstream.