how to call docker run with docker compose file

coder
coder used Ask the Experts™
on
Hi Experts,

     I had build and run a docker image like this.

docker build -t harvest-trove:1.0.3 .
docker run --name trove_pull ${trove_environment[@]} -d -restart always harvest-trove:1.0.3 start pull                 

Open in new window


I want to use docker compose for the above two commands

I had created the docker compose like this.

version:'3'
services:
   harvest-trove:
      build: .
      image: harvest-trove:1.0.3
      volumes:
                -  .:/home/trove
           env_file:
        -  web-variables.env
            command: python3 manage.py migrate
  trove-pull:
    container_name:trove-pull     
    image: harvest-trove
    env_file:
       - web-variables.env
       depends_on:
         - harvest-trove
       command: harvest-trove:1.0.3 start pull
       restart:always

Open in new window


when I run docker-compose up I get the following error.

error with docker-compose up
Please help me in fixing this issue.

With Many thanks,
Bharath AK
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
developer
Commented:
Hi Experts,

I had changed the docker-compose file Please find the changes below.

version: '3'
services:

   harvest-trove:
     build: .
     volumes:
       - .:/home/trove/
     env_file:
       - web-variables.env
     command: python3 manage.py migrate


   trove_pull:
     command: start pull
     container_name: trove_pull
     image: harvest-trove:1.0.3
     restart: always
     depends_on:
       - harvest-trove
     env_file:
       - web-variables.env

Open in new window


now errors are fixed and now working fine.

with Many thanks,
Bharath AK

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial