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:

  • Assigning IP address to docker containers?
  • Docker - issue command from one linked container to another
  • Docker Volumes mounting issue
  • Run Hadoop with Docker (for both DEV and PROD environments)
  • How can i view my dockerized container app that i just set up on Azure?
  • kubernetes installation and kube-dns: open /run/flannel/subnet.env: no such file or directory
  • “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" ]

  • Docker Container fails to connect to remote SQL
  • Can't connect to Mongo DB in .Net Core api
  • How to restart Docker-for-mac with command?
  • copying files using cp in dockfile fails
  • How can I deal with gemspecs that use `git ls-files` when in a Docker container?
  • “” working on Mac, but not on Linux
  • 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.