What is the correct usage posture of docker?
phpcn_u1582
phpcn_u1582 2017-05-16 13:17:50
0
1
609

The use and understanding of docker is a bit confusing now, and I would like to ask everyone for advice.

For example:
I currently have a Linux system with 8G of memory.
I need to run two environments on this system: alpha and beta environments.
Alpha and beta environments both use their own nginx and mysql.

My current understanding is that there are two options:

plan 1:

创建两个 container:container_alpha,container_beta。 在两个container_alpha和container_beta和里面都安装好mysql和nginx

Scenario 2:

创建四个 container,在四个container里面都**只**安装 alpha_mysql alpha_nginx beta_mysql beta_nginx

For option one, configuration, use and management will be much easier and clearer.
For option 2, each container only corresponds to one service. I don’t know if this is more in line with the principles of docker.

Or maybe my understanding of docker is not correct yet, so what is the correct way to use docker?

phpcn_u1582
phpcn_u1582

reply all (1)
阿神

It depends on what you consider a service, or a "managed unit".

If db+nginx+php is always one-to-one and bound to each other, I think it is okay to treat these as a service.

If the database has master-slave, separation of reading and writing, etc., it will be more convenient to count a mysql as a service.

In addition, option 2 is more friendly to expansion. You don’t need to disassemble the image when you want to change it. You only need to change docker-compose or other configurations.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!