traitecoevo / dockertest

Run tests in docker containers
Other
31 stars 2 forks source link

Absolute paths won't work on other machines #14

Open dfalster opened 9 years ago

dfalster commented 9 years ago

After building a docker image, the launch script produced includes an absolute path, e.g. from mortality_bci

#!/bin/bash
set -e
$(boot2docker shellinit 2> /dev/null)
docker run -v /Users/rich/Documents/Projects/veg/mortality_bci:/src -it richfitz/mortality_bci $*

This won't run on collaborators machine because of absolute path. On the other hand docker requires absolute paths. Could we replace with something like generate the path with something like

#!/bin/bash
PWD=($pwd)
set -e
$(boot2docker shellinit 2> /dev/null)
docker run -v ($PWD)/..:/src -it richfitz/mortality_bci $*
richfitz commented 9 years ago

yeah, that seems like a far better option.

dfalster commented 9 years ago

except my proposed code doesn't quite work

richfitz commented 9 years ago

The issue of what we point the container at needs dealing with carefully. When I use these containers for projects I'm not actually using the launch script at all (sorry - just remembered). Look at the compose file in successional diversity:

  volumes:
    - ${PWD}/self:/root/successional_diversity

or

docker run --link docker_redis_1:redis -v ${PWD}/self:/root/successional_diversity -it richfitz/successional_diversity:latest R

see how self is being used here.

dfalster commented 9 years ago

Cool, that makes sense. For time being I manually edited the launch script to implement above, e.g. here

richfitz commented 9 years ago

Yeah, that looks way more sensible than what I had.