Closed abn closed 7 years ago
@ashcrow @jasinner can I please get a quick review on this? Check README.md on branch for how to use the docker-compose.
Thanks @abn It looks good, but I'm having trouble running the container. I'm getting:
$ sudo docker run --rm -it -v `pwd`:/opt/source local/victims-web
/usr/bin/python: No module named victims`
Also got this when trying to run a the tests using docker-compose:
Attaching to victimsweb_test_1
test_1 | Failure: ImportError (No module named *) ... ERROR
test_1 |
test_1 | ======================================================================
test_1 | ERROR: Failure: ImportError (No module named *)
test_1 | ----------------------------------------------------------------------
test_1 | Traceback (most recent call last):
test_1 | File "/usr/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
test_1 | addr.filename, addr.module)
test_1 | File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
test_1 | return self.importFromDir(dir_path, fqname)
test_1 | File "/usr/lib/python2.7/site-packages/nose/importer.py", line 79, in importFromDir
test_1 | fh, filename, desc = find_module(part, path)
test_1 | ImportError: No module named *
test_1 |
test_1 | Coverage.py warning: Module victims.web was never imported. (module-not-imported)
test_1 | Traceback (most recent call last):
test_1 | File "/usr/bin/nosetests", line 11, in <module>
test_1 | sys.exit(run_exit())
test_1 | File "/usr/lib/python2.7/site-packages/nose/core.py", line 121, in __init__
test_1 | **extra_args)
test_1 | File "/usr/lib/python2.7/unittest/main.py", line 95, in __init__
test_1 | self.runTests()
test_1 | File "/usr/lib/python2.7/site-packages/nose/core.py", line 207, in runTests
test_1 | result = self.testRunner.run(self.test)
test_1 | File "/usr/lib/python2.7/site-packages/nose/core.py", line 66, in run
test_1 | result.printErrors()
test_1 | File "/usr/lib/python2.7/site-packages/nose/result.py", line 110, in printErrors
test_1 | self.config.plugins.report(self.stream)
test_1 | File "/usr/lib/python2.7/site-packages/nose/plugins/manager.py", line 99, in __call__
test_1 | return self.call(*arg, **kw)
test_1 | File "/usr/lib/python2.7/site-packages/nose/plugins/manager.py", line 167, in simple
test_1 | result = meth(*arg, **kw)
test_1 | File "/usr/lib/python2.7/site-packages/nose/plugins/cover.py", line 183, in report
test_1 | self.coverInstance.stop()
test_1 | File "/usr/lib/python2.7/site-packages/coverage/control.py", line 773, in save
test_1 | self.data_files.write(self.data, suffix=self.data_suffix)
test_1 | File "/usr/lib/python2.7/site-packages/coverage/data.py", line 680, in write
test_1 | data.write_file(filename)
test_1 | File "/usr/lib/python2.7/site-packages/coverage/data.py", line 467, in write_file
test_1 | with open(filename, 'w') as fdata:
test_1 | IOError: [Errno 13] Permission denied: '/opt/source/.coverage'
victimsweb_test_1 exited with code 1
I'm using Fedora 26 with:
$ docker --version
Docker version 1.13.1, build 27e468e/1.13.1
$ docker-compose --version
docker-compose version 1.14.0, build c7bdf9e
Hmm, maybe my volume mounts are not working:
$ sudo docker run --rm -it -v /home/jshepher/projects/victims/victims-web:/opt/source alpine ls /opt/source
ls: can't open '/opt/source': Permission denied
Actually, it was SELinux not playing nice with OverlayFS on Fedora. Sorry, this is a new Fedora setup. Tests seem to run fine now, and can use server compose to run locally. Did you try installing on Openshift? I suppose we'll push to docker.io registry? What about the source code, how will it be mounted into that container?
@jasinner yeah that is a mount issue; see https://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/
This particular change is for local environment only; production containers would be slightly different. I need to have a think around how best to tackle that one. This PR is focusing on the refactor and the local development environment/testing.