Home > Software design >  Heroku DockHero
Heroku DockHero

Time:01-28

I'm facing some problems to deploy an application to DockHero. As you can see, I'm trying to run this command as heroku says in its documentation:

ubuntu@ip-***-**-**-**:~/syncfusion$ heroku dh:compose up -d -a APP_NAME

But this happens:

Unknow flag: --file
See 'docker --help'.

This is my dockhero-compose.yml file:

version: '3.4'
services:
  word-processor-server:
    image: syncfusion/word-processor-server:latest
    environment:
      SYNCFUSION_LICENSE_KEY: MY_LICENSE
    ports:
    - "6002:80"

What am I missing?

CodePudding user response:

Do you have Docker Compose installed locally?

It looks like heroku dh:compose up -d -a foo just runs

docker compose --file dockhero-compose.yml -p dockhero up -d -a foo

But if Docker Compose is not correctly installed you should get an error like the one you are seeing.


On some operating systems it looks like Docker Compose doesn't get properly added as a Docker subcommand. I.e., docker-compose works but docker compose does not.

Since heroku dh:compose runs docker compose, it will fail on such systems.

This Gist shows one way to register Docker Compose as a Docker subcommand:

  1. Create a ~/.docker/cli-plugins directory:

     mkdir -p ~/.docker/cli-plugins
    
  2. Create a file ~/.docker/cli-plugins/docker-compose containing the script shown below

  3. Make that file executable:

     chmod  x ~/.docker/cli-plugins/docker-compose
    

That should register Docker Compose as a Docker plugin so you can run docker compose, which should in turn make heroku dh:compose work.

Script from the Gist:

#!/usr/bin/env bash

docker_cli_plugin_metadata() {
    if [ -z "$DOCKER_COMPOSE_VERSION" ]; then
        export DOCKER_COMPOSE_VERSION="$(docker-compose --version | cut -d " " -f 3 | cut -d "," -f 1)"
    fi

    local vendor="Docker"
    local url="https://www.docker.com"
    local description="Define and run multi-container applications"
    cat <<-EOF
    {"SchemaVersion":"0.1.0","Vendor":"${vendor}","Version":"${DOCKER_COMPOSE_VERSION}","ShortDescription":"${description}","URL":"${url}"}
EOF
}

case "$1" in
    docker-cli-plugin-metadata)
        docker_cli_plugin_metadata
        ;;
    *)
        exec "docker-$@"
        ;;
esac
  •  Tags:  
  • Related