Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (12.7k points)
Now that links are deprecated in docker-compose.yml (and we're able to use the new networking feature to communicate between containers), we've lost a way to explicitly define dependencies between containers. How can we, now, tell our mysql container to come up first, before our api-server container starts up (which connects to mysql via the dns entry myapp_mysql_1 in docker-compose.yml?

1 Answer

0 votes
by (29.5k points)

In my experience you could try doing the following:

nginx:
  image: nginx
  ports:
    - "42080:80"
  volumes:
    - ./config/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
  volumes_from:
    - php

php:
  build: config/docker/php
  ports:
    - "42022:22"
  volumes:
    - .:/var/www/html
  env_file: config/docker/php/.env.development

mongo:
  image: mongo
  ports:
    - "42017:27017"
  volumes:
    - /var/mongodata/wa-api:/data/db
  command: --smallfiles

Browse Categories

...