Write files from Docker without ownership and permission issues
Dominik Rüttiger 1 min read
Some things you wish you knew beforehand. This very convenient method for writing files from Docker to a local filesystem without any ownership and permission issues, might be one of them.
It is a combination of a multi-stage Dockerfile and docker build --output
.
Typical use cases
- generating static websites with Astro
- generating slides from Markdown files with RevealJS
- generating PDFs with AsciiDoctor
Multi-stage Dockerfile
As an example, let’s create a Dockerfile to build a static Astro website:
docker build —output
Let’s generate the website with the Docker build command:
This will save the output into a local ./dist
folder.
Tags
#astro #devops #docker #dx #markdown