Skip to content

Initialize container volumes with local files #1666

@martin-helmich

Description

@martin-helmich

Context

Oftentimes, container deployments might need to be initialized with a certain set of local files.

Common examples include application-specific configuration files.

Currently, providing these files (especially in a freshly initialized project) is cumbersome, and consists of the following steps:

  1. Provide an empty dummy app or container (e.g. static file app, or a busybox container)
  2. Connect to that app, synchronize files (rsync or scp) into the project's /files directory or into a volume
  3. Then mount that directory into the actual container.
  4. Remove the temporary dummy app/container

Proposal

Imperative workflow (using container run)

Proposal: Add an additional volume mirror command that initializes a new volume that is automatically initialized from a local directory (alternatively, add a --initialize-from flag to the volume create command:

# alternative #1
user@local $ mw volume create config
user@local $ mw volume mirror ./config config

# alternative #2
user@local $ mw volume create --initialize-from=./config config

# usage
user@local $ mw container run -v config:/etc/config [...]

Declarative workflow (using stack deploy)

Proposal: Use docker-compose syntax (combined with a custom driver) to configure volume initialization:

volumes:
  config:
    driver: local-sync
    driver_opts:
      source: ./config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions