docker-node icon indicating copy to clipboard operation
docker-node copied to clipboard

Docker image for 16 running npm start instead of command

Open meiremans opened this issue 4 years ago • 1 comments

Environment

  • Platform: Windows 10
  • Docker Version: Latest (Docker Desktop 4.1.1 (69879))
  • Node.js Version: 16
  • Image Tag: 16.13.0

Expected Behavior

given this docker file:

version: '2'
services:
  base:
    image: "node:16.13.0"
    volumes:
      - .:/usr/src/service
    working_dir: /usr/src/service/
    container_name: "builder"

  install:
      extends:
        service: base
      command: npm install

I would expect docker-compose -f docker-compose-dev.yml run --rm install to run an npm install inside the container. As it does when using the container of node 14. (node:14)

Current Behavior

It runs whatever is behind "start" in package.json. in my case: "scripts": { "start": "node app.js",....} "node app.js npm install" is exactly the command ran in the container

Steps to Reproduce

you can make a package.json containing a start command. Use above docker compose file and command, and you will see it will run the start command and not npm install.

meiremans avatar Nov 04 '21 20:11 meiremans

Found out after a while, that when docker-compose.yml is formated with CRLF this issue happens, formated as LF this issue doesn't exists.

//edit.

When I pull the image from the hub, this issue happens. I cannot get this reproduced when building the relevant Dockerfile from this repo.

meiremans avatar Nov 04 '21 20:11 meiremans