I tried to link WAS and Flask running on Dokcer I made an HTTP request from Flask to WAS and tried to get JSON data
WAS and Flask docker-compose.yml are separate
Since it is necessary to communicate Containers between different docker-compose.yml, define your own network configuration In particular
--Create a new network with the docker network create command --Modify docker-compose.yml to reflect the newly created network configuration
Please read Docker-docs-da for how to create a new network with docker.
Add the newly set docker network settings Please refer to the difference of the source on GitHub
-Difference of docker-compose.yml of WAS -Diff of docker-compose.yml in Python
Java: Start WAS with Docker and deploy your own application has been modified to return response information in JSON format. See the source on GitHub for details
The main correction points are as follows
--Added a process to send a Get request to the WAS Web application and receive data. (See the source on GitHub for details: https://github.com/triple4649/pythonweb/blame/master/app.py)
The point of modifying the source here is to specify the URL to be thrown to WAS by "container name + port name running on Docker". The network newly created on Docker is a substitute for DNS, and it links the IP address of the container with the container name, so when generating the URL, you can access with the container name instead of the IP address.
Recommended Posts