Skip to content

Remove VOLUME instructions #118

@jjlin

Description

@jjlin

The current Dockerfiles specify

VOLUME /config
VOLUME /data

The problem with this is it ends up creating anonymous volumes that aren't cleaned up when the Caddy container exits, even when the container is deleted. You can see this by running docker run caddy true followed by docker volume ls; repeat this a few times and note that new volumes keep building up.

From #104 (comment), the stated rationale for having these VOLUME instructions is "to prevent [config and data] files from being written to the container, and hence lost during a container restart". However, even without VOLUME, these files actually aren't lost during a container restart; they're just stored in the container's writable layer, which will exist as long as the container isn't actually deleted. Given that these anonymous volumes wouldn't be reused when creating a new Caddy container, this doesn't seem to have much advantage over just using the writable layer for storage.

The docs already suggest creating named volumes caddy_data and caddy_config anyway, though this might be simpler as just a single caddy volume mounted at /caddy (or /srv/caddy), with XDG_CONFIG_HOME=/caddy/config and XDG_DATA_HOME=/caddy/data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions