Using a tmpfs

Commands

docker container run --tmpfs /tmp -it alpine:latest
docker container run --mount type=tmpfs,dst=/tmp -it alpine:latest
docker container run --mount type=tmpfs,dst=/tmp --read-only -it alpine:latest

Docker Compose and resources

Running nginx read-only