Osrm-backend: Error while using Docker-Container: Error while loading shared libraries

Created on 5 Dec 2018  路  19Comments  路  Source: Project-OSRM/osrm-backend

Hello there,

I've got the following (extract) of a Docker-compose file:

  osrm-server:
    image: osrm/osrm-backend
    build:
      context: .
      dockerfile: ./osrm/Dockerfile.osrm
    ports:
      - 5000:5000
    command: bash -c "osrm-routed --algorithm mld berlin-latest.osrm"

The Dockerfile.osrm looks like this:

FROM osrm/osrm-backend
RUN apt-get update
RUN apt-get install -y wget
RUN wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
RUN osrm-extract -p /opt/car.lua berlin-latest.osm.pbf
RUN osrm-partition berlin-latest.osrm
RUN osrm-customize berlin-latest.osrm
EXPOSE 5000

But now the osrm-extract command is throwing an error:

osrm-extract: error while loading shared libraries: libboost_program_options.so.1.67.0: cannot open shared object file: No such file or directory
ERROR: Service 'osrm-server' failed to build: The command '/bin/sh -c osrm-extract -p /opt/car.lua berlin-latest.osm.pbf' returned a non-zero code: 127

We tested the same Dockerfile + Docker-compose on another machine and it works there, does anybody now how to fix it?

Most helpful comment

Using tag v5.20.0 fixes the problem and i would guess that switching the image to debian (f978900ab) causes the issue.
I'm a bit confused that latest is not the latest relase but seems to be the current master. Would it not make sense to point latest to the lastest release and use a tag develop/beta/master or something similar for current developments.

All 19 comments

Same problem with Docker Version 2.0.0.0-mac81 (29211) (Engine: 18.09.0) and osrm/osrm-backend:latest 349bb0747a29 without further configuration.

Please keep me informed if you make any new progress. I tried to uninstall and reinstall Docker, but it didn't help. My setup is equal to yours, I'm also working on a Mac machine.

I think it would be really great to get some help by some core developers here :)

Using tag v5.20.0 fixes the problem and i would guess that switching the image to debian (f978900ab) causes the issue.
I'm a bit confused that latest is not the latest relase but seems to be the current master. Would it not make sense to point latest to the lastest release and use a tag develop/beta/master or something similar for current developments.

I have deployed again forcing the tag to v5.20.0 and it works fine.

TAG:
osrm/osrm-backend:v5.20.0@sha256:23c75d40c83b287476e0ea0883dfe7c06c3d54302d41df343c36079b8a06f36e

thanks!

Also did the trick for me, v5.20.0 works! For anybody following up that workaround: Keep in mind that you have to use apk instead of apt-get and Shell instead of Bash.
I'll keep that issue open so maybe some of the developers are interested into tracking down that bug.

Thx @goggel :)

Hi @patreu22
I follow the different step you said. I was able to create the image but running the docker-compose, I got errors like Missing/broken files : france-latest-osrm.osrm.ramIndex, france-latest-osrm.osrm.fileIndex, etc... with a final message "required files are missing".

my dockerfile looks like :

FROM osrm/osrm-backend:v5.20.0
RUN apk update
RUN apk add ca-certificates wget && update-ca-certificates
RUN wget http://download.geofabrik.de/europe/france-latest.osm.pbf
RUN osrm-extract -p /opt/car.lua france-latest.osm.pbf
RUN osrm-partition france-latest.osrm
RUN osrm-customize france-latest.osrm
EXPOSE 5000

and my compose file

version: '3'
services:
  osrm-server:
    image: ssr-osrm-backend2
    build: 
      context: .
      dockerfile: Dockerfile
    ports:
      - "5000:5000"
    command: sh -c "osrm-routed --algorithm mld france-latest-osrm"

I do admit, I m new to docker. I suppose I missed something..

Could you try osrm/osrm-backend:v5.20.0 as the image in the docker-compose for the osrm-server? That's the primary difference I can spot on the first look.

Could you try osrm/osrm-backend:v5.20.0 as the image in the docker-compose for the osrm-server? That's the primary difference I can spot on the first look.

it was a mistake.

RUN osrm-partition france-latest.osm
RUN osrm-customize france-latest.osm

instead of

RUN osrm-partition france-latest.osrm
RUN osrm-customize france-latest.osrm

and

command: sh -c "osrm-routed --algorithm mld france-latest.osm"
instead of
command: sh -c "osrm-routed --algorithm mld france-latest-osrm"

Thanks.

I tried with the current version(3d781e6f28242623e45ff3c8da27a0122012e52d) and got the same error(lib not found). With v5.20.0@sha256:23c75d40c83b287476e0ea0883dfe7c06c3d54302d41df343c36079b8a06f36e worked fine.

tip: I tried to create a symlink from libboost_program_options.so.1.67.0 to libboost_program_options.so.1.68.0 but didn't work too.

It looks like the build stage installs libboost-all-dev which installs libboost 1.67, and the run stage installs libboost 1.62.

I can't reproduce this error, I used same Dockerfile from the above.

FROM osrm/osrm-backend
RUN apt-get update
RUN apt-get install -y wget
RUN wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
RUN osrm-extract -p /opt/car.lua berlin-latest.osm.pbf
RUN osrm-partition berlin-latest.osrm
RUN osrm-customize berlin-latest.osrm
EXPOSE 5000
docker build -t xydinesh/osrm5294 .
[info] Unreachable nodes statistics per level
[warn] Level 1 unreachable boundary nodes per cell: 0.00272232 sources, 0.000907441 destinations
[warn] Level 2 unreachable boundary nodes per cell: 0.0238095 sources, 0 destinations
[warn] Level 3 unreachable boundary nodes per cell: 0.166667 sources, 0 destinations
[info] MLD customization writing took 0.018387 seconds
[info] Graph writing took 0.015086 seconds
[info] RAM: peak bytes used: 80490496
Removing intermediate container 03bca878550e
 ---> a0f618ef2243
Step 8/8 : EXPOSE 5000
 ---> Running in 2af80c205099
Removing intermediate container 2af80c205099
 ---> 1f551921c16d
Successfully built 1f551921c16d
Successfully tagged xydinesh/osrm5294:latest

I tried with following docker-compose too. I can't reproduce this issue

version: '3'
services:
  osrm-server:
    image: xydinesh/osrm5294:compose
    build:
      context: .
      dockerfile: Dockerfile.osrm
    ports:
      - 5000:5000
    command: bash -c "osrm-routed --algorithm mld berlin-latest.osrm"
docker-compose up --force-recreate
Successfully tagged xydinesh/osrm5294:compose
WARNING: Image for service osrm-server was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating tmp_osrm-server_1 ... done
Attaching to tmp_osrm-server_1
osrm-server_1  | [info] starting up engines, v5.20.0
osrm-server_1  | [info] Threads: 4
osrm-server_1  | [info] IP address: 0.0.0.0
osrm-server_1  | [info] IP port: 5000
osrm-server_1  | [info] http 1.1 compression handled by zlib version 1.2.11
osrm-server_1  | [info] Listening on: 0.0.0.0:5000
osrm-server_1  | [info] running and waiting for requests

@patreu22 Did you try changing image name in the docker-compose ? It doesn't look right to me.

  osrm-server:
    image: osrm/osrm-backend

Because docker-compose suppose to create an image with this name, also it has the same name as the osrm image name Dockerfile.osrm pulls from docker hub.

According to docker-compose#build

If you specify image as well as build, then Compose names the built image with the webapp and optional tag specified in image:

Thanks @xydinesh, fair enough that you can't reproduce the issue, but is it intentional to build with libboost 1.67 in the build stage then install 1.62 in the run stage? that seems weird.

I also have the issue on a fresh install of my machine (docker was installed 5 min ago)

docker run -t -v $(pwd):/host osrm/osrm-backend osrm-extract -p /host/new.lua /host/data/belgium-latest.osm.pbf
osrm-extract: error while loading shared libraries: libboost_program_options.so.1.67.0: cannot open shared object file: No such file or directory

Here is the result of docker image ls

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
docker.io/osrm/osrm-backend   latest              447cbd68b3b6        45 hours ago        152 MB

Edit: i pinned the version to v5.20.0 and it works. Seems that latest is the only version causing a problem.

@chesty No, It was not intentional. Let's pin everything to one version. I will send a pull request with a fix.

@xydinesh : my proposal https://github.com/ImreSamu/osrm-backend/commit/3c36326799a2df3aeb883921a745ef30122e22e7 you can resuse/adapt/drop ... ;)

Will be fixed in 5.21 by #5311, thanks @xydinesh

Sorry for being late.
I solved this problem on my linux system.
This is a security issue, check selinux,
Run setenforce 0 to temporarily close selinux

Was this page helpful?
0 / 5 - 0 ratings

Related issues

freenerd picture freenerd  路  4Comments

davidbarre picture davidbarre  路  4Comments

ryanbishop12 picture ryanbishop12  路  4Comments

AliKarami picture AliKarami  路  3Comments

stvno picture stvno  路  3Comments