Answer the question
In order to leave comments, you need to log in
How to steer docker-compose in prod?
Hello. How about a lot of questions? It so happened that I climbed from LXC to docker and technically almost everything is clear to me, but the philosophy is not clear in several places. Interested in exactly how you would do it. Suppose we have a web server of medium importance. Services are deployed on it (in docker-compose):
nginx
php-fpm (built from an image with installation of all extentions via Dckerfile)
MySQL
1) And now I want to upgrade the PHP version. To do this, I can build another container in the same yaml file, make a link to it from other services, and then switch backend in the Nginx configs. Norm?
But I can take and build the container in the dockerfile and then tell docker-compose that we are taking a local image?
2) By the way, how do you keep local collected images clean?
3) Is it normal to rebuild services in general? Let me remind you that the site is of medium importance. 1-10 minutes are not critical.
4) General question: Let's say you are an avid Ubuntu user. But suddenly you need to build the same web server as mine, but on a Centos image. There are different library names, extensions for php, package names, etc. And you don't know them. This is not difficult to do on a "live system", but caulking a dockerfile a hundred times with an error reading is nonsense and long. How do you write instructions in a Dockerfile in this scenario?
5) What if I want to temporarily lower one container? Compose will not be offended?
Thanks to all.
Answer the question
In order to leave comments, you need to log in
docker-compose is not very good, kubernetes is in vogue now. But if you really want to, then you can:
1. Edit yaml and Dockerfile if necessary. docker-compose build, docker-compose down, docker-compose up -d. If the yaml changes are large, for example, the composition of services changes, then it is worth down first, then editing.
2.3. If possible, images are not built locally. There is a separate development process, images are laid out in a private registry, from where they are taken by the composite.
4. Images are built on what is convenient for the developer. Never had a task to replace the type described. But it happens the other way around - a new OS, old proven dockers are launched on it.
5. docker compse stop servicename
How to steer docker-compose in prod?
make a link to it from other services and then switch in the Nginx backend configsif you want to do that, then it's not "medium importance" anymore. If you can afford a simple one, why not just stop the old container and then run the updated one?
But suddenly you need to build the same web server as mine, but on a Centos image. There are different library names, extensions for php, package names, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question