|
| 1 | +# Running Umbraco in Docker |
| 2 | + |
| 3 | +Exactly how you chose to compose your Dockerfile depends on your needs, and your project, so this section is not intended as a guide, |
| 4 | +but as a general overview of what to be aware of when hosting in Docker. |
| 5 | + |
| 6 | +## What is Docker |
| 7 | + |
| 8 | +Docker is a platform for developing, shipping, and running applications in containers. There exist various services for hosting these containers, |
| 9 | +for more information, [refer to the official Docker documentation](https://docs.docker.com/) |
| 10 | + |
| 11 | +## The Docker file system |
| 12 | + |
| 13 | +By default, all files created inside a container is written to a ephemeral writable container layer. |
| 14 | +This means that the files don't persist when the container is removed, and it's difficult to get files out of the container. Additionally, this writable layer is not suitable for performance-critical data processing. |
| 15 | +This has several implications when running Umbraco in Docker. For more information refer to the [Docker documentation on storage](https://docs.docker.com/engine/storage/). |
| 16 | + |
| 17 | +### General file system consideration |
| 18 | + |
| 19 | +In general, when working with files and Dockcer you work in a "push" fashion with the read-only layers, that is when you build you take all your files and "push" them into the read-only layer. |
| 20 | +This means that you should avoid making files on the fly, and instead rely on building your image, this means that you should not create or edit template files on the fly, the same goes for script and style files. |
| 21 | + |
| 22 | +Similarly, you shouldn't use InMemory modelsbuilder, since that also relies on creating files on the disk, instead you should use source code in development, and none in production, as [described when using runtime modes](https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/runtime-modes). |
| 23 | + |
| 24 | + |
| 25 | +### Logs |
| 26 | + |
| 27 | +Umbraco writes logs to the `/umbraco/Logs/` directory, due to the performance implications of writing to a writable layer, |
| 28 | +and the limited size of the writable layer, it is recommended to mount a volume to this directory. |
| 29 | + |
| 30 | +### Media |
| 31 | + |
| 32 | +Similarly to logs, it's recommended to not store media in the writable layer, both for performance reasons, |
| 33 | +but also for practical development reason, you likely want to persist media files between containers. |
| 34 | + |
| 35 | +One possible solution here is to again use bind mounts, however the ideal solution is store the media and ImageSharp cache externally, |
| 36 | +for more information on this, refer to the [Azure Blob Storage documentation](https://docs.umbraco.com/umbraco-cms/extending/filesystemproviders/azure-blob-storage). |
| 37 | + |
| 38 | + |
| 39 | +## HTTPS |
| 40 | + |
| 41 | +When running in websites in Docker, it's common to use do so behind a reverse proxy, or load balancers. |
| 42 | +In these scenarios you're likely to handle SSL termination at the reverse proxy, this means that Umbraco will not be aware of the SSL termination, and will likely complain about not using HTTPS. |
| 43 | + |
0 commit comments