You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A container will persist it's internal state until it's destroyed (docker rm container_name, docker run --rm, docker compose down, etc). An anonymous volume is often mistakenly added despite being redundant.
When persistence via a volume is actually necessary, it should be explicit (docker run --volume ./host/path/:container/path, or the volume key in compose.yaml, etc).
Anonymous (-v container/path):
I want to persist the volume without a human-friendly name to reference
Named (-v my_data:container/path):
I want a human-friendly name, but not easy access from the host filesystem, just persist my data externally from the container
Bind mount (-v host/path:container/path):
I want to persist the data at a known location on the host filesystem that I can easily access directly
I also provided justification in 2022 for Caddy to do the same, citing various sources from other popular official images that likewise dropped VOLUME (which is effectively a legacy feature that causes more problems implicitly than benefits).
Describe your ideal solution
Remove VOLUME from the Dockerfile lines referenced (this would be applicable to other Ory projects too).
Workarounds or alternatives
The redundant copy can be avoided.. if the user provides their own bind mount to the same mount point at runtime (anonymous & named volumes copy container content by default, bind mounts replace).
Alternatively, the --rm option will remove the container on exit, additionally discarding the implicitly created anonymous volume. This doesn't prevent writing a copy of the volume data to disk, which if large slows startup.
Ideally though, without a real reason to keep VOLUME, it should just be removed from the Dockerfiles? 🤷♂️
Version
2.1.2
The text was updated successfully, but these errors were encountered:
Preflight checklist
Describe your problem
Some of the
Dockerfile
files in this repo use theVOLUME
instruction: https://github.com/ory/hydra/tree/master/.dockerDockerfile references
hydra/.docker/Dockerfile-build
Line 27 in f9cee32
hydra/.docker/Dockerfile-hsm
Lines 54 to 62 in f9cee32
hydra/.docker/Dockerfile-sqlite
Lines 19 to 27 in f9cee32
PR that introduced
VOLUME
: #2129VOLUME
is not necessary:docker rm container_name
,docker run --rm
,docker compose down
, etc). An anonymous volume is often mistakenly added despite being redundant.docker run --volume ./host/path/:container/path
, or thevolume
key incompose.yaml
, etc).-v container/path
):-v my_data:container/path
):-v host/path:container/path
):I also provided justification in 2022 for Caddy to do the same, citing various sources from other popular official images that likewise dropped
VOLUME
(which is effectively a legacy feature that causes more problems implicitly than benefits).Describe your ideal solution
Remove
VOLUME
from theDockerfile
lines referenced (this would be applicable to other Ory projects too).Workarounds or alternatives
--rm
option will remove the container on exit, additionally discarding the implicitly created anonymous volume. This doesn't prevent writing a copy of the volume data to disk, which if large slows startup.Ideally though, without a real reason to keep
VOLUME
, it should just be removed from theDockerfile
s? 🤷♂️Version
2.1.2
The text was updated successfully, but these errors were encountered: