nvidia tensorflow, docker-compose and container communication with tensorflow

114 views Asked by At

I have a server with an Nvidia GPU (rtx 3060), and I am setting up a tensorflow container with docker-compose, with support for the GPU with the official Nvidia image. So far so good. If I enter the container I can import tensorflow successfully, and see the GPU support works. But what I really need is for the other containers (backend, locator) that I have mounted on the same docker network to use the tensorflow container when they need to use it. All containers are mounted on the same docker network. However, when the code tries to import tensorflow from the locator or from the backend, it already gives an error. The idea is that the tensoflow container processes the tensorflow, backend and locator tasks benefiting from the use of the GPU and I have not achieved it. If anyone can help me with this I would appreciate it. Or should I change the architecture of things? My docker-compose.yml currently is:


services:

  tensorflow:
    container_name: tensorflow
    image: nvcr.io/nvidia/tensorflow:23.10-tf2-py3
    runtime: nvidia
    command: [ "bash", "-c", "while true; do sleep 1; done" ]
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
    ipc: host
    ulimits:
      memlock: -1
      stack: 67108864
    ports:
      - "6006:6006"
    networks:
      - app_network
    restart: always

  locator:
    container_name: locator
    image: registry.gitlab.com/airgo/air-go-locator:accelerometer
    volumes:
      - ./configs:/configs
      - ./logs/locator:/configs/logs
      - ./sniffing:/app/sniffing
    ports:
      - "5000:5000/udp"
      - "3788:3788"
      - "3787:80"
    networks:
      - app_network
    depends_on:
      - rabbitmq
      - backend
      - tensorflow
    restart: always

  backend:
    container_name: backend
    image: registry.gitlab.com/airgo/air-go-healthcare-system/backend:develop_dockerize
    volumes:
      - ./configs:/configs
      - ./logs/backend:/app/logs
      - ./media:/app/media
    ports:
      - "88:8000"
    networks:
      - app_network
    depends_on:
      - postgres
    restart: always

  postgres:
    container_name: postgres
    image: postgis/postgis:14-3.3
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      PGDATA: /data/postgres
    volumes:
      - ./data/postgres:/data/postgres
    ports:
      - "5432:5432"
    networks:
      - app_network
    restart: always

networks:
  app_network:
0

There are 0 answers