Docker Community Forums

Share and learn in the Docker community.

What is best method to transfer data between containers?

Hi everyone,
Currently i am building 3 containers which contain my C++ application, they need a connectivity protocol among each others for transferring data ( like 1st will send to 2nd, 2nd will send to 3rd). Right now socket programming is my choice, but i do hope someone could recommend me another method.
Is Kubernetes provide any of those? i don’t mind to install it over my system as long as it could help me.

It depends… (I hate that answer :wink: ).

What is the nature of the communication? Is it 3 different application with their own functionalities or is it 3 instances of the same application?

If it is the first, then a REST-API, JSON over a socket or whatever peer-to-peer communication would work. If it is data sync, I would use something like Redis or Memcache to store the shared state.

But can you elaborate on the solution a bit?

1 Like

It is exactly the first case, each application has its own functionalities and a type of data to be transferred. Right now i am using socket programming which is kinda basic, could be found anywhere on C++ tutorial. Anyway, i will take a look at your recommendation :slight_smile: thanks!

in the end, everything comes down to socket communication eventually. But designing a good API between the different parts in the system is really important.

Take a look at:

Google searches to get you started:

  • service-oriented design
  • microservices with docker
  • designing software api
1 Like