marius311 / stfd

Massively squash Docker images by automatically monitoring for unused files and deleting them.
1 stars 0 forks source link

Getting Error #1

Open MTRNord opened 7 years ago

MTRNord commented 7 years ago

When I run ./docker-stfd mtrnord/projectstreet_detection:latest sh -c "PYTHONPATH='/usr/lib/python2.7/dist-packages/' python face_detect.py abba.png haarcascade_frontalface_default.xml >> /root/shared/results/logs.txt"

I get

Reverse engineering Dockerfile...
Traceback (most recent call last):
  File "./docker-stfd", line 73, in <module>
    baseimage = next(l for l in dockerfile if l.startswith('FROM')).split()[1]
StopIteration

I run that inside an docker container (if that makes any difference)

marius311 commented 7 years ago

Pulled your image and I'm able to reproduce this. What version of Docker are you using? Also, what does docker history mtrnord/projectstreet_detection show?

MTRNord commented 7 years ago

Docker Version:

docker version
Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:02:53 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:02:53 2016
 OS/Arch:      linux/amd64

History:

root@debian:/home/marcel/ProjectStreet# docker history mtrnord/projectstreet_detection
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
c9646ac08b5e        15 hours ago        /bin/sh -c #(nop)  WORKDIR /FaceDetect          0 B                 
<missing>           15 hours ago        /bin/sh -c #(nop) COPY dir:e7c867c0c74e997e48   1.659 MB            
<missing>           15 hours ago        /bin/sh -c #(nop)  MAINTAINER MTRNord <info@n   0 B                 
<missing>           16 hours ago        /bin/sh -c apt-get update && apt-get install    307.8 MB            
<missing>           16 hours ago        /bin/sh -c #(nop)  MAINTAINER MTRNord <info@n   0 B                 
<missing>           10 days ago         /bin/sh -c #(nop)  CMD ["python2"]              0 B                 
<missing>           10 days ago         /bin/sh -c pip install --no-cache-dir virtual   7.898 MB            
<missing>           10 days ago         /bin/sh -c set -ex  && buildDeps='   tcl-dev    49.4 MB             
<missing>           10 days ago         /bin/sh -c #(nop)  ENV PYTHON_PIP_VERSION=8.1   0 B                 
<missing>           10 days ago         /bin/sh -c #(nop)  ENV PYTHON_VERSION=2.7.12    0 B                 
<missing>           10 days ago         /bin/sh -c #(nop)  ENV GPG_KEY=C01E1CAD5EA2C4   0 B                 
<missing>           10 days ago         /bin/sh -c apt-get update && apt-get install    7.749 MB            
<missing>           10 days ago         /bin/sh -c #(nop)  ENV LANG=C.UTF-8             0 B                 
<missing>           10 days ago         /bin/sh -c #(nop)  ENV PATH=/usr/local/bin:/u   0 B                 
<missing>           10 days ago         /bin/sh -c apt-get update && apt-get install    321.3 MB            
<missing>           10 days ago         /bin/sh -c apt-get update && apt-get install    122.6 MB            
<missing>           10 days ago         /bin/sh -c apt-get update && apt-get install    44.3 MB             
<missing>           10 days ago         /bin/sh -c #(nop)  CMD ["/bin/bash"]            0 B                 
<missing>           10 days ago         /bin/sh -c #(nop) ADD file:c6c23585ab140b0b32   123 MB    
marius311 commented 7 years ago

Ok, all those <missing> I think means that you didn't build the image on the same system as you are trying to run stfd on it, is that correct? If so, can you try building the image locally then running stfd?

It may be necessary to have the build cache present for stfd to work and as of Docker 1.10 this doesn't get pulled anymore if you built the image on a different system (see also https://github.com/docker/docker/issues/20316)

MTRNord commented 7 years ago

I will try that :) I did let it build on the dockerHub build system

marius311 commented 7 years ago

Cool, if it fixes it let me know. I should add a big warning to the README.

MTRNord commented 7 years ago

Ok now I get some errors that are coming from centurylink/dockerfile-from-image (this one: https://github.com/CenturyLinkLabs/dockerfile-from-image/issues/14 ) And also the fix there generates a new error :& But I think I should post that error in the issue tracker for centurylink/dockerfile-from-image

marius311 commented 7 years ago

Ah yea, I was getting that too. The solution mentioned there worked for me. Either rebuild the CentryLinkLabs/dockerfile-from-image image yourself, or switch stfd to use dduvnjak/dockerfile-from-image instead here https://github.com/marius311/stfd/blob/master/docker-stfd#L70

MTRNord commented 7 years ago

Ok rebuilding only got me to another error. But I will try the other image :)

MTRNord commented 7 years ago

Both solutions give me than:

/usr/src/app/dockerfile-from-image.rb:33:in `block in <main>': undefined method `first' for nil:NilClass (NoMethodError)
    from /usr/src/app/dockerfile-from-image.rb:32:in `each'
    from /usr/src/app/dockerfile-from-image.rb:32:in `each_with_object'
    from /usr/src/app/dockerfile-from-image.rb:32:in `<main>'
marius311 commented 7 years ago

Hm odd, I'm not sure the issue. If you share the Dockerfile I could try building the image myself and debugging further.

MTRNord commented 7 years ago

So the code and commit is here: https://github.com/Nordgedanken/ProjectStreet_Detection-docker/tree/99413217d225c3f845b1dc41cd480b8f850cac38 The base (FROM) image is: https://github.com/Nordgedanken/openCV_docker-base/tree/02f1c9b5749974407affff62480483033f0f7edd