Link 2 projects on your Desktop using the API
You might occasionally want to link two active projects on your Docker desktop.
When your computer wants to connect to a website, it needs to talk to a DNS server to convert the URL to an IP Address same as the Docker desktop.
You must convert the URL to an IP Address of the competing project in order to launch or connect the two projects. Simply adhere to these few procedures to accomplish this:
- The two projects must be active on your Docker desktop.
- Go to each project's bash
docker exec -ti <container-name> bash
- To view the IP addresses, open each host's file in the /etc folder.
cd ../etc
- Convert the IP address or a host of the rival project
Scenario:
In this example, I want to request an API to read the IP address of the other project from the backend recruitment.
Project 1: Recruitment Backend
- Container name: recruitment-backend
- IP Address:
Project 2: Recruitment Frontend
NOTE: for our front-ends run: docker exec -ti recruitment sh
- Container name: recruitment-frontend
Refer to the attached photos.
Step 1
Step 2
To save your modifications in vim:
1. press ESC
2. type :wq
If VIM is not found, install by running this commands:
Front-end / sh
Back-end/bash
1.
2.