Docker-compose fails with error “No command specified”

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:

  • Docker compose with networks and “internal” property example
  • Multi Maven Module Spring MVC Project to Spring Boot
  • supervisor won't give meaningful output
  • Node.JS proxy with Nginx and Docker
  • Read sym linked stdout in linux (with docker)
  • Key server times out while installing docker on Ubuntu 14.04
  • “ERROR: for advisor Cannot create container for service advisor: No
    command specified”

    What am I doing wrong?

    Contents of docker-compose.yml

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

    Contents of DockerfileAdvisor

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

  • How to periodically run a script inside a fresh Docker container on Amazon AWS?
  • Map data container volume to volume
  • What execute RUN instruction in exec mode
  • How can I mount a volume among remote Docker Machines?
  • hotdeploy / hotswap classes using wildfly maven docker intellij
  • Connect to mongodb on centos7 docker image
  • One Solution collect form web for “Docker-compose fails with error “No command specified””

    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

    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:

        image: XYZ
          - "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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.