A dockerfile for vmware-tanzu/carvel-ytt
Simply run the container and mount your files to /workspace
, e.g.:
docker run --rm -v ${PWD}:/workspace gerritk/ytt -f .
ytt
originally comes with a built-in webserver that hosts the tools documentation.
To be able to use it in docker however you have to pass some command line flags:
docker run --rm -p 8080:8080 gerritk/ytt website --listen-addr=0.0.0.0:8080 --redirect-to-https=false
It might be convenient to create an alias or function for the commands above. Here are a couple of examples:
- An alias for the base templating tool:
alias ytt='docker run --rm -v ${PWD}:/workspace gerritk/ytt'
- An alias for the website command:
alias ytt-website='docker run --rm -p 8080:8080 gerritk/ytt website --listen-addr=0.0.0.0:8080 --redirect-to-https=false'
- A function combining both:
ytt () {
if [ "$#" = "1" ] && [ "$1" = "website" ]; then
docker run --rm -p 8080:8080 gerritk/ytt website --listen-addr=0.0.0.0:8080 --redirect-to-https=false
else
docker run --rm -v "${PWD}":/workspace gerritk/ytt "$@"
fi
}
If you have suggestions on the structure of the Dockerfile or are looking for a specific version that is not available yet, feel free to create an issue.