Docker image creation fails with various errors
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
- 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.
- 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.
- 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 :)
- 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
- 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)
- clone repo, cd into it and checkout v2.5.0 tag
- make startdb
- 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
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 :)
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
Thank you for the detailed report! I'll look into this today/tomorrow.
News?
Do you have any news / workable workaround regard this matter? Thanks!
Thank you for the detailed report! I'll look into this today/tomorrow.
Any updates?
I'll look into this if I get some time this week.
I'll look into this if I get some time this week.
Hi any update??
Any updates sir?