I tried to run a executable inside a docker container of alpine:
/usr/src/server # ls -l
total 57472
-rw-r--r-- 1 root root 166 Dec 29 12:22 Dockerfile
-rwxr-xr-x 1 root root 58844530 Dec 29 12:35 server
/usr/src/server # ./server
/bin/sh: ./server: not found
It gives me the file not found
error when trying to run the container, what am I missing?
Dockerfile
FROM alpine:3.12.3
# Create server directory
WORKDIR /usr/src/server
# Bundle server Source
COPY . .
# Expose Port and Start Server
EXPOSE 3000
CMD [ "./server" ]
The build Dockerfile (uses buildkit)
FROM node:14 AS build-stage
# Create server directory
WORKDIR /usr/src/server
# Install Nexe
RUN npm i nexe@3.3.7 -g
# Install Server Dependencies
COPY package*.json ./
RUN npm install --only=production
# Bundle server Source
COPY . .
# Build
RUN nexe app.js -r config/db.js -r config/email.js -r config/passport.js -r config/config.env \
-r middleware/auth.js \
-r models/Option.js -r models/Token.js -r models/User.js -r models/Votacao.js -r models/Voto.js \
-r routes/auth.js -r routes/votacao.js \
-t linux-x64-12.14.1 \
-o server
# Copy to Build
FROM scratch AS export-stage
COPY --from=build-stage /usr/src/server/server /server
The nexe stage is a mess, I'm still porting to webpack...
You are right, ldd was giving me some errors:
Error loading shared library libstdc++.so.6: No such file or directory (needed by server)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by server)
Using debian solved them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.