|
| 1 | +:navigation-title: Volumes |
| 2 | + |
| 3 | +.. include:: /Includes.rst.txt |
| 4 | +.. _docker-volumes: |
| 5 | + |
| 6 | +============================================ |
| 7 | +Mounting volumes for TYPO3 Docker containers |
| 8 | +============================================ |
| 9 | + |
| 10 | +When working with Docker containers, you need to mount volumes. This ensures |
| 11 | +that important data persists across container restarts and deployments on the |
| 12 | +host machine. |
| 13 | + |
| 14 | +You should typically map these paths to volumes on the host server that you |
| 15 | +would not include in an `Incremental deployment |
| 16 | +<https://docs.typo3.org/permalink/t3coreapi:manual-deployment-incremental>`_. |
| 17 | + |
| 18 | +This includes user-managed content such as :path:`public/fileadmin`, and cached |
| 19 | +content like :path:`var`. |
| 20 | + |
| 21 | +.. _docker-volumes-config: |
| 22 | + |
| 23 | +Configure directories to be mountable in the Docker file |
| 24 | +======================================================== |
| 25 | + |
| 26 | +Within the :file:`Dockerfile`, you can use the `VOLUME` instruction to create a |
| 27 | +mount point for a specified path. |
| 28 | + |
| 29 | +.. seealso:: |
| 30 | + `VOLUME in the Official Docker Documentation |
| 31 | + <https://docs.docker.com/reference/dockerfile/#volume>`_ |
| 32 | + |
| 33 | +.. tabs:: |
| 34 | + |
| 35 | + .. group-tab:: Classic mode |
| 36 | + |
| 37 | + .. code-block:: bash |
| 38 | +
|
| 39 | + VOLUME /var/www/html/fileadmin |
| 40 | + VOLUME /var/www/html/typo3conf |
| 41 | + VOLUME /var/www/html/typo3temp |
| 42 | +
|
| 43 | + .. group-tab:: Composer mode |
| 44 | + |
| 45 | + .. code-block:: bash |
| 46 | +
|
| 47 | + VOLUME /var/www/html/public/fileadmin |
| 48 | + VOLUME /var/www/html/public/typo3temp |
| 49 | + VOLUME /var/www/html/var |
| 50 | +
|
| 51 | +.. _docker-volumes-mounting: |
| 52 | + |
| 53 | +Mount the defined volumes on the host system |
| 54 | +============================================ |
| 55 | + |
| 56 | +The method for mounting Docker volumes depends on how you manage your |
| 57 | +containers. |
| 58 | + |
| 59 | +If you use Docker on the console and Docker Compose is available, you can |
| 60 | +configure volumes to be mounted in the :file:`docker-compose.yml`. See the |
| 61 | +chapter `Create the docker-compose.yml file |
| 62 | +<https://docs.typo3.org/permalink/t3coreapi:docker-compose-create-composefile>`_. |
| 63 | + |
| 64 | +If you are using pure Docker commands, refer to `Start the TYPO3 container with |
| 65 | +mounted writable directories |
| 66 | +<https://docs.typo3.org/permalink/t3coreapi:classic-docker-typo3>`_. |
| 67 | + |
| 68 | +Some hosting providers offer a graphical interface to define volumes. |
| 69 | + |
| 70 | +.. note:: |
| 71 | + If a volume is **not mounted** on the host server, its content will be lost |
| 72 | + when you stop and restart the container or update it. |
| 73 | + |
| 74 | + Ensure you have a `secure backup strategy |
| 75 | + <https://docs.typo3.org/permalink/t3coreapi:administration-backups>`_ for |
| 76 | + user-created content in mounted volumes. |
0 commit comments