docker-compose not found from script

I have a Dockerfile which is basically the following:

FROM mhart/alpine-node:5

COPY . /project
WORKDIR /project

ENTRYPOINT ["./startup.sh"]

And my startup.sh is quite simple too:

  • Use Xcode with Docker (cross-compiling)
  • Unable to use docker due to ZScaler and certificate issues
  • unable to run a container with volume on glusterfs
  • Docker-compose second entry in yaml using a base image generated from first entry
  • Can't curl linked container in Docker even though I can ping it
  • local docker Repos keep getting bigger and bigger
  • #!/bin/sh
    set -e
    docker-compose up -d
    

    I do have a docker-compose.yml, but there is no point to describe it here.

    First thing I do is to build the docker image by using my Dockerfile, so:

    docker build -t test .

    Then run this image:

    docker run -d test

    Which will launch the startup.sh

    Unfortunately, I have the following error showing up:

    ./startup.sh: line 10: docker-compose: not found

    And if I do only ./startup.sh without the docker stuff, it works like a charm.

    Where the issue can be possibly coming from?

  • Docker: One image per user? Or one image for all users?
  • Difference between Rancher and other container orchestration
  • docker pull lookup index.docker.io: no such host
  • How to back up docker swarm mode service configuration for disaster recovery
  • How can I configure logtash to use “stdout” as input?
  • Why ansible keeps recreating docker containers with state “started”
  • One Solution collect form web for “docker-compose not found from script”

    Try to add the full path to the docker-compose inside the script

    which docker-compose
    
    >/usr/bin/some/path/docker-compose
    

    Then add this to your script

    #!/bin/sh
    set -e
    /usr/bin/some/path/docker-compose up -d
    

    Your local PATH settings are unknown to the script called by docker. Therefore you have to name the full path.

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