0

Here is what I want to do. I want to run myApp1 when myApp2 is up and running. I'm trying to use wait-for-it.sh but I can't seem to make it work. =[ Please help!

version: '3'
services:
  myApp1:
    image: myApp1:latest
    ports:
      - 40400:40400
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/var/run/docker.sock:/var/run/docker.sock"
    deploy:
      mode: replicated
      replicas: 1
    depends_on:
      - "myApp2"
    command: ["./wait-for-it.sh", "myApp2:40000"]

  myApp2:
    image: myApp2:latest
    ports:
      - 40000:40000
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: replicated
      replicas: 1
Sang Kim
  • 33
  • 7

1 Answers1

1

You didn't specify what to do after wait-for-it.sh returned success. Try:

command: ["./wait-for-it.sh", "myApp2:40000", "-s", "--", "<your program>", "your program arguments if any"]

gohm'c
  • 13,492
  • 1
  • 9
  • 16