I am setting up CVAT and FiftyOne on a server, and I am having trouble with the communication between both applications.
I followed CVAT self-hosted installation instructions to setup CVAT.
This includes several containers among which cvat_server
and traefik
as well as a cvat_cvat
network, all defined in the docker-compose.yml
file of cvat source code.
I defined 127.0.0.1
as host for CVAT prior to launching the containers, with export CVAT_HOST=127.0.0.1
.
The port for CVAT server is 8080.
I have written another docker-compose.yml
file to define my FiftyOne container, based on the example at the end of the page for the FiftyOne Docker image.
In this file, I linked the FiftyOne container with the cvat_cvat
network.
I also included Traefik labels.
The contents of FiftyOne's docker-compose.yml
file are:
version: '3.8'
services:
fiftyone:
command: ['python', '/usr/local/lib/python/dist-packages/fiftyone/server/main.py', '--port', '5151']
environment:
FIFTYONE_DEFAULT_APP_ADDRESS: 0.0.0.0
image: voxel51/fiftyone:latest
ports:
- 5151:5151
volumes:
- type: bind
source: /path/to/fiftyon/shared
target: /fiftyone
networks:
- cvat_cvat
labels:
- traefik.enable=true
- traefik.http.services.fiftyone.loadbalancer.server.port=5151
- traefik.http.routers.fiftyone.rule=Host(`${CVAT_HOST:-localhost}`)
- traefik.http.routers.fiftyone.entrypoints=web
networks:
cvat_cvat:
external: true
I am having trouble sending annotations requests from the FiftyOne container the CVAT server container. From the host machine, I can curl the CVAT server: curl http://127.0.0.1:8080
. But from within the FiftyOne container, the same curl command fails (returns Failed to connect to 127.0.0.1 port 8080: Connection refused
).
How can I configure my containers to allow HTTP traffic on port 8080 from the FiftyOne to the CVAT container?
For information, I managed to allow communication by setting the FiftyOne container in host network mode (i.e. by adding network_mode: "host"
in the FiftyOne docker-compose.yml
file). But I would like to use Traefik for this issue because, if I understand correctly: 1/ Traefik is already setup by CVAT self-hosted installation and is designed to handle such issues, 2/ the host network mode solution removes the purpose of container isolation.
My issue was caused by the address I used to communicate from the FiftyOne container to the CVAT container.
127.0.0.1 (localhost) within a container is always the container's localhost, and not the host's.
Containers on the same network are discoverable by their service's name (as described in the docs).
So my case is solved when using curl http://cvat_server:8080
from within the FiftyOne container.
As a side note, I now understand that Traefik handles communication from the outside world to my infrastructure, and not communication within my infrastructure (answers point 1/ in last paragraph of my question).