![Docker Tutorial](/docker/images/docker-mini-logo.jpg)
- Docker Tutorial
- Docker - Home
- Docker - Overview
- Docker - Installing on Linux
- Docker - Installation
- Docker - Hub
- Docker - Images
- Docker - Containers
- Docker - Registries
- Docker - Compose
- Docker - Working With Containers
- Docker - Architecture
- Docker - Layers
- Docker - Container & Hosts
- Docker - Configuration
- Docker - Containers & Shells
- Docker - Dockerfile
- Docker - Building Files
- Docker - Public Repositories
- Docker - Managing Ports
- Docker - Web Server
- Docker - Commands
- Docker - Container Linking
- Docker - Data Storage
- Docker - Networking
- Docker - Security
- Docker - Toolbox
- Docker - Cloud
- Docker - Logging
- Docker - Continuous Integration
- Docker - Kubernetes Architecture
- Docker - Working of Kubernetes
- Docker Setting Services
- Docker - Setting Node.js
- Docker - Setting MongoDB
- Docker - Setting NGINX
- Docker - Setting ASP.Net
- Docker Setting - Python
- Docker Setting - Java
- Docker Setting - Redis
- Docker Setting - Alpine
- Docker Setting - BusyBox
- Docker Useful Resources
- Docker - Quick Guide
- Docker - Useful Resources
- Docker - Discussion
Docker - Container Linking
Container Linking allows multiple containers to link with each other. It is a better option than exposing ports. Let’s go step by step and learn how it works.
Step 1 − Download the Jenkins image, if it is not already present, using the Jenkins pull command.
![Container Linking](/docker/images/container_linking.jpg)
Step 2 − Once the image is available, run the container, but this time, you can specify a name to the container by using the –-name option. This will be our source container.
![Name Option](/docker/images/name_option.jpg)
Step 3 − Next, it is time to launch the destination container, but this time, we will link it with our source container. For our destination container, we will use the standard Ubuntu image.
![Standard Ubuntu Image](/docker/images/standard_ubuntu_image.jpg)
When you do a docker ps, you will see both the containers running.
Step 4 − Now, attach to the receiving container.
![Receiving Container](/docker/images/receiving_container.jpg)
Then run the env command. You will notice new variables for linking with the source container.
![New Variables](/docker/images/new_variables.jpg)
![Source Continer](/docker/images/source_container.jpg)