Skip to content

Declared volumes make deploying image as "pre-built" db extremely difficult #613

Closed
@mshafer-NI

Description

@mshafer-NI

High level

I'm trying to build a db into an image to deploy (read-only) in a k8s cluster. I need to be able to build it one environment and deploy in a completely different one.

Desired behavior

Ability to (within my Dockerfile):

  • start FROM mongo,
  • launch the db in background (can use tmux for this)
  • run script to populate db
  • stop db
  • commit as image

Blockers currently (/ other solutions if they would work)

  • Because these images declare volumes for /data/db,
    • Docker generates an ephemeral volume whenever a descendant image is launched.
    • Docker appears to not allow a client Dockerfile to "reset" volumes (like we can entrypoint and cmd),
  • Nor have I been able to figure out how to get mongod to store the initial db in a different folder.

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