docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.62k stars 1.97k forks source link

commands within docker-compose block don't work with docker machine #4852

Open Cally99 opened 3 years ago

Cally99 commented 3 years ago

Below block of code works fine locally (MAC Mojave) for project and runs django server, also works on EC2 ubuntu when docker and docker-compose are installed.

If I create a docker-machine env and run the project inside the vm the sh -c command won't work. ./wait-for-it.sh db:5432 not found. None of the commands work inside the block.

Is there any explanation why docker this type of command block won't work with docker machine?

   container_name: django  
   build:
     context: ./backend
   env_file: .env
   environment: 
     - DEBUG=True
   command: >
     sh -c "./wait-for-it.sh db:5432 && 
           ./autobets/manage.py collectstatic --no-input &&
           ./autobets/manage.py makemigrations &&
           ./autobets/manage.py migrate --no-input &&
           ./autobets/manage.py runserver_plus 0.0.0.0:8000
           "
   ports:
     - "8000:8000"  
   volumes:
     - ./backend:/app
   depends_on:
     - db
   restart: on-failure