| 1. |
Also You Mention That Docker Allows Multiple Apps To Run On One Server.? |
|
Answer» It depends on your use case. You probably should split different components into separate containers. It will give you more flexibility. Docker is very lightweight and running containers is cheap, especially if you STORE them in RAM – it’s possible to SPAWN new container for every http callback, however it’s not very practical. At WORK I develop using set of five different types of containers linked together. In production some of them are actually replaced by real machines or EVEN clusters of machine – however settings on APPLICATION level don’t change. Here you can read more about linking containers. It’s possible, because everything is communicating over the network. When you specify links in dockerrun command – docker bridges containers and injects environment variables with information about IPs and ports of linked children into the parent container. This way, in my app settings file, I can read those values from environment. In python it would be: import os VARIABLE = os.environ.get('VARIABLE') There is a tool which greatly simplifies working with docker containers, linking included. It’s called fig and you can read more about it here. It depends on your use case. You probably should split different components into separate containers. It will give you more flexibility. Docker is very lightweight and running containers is cheap, especially if you store them in RAM – it’s possible to spawn new container for every http callback, however it’s not very practical. At work I develop using set of five different types of containers linked together. In production some of them are actually replaced by real machines or even clusters of machine – however settings on application level don’t change. Here you can read more about linking containers. It’s possible, because everything is communicating over the network. When you specify links in dockerrun command – docker bridges containers and injects environment variables with information about IPs and ports of linked children into the parent container. This way, in my app settings file, I can read those values from environment. In python it would be: import os VARIABLE = os.environ.get('VARIABLE') There is a tool which greatly simplifies working with docker containers, linking included. It’s called fig and you can read more about it here. |
|