Mounting volumes for TYPO3 Docker containers
When working with Docker containers, you need to mount volumes. This ensures that important data persists across container restarts and deployments on the host machine.
You should typically map these paths to volumes on the host server that you would not include in an Incremental deployment.
This includes user-managed content such as public/, and cached
content like var.
Configure directories to be mountable in the Docker file
Within the Dockerfile, you can use the VOLUME instruction to create a
mount point for a specified path.
VOLUME /var/www/html/fileadmin
VOLUME /var/www/html/typo3conf
VOLUME /var/www/html/typo3temp
VOLUME /var/www/html/public/fileadmin
VOLUME /var/www/html/public/typo3temp
VOLUME /var/www/html/var
Mount the defined volumes on the host system
The method for mounting Docker volumes depends on how you manage your containers.
If you use Docker on the console and Docker Compose is available, you can
configure volumes to be mounted in the docker-. See the
chapter Create the docker-compose.yml file.
If you are using pure Docker commands, refer to Start the TYPO3 container with mounted writable directories.
Some hosting providers offer a graphical interface to define volumes.
Note
If a volume is not mounted on the host server, its content will be lost when you stop and restart the container or update it.
Ensure you have a secure backup strategy for user-created content in mounted volumes.