dockerdocker-composedockerfiledevopssre

how we set name of docker network in docker-compose


write docker-compose file make multi containe. when i use docker-compose up commend it work fine but again i down docker it give **error will removing network **

Stopping sonarqube       ... error
Stopping note_sonatype_1 ... error
Stopping postgresql      ... error

ERROR: for note_sonatype_1  cannot stop container: cd53bbecf38d8410080acec380ce0c60e8012126f51f8db207405550c9ff3c6c: permission denied

ERROR: for sonarqube  cannot stop container: 843d0bb0833d084b214458fffc0f5a95512186e43a1eea1fe65727dad41639e4: permission denied
Removing network note_default
ERROR: error while removing network: network note_default id 344d6bd7391cfa94a1d8e36d79893ef0c7b7ee247df93d0a34766df9412ba581 has active endpoints

Configurstion in my yml file is listed below.

services:
  db:
    container_name: postgresql
    environment:
      POSTGRES_DB: sonar
      POSTGRES_PASSWORD: sonar
      POSTGRES_USER: sonar
    hostname: postgresql
    image: postgres:13
    volumes:
    - postgresql:/var/lib/postgresql:rw
    - postgresql_data:/var/lib/postgresql/data:rw
  sonarqube:
    container_name: sonarqube
    depends_on:
      db:
        condition: service_started
    environment:
      SONAR_JDBC_PASSWORD: sonar
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
    hostname: sonarqube
    image: sonarqube:community
    ports:
    - published: 9000
      target: 9000
    volumes:
    - sonarqube_data:/opt/sonarqube/data:rw
    - sonarqube_extensions:/opt/sonarqube/extensions:rw
    - sonarqube_logs:/opt/sonarqube/logs:rw
  sonatype:
    image: sonatype/nexus3
    ports:
    - published: 8081
      target: 8081
    volumes:
    - sonatype-data:/data/db:rw
version: '3'
volumes:
  postgresql:
    driver: local
  postgresql_data:
    driver: local
  sonarqube_data:
    driver: local
  sonarqube_extensions:
    driver: local
  sonarqube_logs:
    driver: local
  sonatype-data:
    driver: local

I have tried to use multiple permutation and combination of these configs, but no luck.


Solution

  • ''' Just uninstall the snap docker if you install '''