What is the most appropriate (smallest, simplest) container to use for a data only Docker container?
In the documentation they use the training/postgres container. Howe
This post recommends using an empty "scratch" container - no OS at all:
Dockerfile:
FROM scratch
VOLUME /data
ENTRYPOINT ["/no/such/file"]
I just made an empty one, and the image is... 0 bytes!
Then I COPY'd just a 2k file in during build, and the image is 260 bytes, so must be compressed.
I am using this because named volumes aren't so useful in semi/serverless environments like AWS Fargate where is no host, and you want to deploy versioned data.
Update: if you want the container to work correctly in docker-compose the above example won't work because the entrypoint fails. tianon/true
seems to be the best solution, a tiny program which returns true. So you can use FROM tianon/true
.