Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Invalid symlinks now break utils.create_archive(), previously were skipped, skipped by docker CLI #1841

Closed
zdw opened this issue Dec 20, 2017 · 2 comments

Comments

@zdw
Copy link

zdw commented Dec 20, 2017

Version 2.7.0 seems to die if you try to include a symlink that points to something that doesn't exist. This problem seems to have been introduced in this commit:
5c57050

Example from 2.6.1 and docker cli tool:

$ mkdir test
$ cd test
$ ln -s /doesnt_exist doesnt_exist
$ cat << EOF > Dockerfile 
FROM scratch

COPY . /tmp
EOF
$ docker build -t test . 
Sending build context to Docker daemon   2.56kB
Step 1/2 : FROM scratch
 ---> 
Step 2/2 : COPY . /tmp
 ---> cb6f16dc4b1f
Removing intermediate container 4eda4dd7d7c4
Successfully built cb6f16dc4b1f
Successfully tagged test:latest
$ python
Python 2.7.6 (default, Nov 23 2017, 15:49:48) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
>>> docker.__version__
'2.6.1'
>>> docker.utils.create_archive(".", ['doesnt_exist'])
<open file '<fdopen>', mode 'w+b' at 0x7fa47208f8a0>
>>> 

But as of 2.7.0:

$ python
Python 2.7.6 (default, Nov 23 2017, 15:49:48) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
>>> docker.__version__
'2.7.0'
>>> docker.utils.create_archive(".", ['doesnt_exist'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py", line 103, in create_archive
    'Can not access file in context: {}'.format(full_path)
IOError: Can not access file in context: ./doesnt_exist
>>> 

It seems that symlinks should be skipped rather than trying to checked to see if they are accessible, as was the previous behavior and the docker CLI tool behavior.

@zdw zdw changed the title Invalid symlinks now break build, previously were skipped, skipped by docker CLI Invalid symlinks now break utils.create_archive(), previously were skipped, skipped by docker CLI Dec 20, 2017
@Fiser12
Copy link

Fiser12 commented Jan 28, 2018

I have this same problem, for the moment I will have to pull that version

@HemilTheRebel
Copy link

Had a similar problem in a python project. Added .pytest_cache and venv to docker ignore and it worked

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants