skip to Main Content

So I have the following Dockerfile for my NodeJS project:

WORKDIR /app
COPY package*.json ./

RUN npm ci --only=production


COPY . .

EXPOSE 80/tcp

CMD ["npm", "start"]

So far so good. Docker build runs successfully, but when I try to run the container, I get the following:

$ docker run myContainer

[email protected] start
node src/index.js

linux is NOT supported.   <----- THIS right here... ??

How can I find out more information regarding this? There is no stack trace, no information or anything to continue from here…

What I already tried:

  • I tried different base images in my Dockerfile, with the same result.
  • My local machine is Windows, So I tried switching docker to linux containers, without any effect.
  • I also deployed it to GCP on a Debian. Same result.

Thanks

2

Answers


  1. Chosen as BEST ANSWER

    Found the solution, and it was actually on one of my dependencies. If anyone has a similar issue, you can just "grep" the message in your node_modules folder to find where it is originating.


  2. You can check the logs to see if there are any more information via docker logs myContainer

    If the logs doesn’t help you can try running the container with a different version of NodeJS. You can do this by specifying the version in your Dockerfile like so:

    FROM node:14
    
    WORKDIR /app
    COPY package*.json ./
    
    RUN npm ci --only=production
    
    
    COPY . .
    
    EXPOSE 80/tcp
    
    CMD ["npm", "start"]
    

    The last thing i can say is try running the container with a different Linux distribution. You can specify the Linux distribution in your Dockerfile using the FROM instruction like the following: FROM ubuntu:latest

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search