menzow / sn1per-docker

Dockerized version of Sn1per (https://github.com/1N3/Sn1per)
59 stars 27 forks source link

Getting a "returned a non-zero code: 137" error when I try to build locally #2

Closed jg8481it closed 7 years ago

jg8481it commented 7 years ago

Hello,

After I cloned this repo and ran docker build . I am getting the following error that is blocking me from creating a container...

I'm not sure what I am doing wrong.

Get:346 http://archive-11.kali.org/kali kali-rolling/main amd64 libgcc-6-dev amd64 6.3.0-18 [2297 kB] The command '/bin/sh -c echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list.d/kali.sources.list && gpg --keyserver pgpkeys.mit.edu --recv-key ED444FF07D8D0BF6 && gpg -a --export ED444FF07D8D0BF6 | apt-key add - && apt-get update && apt-get install -y ruby rubygems dos2unix python zenmap sslyze uniscan xprobe2 cutycapt unicornscan waffit host whois iputils-ping xvfb dirb dnsrecon curl nmap php php-curl hydra iceweasel wpscan sqlmap nbtscan enum4linux cisco-torch metasploit-framework theharvester ruby-dev dnsenum libsqlite3-dev nikto smtp-user-enum whatweb dnsutils sslscan amap arachni bsdmainutils && mv /usr/bin/python /usr/bin/python.unknown && ln -s /usr/bin/python2.7 /usr/bin/python && curl https://bootstrap.pypa.io/get-pip.py | python && gem install mechanize bcrypt sqlite3 net-http-persistent rake ruby-nmap text-table && pip install colorama dnspython ipaddress tldextract urllib3 && git clone https://github.com/1N3/Sn1per.git && cd Sn1per && /bin/bash ./install.sh && echo Cleaning up package index && apt-get clean && rm /etc/apt/apt.conf.d/30autoproxy && rm -rf /var/lib/apt/lists/* && echo "Image creation complete"' returned a non-zero code: 137

menzow commented 7 years ago

Hey @jg8481it,

Thanks for your reply. You're getting this error because the build process is trying to connect to a local caching proxy. I think it's easily disabled through here: https://github.com/menzow/sn1per-docker/blob/master/Dockerfile#L17

My local caching shouldn't break regular builds but I don't have time for a better solution right now. Dockers layering system and the way Sn1per is built don't really play well together. To keep a reasonable image size you have to push the entire build process into one layer. Builds fetching remote packages through apt-get and apt-update took me about an hour, so I started caching them locally.

More Info: Image Layering: https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/ Caching repositories: http://www.rushiagr.com/blog/2015/06/05/cache-apt-packages-with-squid-proxy/ Dockerized caching proxy server: https://hub.docker.com/r/muccg/squid-deb-proxy/

menzow commented 7 years ago

Hey @jg8481it ,

Just checked the issue here locally and I think it isn't the local cache that's blocking the installation but rather a pending read call in Sn1pers install.sh. I've pushed a quick fix forcing a value into stdin when running the installation. Let me know if it resolves your issue.

jg8481it commented 7 years ago

Hi @menzow,

Thank you very much for the assistance. After trying this again (with your latest fix), it now goes much farther than before but it now stops around here while it is unpacking libavutil55:amd64...

Selecting previously unselected package libavutil55:amd64. Preparing to unpack .../libavutil55_7%3a3.2.5-1_amd64.deb ... Unpacking libavutil55:amd64 (7:3.2.5-1) ... The command '/bin/sh -c echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list.d/kali.sources.list && gpg --keyserver pgpkeys.mit.edu --recv-key ED444FF07D8D0BF6 && gpg -a --export ED444FF07D8D0BF6 | apt-key add - && apt-get update && apt-get install -y ruby rubygems dos2unix python zenmap sslyze uniscan xprobe2 cutycapt unicornscan waffit host whois iputils-ping xvfb dirb dnsrecon curl nmap php php-curl hydra iceweasel wpscan sqlmap nbtscan enum4linux cisco-torch metasploit-framework theharvester ruby-dev dnsenum libsqlite3-dev nikto smtp-user-enum whatweb dnsutils sslscan amap arachni bsdmainutils && mv /usr/bin/python /usr/bin/python.unknown && ln -s /usr/bin/python2.7 /usr/bin/python && curl https://bootstrap.pypa.io/get-pip.py | python && gem install mechanize bcrypt sqlite3 net-http-persistent rake ruby-nmap text-table && pip install colorama dnspython ipaddress tldextract urllib3 && git clone https://github.com/1N3/Sn1per.git && cd Sn1per && echo "y" | /bin/bash ./install.sh && echo Cleaning up package index && apt-get clean && rm /etc/apt/apt.conf.d/30autoproxy && rm -rf /var/lib/apt/lists/* && echo "Image creation complete"' returned a non-zero code: 137

menzow commented 7 years ago

Hey @jg8481it no problem.

Error code 137 can be caused by problems. It means that the running program (in your case, that was the unarchiver) got killed by its parent. I'm going to take a guess here and say that Docker killed the container because your machine ran out of memory or disk space.

Check your disk space and check if you have enough memory available while building. If both are fine it might be that docker isn't allowing the build process the memory it requires. Docker build has -memory and -memory-swap arguments available

Hope this solves your issues.

Btw you can also save some resources by letting Docker Hub build your images

jg8481it commented 7 years ago

Hi @menzow

Thanks again for the assistance with this. I am going to explore using Docker Hub to handle the builds instead.

I am closing this issue.