in Education by
Do I need to use separate Docker containers for my complex web application or I can put all required services in one container? Could anyone explain to me why I should divide my app to many containers (for example php-fpm container, MySQL container, mongo container) when I can install and launch all stuff in one container? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
While working with Docker, Docker will replace your PID 1(process id 1 where the init system lives ) with the command you specify in the CMD(and ENTRYPOINT) directive in your Dockerfile. Your container lives and dies depends on whatever process is present pid1. Incidentally, this is why you need to jump through hoops to start services and run cron jobs. This is very important in understanding the motivation for doing things. So you could figure out how to run all of those services in one container. But now you know that how docker replaces pid 1 with whatever command you specify in CMD (and ENTRYPOINT) in your Dockerfiles if in case you are running apps in their containers for their future purposes you can let them work with the help of container interlinking. Container linking has been deprecated in favor of regular ole container networking, which is much tougher, the idea being that you simply join your separate application containers to the same network so they can talk to one another On a side note, it is much cleaner and better to maintain separate containers instead of linking and messing all the containers.

Related questions

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 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
    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
    Now that links are deprecated in docker-compose.yml (and were able to use the new networking feature to ... docker-compose.yml? Select the correct answer from above options...
asked Feb 8, 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 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
    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
    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
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
    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
    Could someone tell me whether as a non-IT engineer could I shift my career to DevOps? Select the correct answer from above options...
asked Jan 6, 2022 in Education by JackTerrance
...