in Education by
Now that links are deprecated in docker-compose.yml (and were 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? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Let’s assume that we have an nginx container depends on php container you can use volume_from as of now 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 By this approach the volumes of php are exposed to nginx which is not a desired one but until depends_on feature is introduced. There is a proposal to introduce "depends_on" in the new networking feature introduced by Docker. The feature depends_on could be used to order the container start-up. For more information please go through the following tutorial to get more info about docker:

Related questions

0 votes
    My docker-compose file has some running docker files to create my containers. I don't want the docker files ... docker-compose syntax? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I'm looking for a way to configure Nginx to access hosted services through a subdomain of my server. Those services ... me with this? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Can someone help me to differentiate between DevOps and Docker? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I have a dump.sql file that I would like to load with docker-compose. docker-compose.yml: services: postgres: ... how to do this? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have a dump.sql file that I would like to load with docker-compose. docker-compose.yml: services: postgres: ... how to do this? Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    Do I need to use separate Docker containers for my complex web application or I can put all required services in ... in one container? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I am unable to find the containers under the directory: /var/lib/docker/containers Can you please tell me the ... the host machine? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I want to expose multiple ports to the machine’s interface. How to achieve this using a docker container? Please help. Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    I have created a docker image. I want to push it into my docker repo but I am facing this error: denied: ... to the resource is denied Select the correct answer from above options...
asked Jan 21, 2022 in Education by JackTerrance
0 votes
    Suppose you have two services on your topology API Web Interface Both supposed to be running on port 80. On docker ... to solve this? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I've been using K8S ConfigMap and Secret to manage our properties. My design is pretty simple, that keeps ... 't been created Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I have tried to build a docker image based on mono to serve a docfx documentation. Here is my ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 15, 2022 in Education by JackTerrance
0 votes
    So I have a Nginx running inside a docker container, I have a mysql running on the host system, I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    What are the purposes of up, run, and start commands of docker compose?...
asked Jun 20, 2021 in Technology by JackTerrance
0 votes
    So I am trying to build a docker image with the Golang SDK, everything runs except the section in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
...