Skip to content

Support configuring .dockerignore path + support with remote contexts #3169

Open
@polarathene

Description

@polarathene

Description

Better support a git repo as remote context would be ideal with the ability to:

  • Adjust the implicit Dockerfile default to another filename (presently only supported via different sub-directories or slightly different --file input?)
  • Use the .dockerignore (which would be applied prior to using a shallow git clone as build context?)

Current situation:

# git URL context => Clones repo into a build context (local or repo `.dockerignore` is not applied)
# `--file` option provides HTTPS URL to select different Dockerfile variant
docker build \
  --tag localhost/project-name:branch-or-tag \
  --file https://raw.githubusercontent.com/user/repo/branch-or-tag/Dockerfile.alpine \
  https://github.com/user/repo.sh.git#branch-or-tag

Proposed:

# --ignore should technically not be required to use `.dockerignore`
# from the remote context unless choosing to opt-out via `/dev/null`?
docker build \
  --tag localhost/project-name:branch-or-tag \
  --file context://Dockerfile.alpine \
  --ignore context://.dockerignore \
  https://github.com/user/repo.sh.git#branch-or-tag

Additional reference

Remote build contexts and Dockerfile (either implicit via remote context, or explicit via separate --file arg) are supported but not remote .dockerignore files (or even custom path locally).

Related:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions