Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Devops
  3. Question
Devops

Linking containers.

Asked by Jan Ferguson Nov 28, 2019 1.5K views 1 answer
Share

Your answer

1 Answer

Jan Ferguson Latest answer

Answered on Nov 12, 2019

 More than one containers can be linked in docker to achieve communication b/w them.

For eg - If you have apache installed in container 1 and php-mysql in container 2 then both of these can be linked together to achieve a full LAMP stack architecture.

To link containers use below command

docker run -it --name container 2 --link container 1 -d

and both the containers will be linked together.

Also, containers can be linked via compose file also.

“links” parameter can be used with container name within compose file to link the containers straightaway.


Was this helpful?

More Devops discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest DevOps Blogs

Guides, tips and career advice on DevOps from JanBask experts.