What better way to approach Docker for containers like apache, Nginx, mariadb, etc

Asked

Viewed 65 times

2

I’m new to the Docker world and I’m having some doubts about the Docker concept in production.

I know that one of the great advantages of Docker is having the same environment that we have in development in production to avoid those classic problems that on my machine is running, but on the server not.

So I see in this case that when I create my application I can configure a Docker-Compose.yml with the images needed for my environment. For example apache, php5.6, mariadb and do a Docker-Compose up to have the necessary environment. And in the same way when someone else from my team picks up the project will just do a Docker-Compose up and will have all the necessary also without having to install and configure anything on his machine.

So if I wanted to send this to production, I’d do the same thing, right? And if another project already uses php7 and postgresql then in Docker-Compose.yml I will put php7 in place of 6 and postgresql in place of mariadb

So this is where my doubt comes.

I have set up a Docker cluster and I have seen that the approach is to create services for images. A service for apache, a mariadb, a pro postgre and so on.

So in this case how does my Docker-Compose.yml configuration look? And will I have to create services beforehand for every thing a new application will need? Doesn’t that run a little away from the ease of the environment? Even because an application may need a certain detail in an image that another does not need.

As I said, I am new to the world of Ocker. I would like advice to avoid setting up an environment in the wrong way and having q change everything in the future.

Thanks for your help.

  • I don’t quite understand your question, so I think we’d better get to the basics so you can rework it. Docker leverages Linux kernel innovations: Namespaces, cgroups, Selinux and Unionfs to share complete systems, called containers, to perform distinct tasks with the aim of creating system isolation, thus, it does not install any application directly on the host, nor is it on a virtual machine.

  • Image is the initial setting of the environment of that particular service. By concept, each container performs an isolated service. Service is a process that provides a certain resource. It is not indicated that we have different processes in the background in the same service, for example, if the container is apache it is not safe for it to run another process like a cron or mariadb. This is because each image defines a single entrypoint (process it will perform). When this process ends or dies, the container dies along with it.

  • Docker-Compose is a Docker command that reads a description of services in yml and facilitates their orchestration and management. It is able for example to create elasticity to the service, creating new container when necessary. Cluster Docker is a set of synchronized controlled hosts.

  • Before moving on to "Docker service" I suggest you start slowly until you acquire proefficiency to work with it. Start with "Docker run" by running isolated images yet one image may need the other. So after a while, you’ll understand how to best use the Docker-Compose. It’s a matter of maturing in technology.

  • thanks to all for the answers

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.