docker / docker/docker-py

Building from remote repository via ssh doesn't respect .dockerignore

Open
#2,610 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

docker==4.2.1
Python 3.8.1
Docker engine: 19.03.6
OS: Mint 19.3

I tried to build an docker image from a remote repository via ssh. But each time the resulting image was different. I thought that maybe it is because of missing .dockerignore file and changing .git directory. So I created it but nothing changed. Everything is fine when I'm using docker build command (.dockerignore is respected and every time built image is the same - from cache).

I created trivial repository to reproduce the issue. https://github.com/nekeal/dockerignore-test
You should clone this repo, install requirements pip install -r requirements.txt and run script which builds image with python cli.py

Current behaviour

.git directory is included in image.

Expected behaviour

.git is absent in image.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Install the requirements from the reproduction repository and run its cli.py script to exercise the SSH-based remote build. Compare that path with docker build, focusing on how .dockerignore is handled. Done means .git is absent from the resulting image and repeated builds can reuse the expected cache.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.