Docker is a free software created by Docker Inc. and it enables clients to create free and confined environments where the users can deploy their applications.
A container is a standard unit of software that packages up code and all its dependencies from one computing environment and runs it quickly and reliably into another computing environment.
Container linking allows multiple containers to link with each other. Linking the containers, provide a secure channel through which Docker containers can communicate with each other. This article describes the step-by-step process of container linking.
- Installed docker software in your respective operating system.
Follow the below steps to link your c
- Step 1:The first step is to download the Jenkins image from the docker hub repository using the below command:
sudo docker Jenkins pull
- Step 2: Once you have downloaded the image, the next step is to run the container. Here you can also specify a name to the container using the name option. To do so follow the below command.
sudo docker run –name=jenkinsa -d jenkins
- Step 3: Now after creating the source container, it’s time to launch the destination container. Along with launching the destination container, we will also link it with the source container. For our destination container, we will be using the standard Ubuntu image, you can also use any other image according to your convenience. Use the below command to launch and link the containers:
sudo docker run –name=jenkinsc –link=jenkinsa:alias-src -it ubuntu:latest /bin/bash
- Step 4: You can use the below command to check which two containers are running.
sudo docker ps
- Step 5: Now in this step we will attach to the receiving container using the below command.
sudo docker attach Jenkins
- Step 6: After attaching to the receiving container you can run the below command and you will notice new variables for linking with the source container.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.