I am building a Docker image using the below Dockerfile and the command "docker build -t tiler_test -f Dockerfile .
". The building works fine. However when I try to run the Dockerfile with "docker run -p 8080:8080 tiler_test:latest
" I get the following error message which I've tried many things to resolve w/o success.
node:internal/modules/cjs/loader:1473
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: libGLX.so.0: cannot open shared object file: No such file or directory
at Module._extensions..node (node:internal/modules/cjs/loader:1473:18)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/usr/lib/node_modules/tileserver-gl/node_modules/@maplibre/maplibre-gl- native/platform/node/index.js:5:12)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12) {
code: 'ERR_DLOPEN_FAILED'
}
Node.js v20.11.1
Dockerfile
# Use an Ubuntu base image
FROM ubuntu:latest
# Install dependencies
RUN apt-get update && \
apt-get install -y wget curl git unzip build-essential python3
# Install Node.js
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs
# Clone TileServer-GL repository
RUN git clone https://github.com/klokantech/tileserver-gl.git /tileserver-gl
# Change working directory
WORKDIR /tileserver-gl
# Install TileServer-GL dependencies
RUN npm install
RUN npm install -g npm@10.5.0
RUN npm install -g tileserver-gl
WORKDIR /
COPY ./config.json /config.json
COPY ./test.mbtiles /test.mbtiles
COPY templates /templates
COPY styles /styles
COPY fonts /fonts
# Expose the default TileServer-GL port
EXPOSE 8080
ENV PORT 8080
ENTRYPOINT ["tileserver-gl"]
CMD "tileserver-gl --file test.mbtiles"
I tried running the docker image with:
docker build -t tiler_test -f Dockerfile .
and get the error message cited in description. I was expecting for the CMD to run and be able to access the resulting tileserver-gl map tile server.
You were missing a few libraries. See the Dockerfile
below where they are installed in the last line of the first apt-get install
command.
FROM ubuntu:latest
RUN apt-get update && \
apt-get install -y \
wget \
curl \
git \
unzip \
build-essential \
python3 \
libglx-dev libopengl0 libuv1-dev
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y \
nodejs
RUN git clone https://github.com/klokantech/tileserver-gl.git /tileserver-gl
WORKDIR /tileserver-gl
RUN npm install
RUN npm install -g npm@10.5.0 tileserver-gl
WORKDIR /
RUN wget https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/zurich_switzerland.mbtiles
EXPOSE 8080
ENV PORT 8080
CMD tileserver-gl --file zurich_switzerland.mbtiles
For the purpose of illustration I'm download a file with tiles during the build process.