How to call one container from another container in Docker?

  c++, docker, docker-compose, dockerfile, python-3.x

I am new to Docker. It would be helpful if you can give a detailed implementation of the problem statement.

There is 1 container using dot net core image:

  1. .Net Core Application

Problem: In .Net Core Application, we are getting a list of URLs from the database and we need to pass the URL to a python script which will find all the subdomains of the URL.

Options Available :

  1. To install python and dependencies in the same dot net core image. But it increasing the size up to 500 MB.
  2. Using python image as a separate container.

I have created a DockerFile for python.

FROM python:3.10.0a1-alpine3.12
COPY ./list.txt /
COPY ./ /
RUN pip install dnspython

Image build command :

docker build -t subdomainpythonimage .

Image run command:

docker run -it --rm subdomainpythonimage python -d -w list.txt


Currently we are calling the above python script manually for testing.
But we need to call the above command from a .Net Core application running in a different container.
As per the DockerFile, we are just using it as a python interpreter.
Should we need to create HTTP Endpoint using a framework like Flask? Or how DockerCompose can help to achieve this task to allow us to pass URL and calling python script from a different container?

Source: Python-3x Questions