'error while removing network: <network> id has active endpoints

I am trying run docker compose down using jenkins job. "sudo docker-compose down --remove-orphans"

I have used --remove-orphans command while using the docker-compose down. Still it gives below error.

Removing network. abc error while removing network: network id ************ has active endpoints Failed command with status 1: sudo docker-compose down --remove-orphans

Below is my docker compose:

version: "3.9"
services:
  abc:
    image: <img>
    container_name: 'abc'
    hostname: abc
    ports:
      - "5****:5****"
      - "1****:1***"
    volumes:
      - ~/.docker-conf/<volume>
    networks:
      - <network>

      
  container-app-1:
    image: <img2>
    container_name: 'container-app-1'
    hostname: 'container-app-1'
    depends_on:
      - abc
    ports:
      - "8085:8085"
    env_file: ./.env
    networks:
      - <network>

networks:
  <network>:
    driver: bridge
    name: <network>


Solution 1:[1]

There is a situation when there are no containers at all, but there is an error. Then systemctl restart docker helped me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1