[JAVA] Link WAS and FLASK applications on docker

At the beginning

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

Premise

Development environment

DOcker configuration

WAS and Flask docker-compose.yml are separate

About setting to communicate Container between different docker-compose.yml

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

Create a new network

Please read Docker-docs-da for how to create a new network with docker.

Modify docker-compose.yml

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

Application fix

WAS application fix

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

Flask application fix

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

Link WAS and FLASK applications on docker
docker and PyCharm under proxy on windows
I was addicted to Flask on dotCloud
Launch Flask application with Docker on Heroku
pykintone on Docker
Notes on Flask
Run the flask app on Cloud9 and Apache Httpd
Output log to console with Flask + Nginx on Docker
Install and develop Git, VSCode, Docker on Chrome OS
Install Docker on Arch Linux and run it remotely
Installation of Docker on Raspberry Pi and L Chika
Install docker on Fedora31
goland and Docker settings
jsonschema validation on flask
Install Docker on AWS
Install Python 3.6 on Docker