I am confused following the docker documentation.
The default run, as it explains is straight forward, but I don't know how to specify custom luas.
I suspect this is more a docker
question than a osrm
. If so, apologies, and please point me in the right direction :)
This is the case:
➜ ls
bhutan-15-5-17.o5m
truck.lua
➜ docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/bhutan-15-5-17.o5m
[info] Using script /opt/car.lua
[info] Input file: bhutan-15-5-17.o5m
[info] Profile: car.lua
...
This work ok, as documented (Even when I don't understand why it's /data/bhutan-15-5-17.o5m
and not bhutan-15-5-17.o5m
).
However, if it try to use the truck.lua
of the same folder (same as car.lua
, but changing max speeds), it fails with
➜ docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/truck.lua /data/bhutan-15-5-17.o5m
[error] Profile truck.lua not found!
I asked this in IRC, and danieljh
answered and explained it.
The "-v $(pwd):/data" part tells Docker to mount your current working directory to "/data" inside the container. So when you refer to file ./myfile inside the Docker container it will be at /data/myfile.
Hence this works:
➜ docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /data/truck.lua /data/bhutan-15-5-17.o5m
Hi @brunosan Can you explain me why you use /opt for car profile and /data for truck profile? I ask the question because I try to solve my own docker issue (my "truck" profile is not found) even if I try to change opt for data.
@brunosan I finally realized that /opt directory is built into the Dockerfile. So I put my truck.lua profile in /profiles, rebuild the docker, use -p /opt/truck.lua as a parameter for osrm-extract and it works.
Sorry for the late reply, glad you found a fix, and that you posted it here for others to see :) 🎉
@brunosan, @aginpatrick : I'm sorry to bother you and I know this is a bit off topic, but I'm working on a truck profile. Would you be willing to share yours with me?
Most helpful comment
I asked this in IRC, and
danieljh
answered and explained it.The "-v $(pwd):/data" part tells Docker to mount your current working directory to "/data" inside the container. So when you refer to file ./myfile inside the Docker container it will be at /data/myfile.
Hence this works: