2

Starting the container with the run command

docker run -it -d -p 8888:8888 install_advisor node src/server

works as expected. But trying to bring it up using docker-compose results in the error:

"ERROR: for advisor Cannot create container for service advisor: No command specified"

What am I doing wrong?

Contents of docker-compose.yml

advisor:
  build:
    context: .
    dockerfile: DockerfileAdvisor
  ports:
    - "8888:8888"
  restart: always
  privileged: true

Contents of DockerfileAdvisor

FROM XYZ
ENTRYPOINT [ "node", "src/server" ]

1 Answer 1

2

I'm a bit surprised that your solution doesn't work as it is. But you can probably fix it in several ways. Here some suggestions:

1) Change your DockerFileAdvisor file to

FROM XYZ
COMMAND [ "node", "src/server" ]

2) If DockerFileAdvisor really contains just the two rows that are shown in your question, you don't even need it. Just specify image: XYZ and command: [ "node", "src/server" ] in your docker-compose.yml:

advisor:
    image: XYZ
    ports:
      - "8888:8888"
    restart: always
    privileged: true
    command: [ "node", "src/server" ]

Maybe you'd like to take a look on Docker documentation how ENTRYPOINT and COMMAND directives play together. In short, with ENTRYPOINT you can make an image to look like an executable and use COMMAND to just pass parameters for it.

Sign up to request clarification or add additional context in comments.

1 Comment

Great, nice to hear it! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.