how to call docker run with docker compose file

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
LVL 1
Bharath A.KAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bharath A.KAuthor 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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.