

The answers about using Dockerfiles are absolutely correct, but if you’re looking for a quick and simple solution that will work locally, you can always just use the “commit” docker command. This basically saves the current state of a container as a new image. You can then run new containers from that image as needed.
See https://stackoverflow.com/questions/44480740/how-to-save-a-docker-container-state
Alright, you just sold me on borg backup. Well done.