I can not connect two containers into the same network

I am trying to connect two different services into the same network. I have two Dockerfiles that I am using to build each container.

The first one is:

FROM ubuntu:20.04
ENV TZ=America/Argentina/Buenos_Aires
ENV FLASK_ENV=development
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y && apt-get install -y python3-pip python3-dev npm
RUN npm init -y
RUN npm install bootstrap bootswatch
COPY . /BB_Comparator
RUN ln -sf /node_modules /BB_Comparator/node_modules
WORKDIR /BB_Comparator
RUN pip3 install -r requirements.txt

This is the other one:

FROM python:2.7
COPY . /BB_Comparator
WORKDIR /BB_Comparator
RUN pip install -r requirements.txt
ENTRYPOINT [ "python"]
CMD ["app.py"]

As you can see, one container is running with ubuntu and the other is running a flask app with Python2.7

I ran both containers with the following commands:


docker run --name preprocessor-container -v bbcomparator-volume:/BB_Comparator/uploads/preprocessor_files preprocessor


docker run -dt --name bbcomparator-container -v bbcomparator-volume:/app/uploads/preprocessor_files bbcomparator


I created a network to connect both container into the same one:

docker network create bb_comparator_network

and I added both containers:

docker network connect bb_comparator_network bbcomparator-container


docker network connect bb_comparator_network preprocessor-container


Finally, when I tried to ping the Ip address from the bbcomparator-container (ubuntu) to preprocessor-container (python2.7) I have
the following response: ping: Name or service not known