.dockerignore mentioned files are not ignored

I have Dockerfile:

ENV DATARATOR_HOME /usr/local/share/datarator
RUN mkdir -p $DATARATOR_HOME
COPY . $DATARATOR_HOME

and .dockerignorefile:

/Gemfile.lock
/coverage
/spec
*.bundle
*.so
*.o
*.a
mkmf.log
*.swp
/.*
/tmp
/log

However, when you show files in the built-in container, I see also those that should be ignored:

/usr/local/share/datarator # ls -lha
total 128
drwxr-xr-x   10 root     root        4.0K Mar 29 21:01 .
drwxr-xr-x    4 root     root        4.0K Mar 29 21:00 ..
drwxr-xr-x    2 root     root        4.0K Mar 29 21:01 .bundle
-rw-rw-r--    1 root     root          24 Mar 29 20:37 .coveralls.yml
-rw-rw-r--    1 root     root          81 Mar 29 20:37 .dockerignore
drwxrwxr-x    8 root     root        4.0K Mar 29 20:37 .git
-rw-rw-r--    1 root     root          85 Mar 29 20:37 .gitignore
-rw-rw-r--    1 root     root        1.2K Mar 29 20:37 .travis.yml
-rw-rw-r--    1 root     root         509 Mar 29 20:37 .vimrc
-rw-rw-r--    1 root     root         959 Mar 29 20:37 Dockerfile
-rw-rw-r--    1 root     root          94 Mar 29 20:37 Gemfile
-rw-r--r--    1 root     root        2.7K Mar 29 21:01 Gemfile.lock
-rw-rw-r--    1 root     root         343 Mar 29 20:37 Guardfile
-rw-rw-r--    1 root     root        1.0K Mar 29 20:37 LICENSE.txt
-rw-rw-r--    1 root     root          71 Mar 29 20:37 Procfile
-rw-rw-r--    1 root     root       14.8K Mar 29 20:37 README.md
-rw-rw-r--    1 root     root         198 Mar 29 20:37 Rakefile
drwxrwxr-x    2 root     root        4.0K Mar 29 20:37 bin
drwxrwxr-x    2 root     root        4.0K Mar 29 20:37 config
-rw-rw-r--    1 root     root          97 Mar 29 20:37 config.ru
-rw-r--r--    1 root     root       16.0K Mar 29 21:01 datarator-0.0.1.gem
-rw-rw-r--    1 root     root        1.7K Mar 29 20:37 datarator.gemspec
drwxrwxr-x    4 root     root        4.0K Mar 29 20:37 lib
drwxrwxr-x    2 root     root        4.0K Mar 29 20:37 log
drwxrwxr-x    3 root     root        4.0K Mar 29 20:37 spec
drwxrwxr-x    2 root     root        4.0K Mar 29 20:37 tmp

How can I avoid ignoring everything mentioned in the file .dockerignore?

+4
source share
1 answer

Rules .dockerignorefollow filepath/#Match.

Try (for testing) Gemfile.lockinstead /Gemfile.lock.

And make sure the eol characters (end of line) are unix style, not the Windows style in your file .dockerignore.

-, ( 1.10, 2016), , /, /xxx ( /.*) .

+4

All Articles