owtf icon indicating copy to clipboard operation
owtf copied to clipboard

Docker image creation fails with various errors

Open jstourac opened this issue 7 years ago • 9 comments

I am not able to successfully generate docker image for owtf project from v2.5.0 tag. I suspect that I may have been doing something very wrong as I ran into a sequence of problems...

Expected Behavior

Docker image successfully created and owtf running and prepared for use.

Current Behavior

Various errors occur during the docker image build

Possible Solution

  1. locale problem:

Step 11/27 : RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen ---> Running in 5598443aa3a7 sed: can't read /etc/locale.gen: No such file or directory

My workaround - install locale package.

  1. no wait-for-it.sh script availalbe

Step 23/28 : ADD docker/wait-for-it.sh /usr/bin/wait-for-it.sh lstat docker/wait-for-it.sh: no such file or directory

I manually downloaded the one from this repo: https://github.com/vishnubob/wait-for-it, not sure whether it is quite okay.

  1. no default.settings.py file

Step 25/28 : RUN cp -f /owtf/docker/default.settings.py /owtf/owtf/settings.py ---> Running in 298a8422271b cp: cannot stat '/owtf/docker/default.settings.py': No such file or directory

My workaround - simply commented out this particular command as this is beyond my expertise :)

  1. missing modules

Step 25/27 : RUN cd /owtf && python setup.py develop ---> Running in d9039061e6e1 Traceback (most recent call last): File "setup.py", line 12, in from owtf import version File "/owtf/owtf/init.py", line 6, in from owtf.utils.logger import OWTFLogger File "/owtf/owtf/utils/logger.py", line 10, in from owtf.utils.file import catch_io_errors, get_log_path, FileOperations, get_logs_dir File "/owtf/owtf/utils/file.py", line 13, in from owtf.settings import LOGS_DIR, OUTPUT_PATH, OWTF_CONF, TARGETS_DIR, WORKER_LOG_DIR File "/owtf/owtf/settings.py", line 15, in import yaml ImportError: No module named yaml

My workaround - install missing modules

  1. versioning problem

Step 26/28 : RUN cd /owtf && python setup.py develop ---> Running in 34faf0ce8a67 Traceback (most recent call last): File "setup.py", line 12, in from owtf import version File "/owtf/owtf/init.py", line 17, in _temp = re.match(r"(\d+).(\d+).(\d+)(.(.+))?", version).groups() AttributeError: 'NoneType' object has no attribute 'groups'

My workaround - cherry-pick this commit https://github.com/owtf/owtf/commit/253a173a9f57961f1b2c2a6168a84657038e43f9

Fixes preview https://github.com/jstourac/owtf/commit/745a09adc65a2a358e99745e3dc10c8676b96620

Steps to Reproduce (for bugs)

  1. clone repo, cd into it and checkout v2.5.0 tag
  2. make startdb
  3. make docker-build && make docker-run

Logs

Context

Your Environment

  • Installation method used: docker

$ docker --version Docker version 1.13.1, build 1185cfd/1.13.1

  • Version/branch used: v2.5.0
  • Operating System and version (like Kali, Debian, ArchLinux, etc): Fedora
  • pip/setuptools version: from docker image
  • sudo access: yes

jstourac avatar Apr 09 '19 17:04 jstourac

Finally image is successfully build, it can be run by make docker-run although when running owtf, it has a version dependency problem:

# owtf
Traceback (most recent call last):
  File "/usr/local/bin/owtf", line 4, in <module>
    __import__('pkg_resources').require('owtf==2.5.0')
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3241, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'owtf==2.5.0' distribution was not found and is required by the application

I must be doing something in a wrong way, I suppose :)

jstourac avatar Apr 09 '19 17:04 jstourac

Exactly the same Problem here:

Step 21/26 : ADD docker/wait-for-it.sh /usr/bin/wait-for-it.sh ERROR: Service 'owtf' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder575999474/docker/wait-for-it.sh: no such file or directory

bananajoe200 avatar May 31 '19 07:05 bananajoe200

Thank you for the detailed report! I'll look into this today/tomorrow.

viyatb avatar Jun 03 '19 20:06 viyatb

News?

AInteriorB avatar Jul 25 '19 19:07 AInteriorB

Do you have any news / workable workaround regard this matter? Thanks!

Hax0rG1rl avatar Aug 10 '19 07:08 Hax0rG1rl

Thank you for the detailed report! I'll look into this today/tomorrow.

Any updates?

vertrost avatar Sep 09 '19 14:09 vertrost

I'll look into this if I get some time this week.

viyatb avatar Sep 09 '19 17:09 viyatb

I'll look into this if I get some time this week.

Hi any update??

optimostech avatar May 16 '20 12:05 optimostech

Any updates sir?

bowojori7 avatar May 29 '20 07:05 bowojori7