Use the below-mentioned steps to link containers in a docker-compose file:-
Firstly, create a custom Docker network named consumer-producer network.
After that start container named producer using image employee-producer and the custom network consumer-producer.
Lastly, start a container named consumer using image employee-consumer and the custom network consumer-producer.
All the above steps can be automated using docker-compose. The compose file will be as follows:-
If you want to learn Docker then I would suggest you must take up the following Docker Training Course. If you are more into reading stuff then you can read the following Docker tutorial. Here is a video tutorial regarding Docker which you must watch to learn all the basics of it.