0
Good evening, everyone,
I have broken my head here to properly use the dockerfile and the docker-compose.
I have the image getjv/nodejs:8.11.4,
whenever it starts (container) already want to lift the server Node with the command: npm start.
But when I pass it on one dockerfile or a docker-compose I get a:
ERROR: for pasta_backend_1  Cannot start service backend: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"npm start\": executable file not found in $PATH": unknown
I gave one docker inspect and actually npm is not in the image path,  but when I access the container then the command works normally.
I have read and reread several tips, but I could not lift the container and already send the command.
Here’s my Docker-Compose:
version: '3'
services:
  frontend:
    image: getjv/nodejs
    ports:
      - "4200:4200"
    volumes:
      - D:\xxxxxx:/home
  backend:
    image: getjv/nodejs:8.11.4
    ports:
      - "3000:3000"
    volumes:
      - D:\xxxxxxxx\api:/home
    entrypoint:
      - npm start
Thank you all.
Do you need to use this Nodejs image yourself? Because the image documentation itself suggests you enter the container and run the server.
– João Marcos Bizarro
hahaha, it’s because this image is mine, I’m using it in my nail because I can’t set up the service to lift the container and turn it in my hand. so I asked here.
– Jhonatan Morais
Then, you can create a dockerfile, point to it in Docker-Compose.yml and create an "ENV PATH=<local_do_seu_npm>". Already tried?
– João Marcos Bizarro