New issue

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

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

Already on GitHub? Sign in 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 · 1 comment

Comments

Projects
None yet
3 participants
@zdw

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 from Invalid symlinks now break build, previously were skipped, skipped by docker CLI to Invalid symlinks now break utils.create_archive(), previously were skipped, skipped by docker CLI Dec 20, 2017

@Fiser12

This comment has been minimized.

Show comment
Hide comment
@Fiser12

Fiser12 Jan 28, 2018

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

Fiser12 commented Jan 28, 2018

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

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