Skip to content

Instantly share code, notes, and snippets.

@ineentho
Last active August 3, 2020 15:46
Show Gist options
  • Save ineentho/01b4ae87cf5ed10f0e8c3de0e2536b14 to your computer and use it in GitHub Desktop.
Save ineentho/01b4ae87cf5ed10f0e8c3de0e2536b14 to your computer and use it in GitHub Desktop.
List all files sent to a docker build
#!/bin/sh
docker image build -t test-dockerignore -f - > /dev/null . <<EOF
FROM alpine
COPY . /test-dockerignore
EOF
docker run --rm test-dockerignore sh -c 'cd /test-dockerignore; find -mindepth 1'
docker image rm test-dockerignore > /dev/null

test-dockerignore

A small shell script to test which files will be included in the docker context

Install

Install for user:

curl https://gist.githubusercontent.com/ineentho/01b4ae87cf5ed10f0e8c3de0e2536b14/raw/test-dockerignore.sh > ~/bin/test-dockerignore && chmod +x ~/bin/test-dockerignore

Install globally

sudo sh -c "curl https://gist.githubusercontent.com/ineentho/01b4ae87cf5ed10f0e8c3de0e2536b14/raw/test-dockerignore.sh > /usr/local/bin/test-dockerignore && chmod +x /usr/local/bin/test-dockerignore"

Usage

In the context directory with a .dockerignore, run test-dockerignore to get a list of files that will be included

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment