skip to Main Content

I have the following docker compose :

services:
  db:
    container_name: Postgres_Server
    image: 'postgis/postgis:latest'
    restart: always
    volumes: 
    - dbdata:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: root
      POSTGRES_DB: routingfinder
    ports:
      - "5432:5432"
  pgadmin:
    container_name: PgAadmin4
    image: dpage/pgadmin4:8.13
    restart: always
    volumes: 
    - pgadmin:/var/lib/postgresql/data
    environment:
      PGADMIN_DEFAULT_EMAIL: [email protected]
      PGADMIN_DEFAULT_PASSWORD: root
    ports:
      - "5050:80"
  rabbitmq:
    image: rabbitmq:3-management-alpine
    container_name: 'rabbitmq'
    ports:
        - 5672:5672
        - 15672:15672
    volumes:
        - rabbitData:/var/lib/rabbitmq/
        - rabbitLogs:/var/log/rabbitmq
    networks:
        - rabbitmq_go_net
networks:
  rabbitmq_go_net:
    driver: bridge
volumes:
  dbdata:
   name: myDBDataVolume
  pgadmin:
   name: myPGDataVolume
  rabbitData :
   name: myRabbitData
  rabbitLogs:
   name: myRabbitLogs

This generates the correponding volumes + a not named one with the following :

{
    "CreatedAt": "2024-11-14T11:20:24Z",
    "Driver": "local",
    "Labels": {
        "com.docker.volume.anonymous": ""
    },
    "Mountpoint": "/var/lib/docker/volumes/7b51284e5bf24fcf3ba6abae63b3f10a28cecde08781f5ae3610acab2224a3e7/_data",
    "Name": "7b51284e5bf24fcf3ba6abae63b3f10a28cecde08781f5ae3610acab2224a3e7",
    "Options": null,
    "Scope": "local"
}

This is seen after a docker volume prune -a to start from scratch.

So I have 3 services and 4 volumes should be created.

Does someone know where this not named volume can come from?

Many thanks in advance.

PS : When inspecting the volume I am getting:

[
    {
        "Id": "a7baeacb008a9ac8fda66136a6ea7584de1fda920e21adcebf97fbcf8040b329",   
        "Created": "2024-11-14T15:35:24.679409272Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 13254,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2024-11-14T15:35:24.831942066Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:08d9a1b66edb76839d9dd5c0c5192f73f2e859c8356de5f719ddcde1b2207223",
        "ResolvConfPath": "/var/lib/docker/containers/a7baeacb008a9ac8fda66136a6ea7584de1fda920e21adcebf97fbcf8040b329/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/a7baeacb008a9ac8fda66136a6ea7584de1fda920e21adcebf97fbcf8040b329/hostname",
        "HostsPath": "/var/lib/docker/containers/a7baeacb008a9ac8fda66136a6ea7584de1fda920e21adcebf97fbcf8040b329/hosts",
        "LogPath": "/var/lib/docker/containers/a7baeacb008a9ac8fda66136a6ea7584de1fda920e21adcebf97fbcf8040b329/a7baeacb008a9ac8fda66136a6ea7584de1fda920e21adcebf97fbcf8040b329-json.log",
        "Name": "/Postgres_Server",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "route-find_default",
            "PortBindings": {
                "5432/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "5432"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "host",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": [],
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "Mounts": [
                {
                    "Type": "volume",
                    "Source": "myDBDataVolume",
                    "Target": "/data/postgres",
                    "VolumeOptions": {}
                }
            ],
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware",
                "/sys/devices/virtual/powercap"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/861fa3c684f5d70e042f7faffb0e1e1c0209eadbd535b58c1c50c9d2d0bf0dbf-init/diff:/var/lib/docker/overlay2/2d30bc44b992d4b0cbc11dafbe2f01a1e327fe0c2df84d77c0f08fd5daba047b/diff:/var/lib/docker/overlay2/b277aa31baa92e3d37ae5574e5337712cdd630836e2bdaec8f5c937ba8f95492/diff:/var/lib/docker/overlay2/747b9b0defbffab43dfe86f5dc72f7da248c70afc1f47c78706d63b6737a029c/diff:/var/lib/docker/overlay2/6f9fb4926202f546910fb0c8fdafe91d110eb49d7f91d102e7fbc8a64dd09d97/diff:/var/lib/docker/overlay2/a0c8f5aeba2f6f421ca15dbe7fb82fc0ba997f1dbe94796b2b63ff98b437fe49/diff:/var/lib/docker/overlay2/0eef92e3e7ae8e49139b843f205d84139b6e7d47edef5a7b3be5ca56b1b08115/diff:/var/lib/docker/overlay2/944e10d5c22723a985d65b4f1e7f6291458cedc352aa4cc86dfed3538a97c974/diff:/var/lib/docker/overlay2/6826f4c45fba7f51b9dc7a68f488f4cf034a702a8f502eddbf7b7e9af5a728f8/diff:/var/lib/docker/overlay2/eeecd44050af576bf13524a5c51d3977f5579579aaca9e4da3eeffde12345bde/diff:/var/lib/docker/overlay2/f8ad9f4d1424e1fe6a828be301d9752d46b2f91589aeb5b33f1ac604eda603a3/diff:/var/lib/docker/overlay2/e8d18170da08bf21e71619eda8686013fe1602707e54ed0c827e82e6eec8b81f/diff:/var/lib/docker/overlay2/4796b0e5608d3c81ca94515b7fbc5ce0682d157fe9e2b6ae06666e5ffcb5a2bf/diff:/var/lib/docker/overlay2/be56c9c5f5cd06f3557d638d2e07f9261e3b1afcfd2110148cc73035e817fe69/diff:/var/lib/docker/overlay2/56ef1f0d455181e3caebcd662731623c0e54dee888c4365f05a5294aefc2b8e5/diff:/var/lib/docker/overlay2/d398a847347dc0539bfa016ffca4de3b4a26c4daeccd84bb8c3e02381f41b4d7/diff:/var/lib/docker/overlay2/a80b08c19c59d5a3338c73b102f9a223d11ce7b7a34605b6b5fbafccc080247a/diff:/var/lib/docker/overlay2/a33d40236039989a070e181fbb0b7499b2e6b6b8c924acebc214ed5b80761ec7/diff:/var/lib/docker/overlay2/c7f01391f91369148a063fc67855e43d607ac92e7057c8139ea57a4d01fb55c8/diff",        
                "MergedDir": "/var/lib/docker/overlay2/861fa3c684f5d70e042f7faffb0e1e1c0209eadbd535b58c1c50c9d2d0bf0dbf/merged",
                "UpperDir": "/var/lib/docker/overlay2/861fa3c684f5d70e042f7faffb0e1e1c0209eadbd535b58c1c50c9d2d0bf0dbf/diff",
                "WorkDir": "/var/lib/docker/overlay2/861fa3c684f5d70e042f7faffb0e1e1c0209eadbd535b58c1c50c9d2d0bf0dbf/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "myDBDataVolume",
                "Source": "/var/lib/docker/volumes/myDBDataVolume/_data",
                "Destination": "/data/postgres",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "volume",
                "Name": "6cd33b4d21e86b97e344cc70aa585171af4f767c5877e5334d355b728d8842c6",
                "Source": "/var/lib/docker/volumes/6cd33b4d21e86b97e344cc70aa585171af4f767c5877e5334d355b728d8842c6/_data",
                "Destination": "/var/lib/postgresql/data",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "a7baeacb008a",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": true,
            "AttachStderr": true,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PGDATA=/data/postgres",
                "POSTGRES_USER=root",
                "POSTGRES_PASSWORD=root",
                "POSTGRES_DB=pass",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/17/bin",
                "GOSU_VERSION=1.17",
                "LANG=en_US.utf8",
                "PG_MAJOR=17",
                "PG_VERSION=17.0-1.pgdg110+1",
                "POSTGIS_MAJOR=3",
                "POSTGIS_VERSION=3.5.0+dfsg-1.pgdg110+1"
            ],
            "Cmd": [
                "postgres"
            ],
            "Image": "postgis/postgis:latest",
            "Volumes": {
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.config-hash": "c0a60f43ff08e14f4db00dfd0e86cc20c9ef026b43591d4a9ad3c2cd9a2f4a0a",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.depends_on": "",
                "com.docker.compose.image": "sha256:08d9a1b66edb76839d9dd5c0c5192f73f2e859c8356de5f719ddcde1b2207223",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "route-find",
                "com.docker.compose.project.config_files": "D:\projects\route-find\docker-compose.yml",
                "com.docker.compose.project.working_dir": "D:\projects\route-find",
                "com.docker.compose.service": "postgres",
                "com.docker.compose.version": "2.29.7",
                "maintainer": "PostGIS Project - https://postgis.net",
                "org.opencontainers.image.description": "PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 17 bullseye",
                "org.opencontainers.image.source": "https://github.com/postgis/docker-postgis"
            },
            "StopSignal": "SIGINT"
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "a63b41a8b411659326b6f16675c743ba2967f9ddbb502e919047892847348ac1",
            "SandboxKey": "/var/run/docker/netns/a63b41a8b411",
            "Ports": {
                "5432/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "5432"
                    }
                ]
            },
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "route-find_default": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "Postgres_Server",
                        "postgres"
                    ],
                    "MacAddress": "02:42:ac:13:00:03",
                    "DriverOpts": null,
                    "NetworkID": "f87af1b44d5376fc4b290b889e419a9e5066ec27a5fb7c2d1918923b3bfc16c1",
                    "EndpointID": "b625f53b46d8f34fd4753caaf2db9d822902144e8185ada32c742434a31c0d25",
                    "Gateway": "172.19.0.1",
                    "IPAddress": "172.19.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "DNSNames": [
                        "Postgres_Server",
                        "postgres",
                        "a7baeacb008a"
                    ]
                }
            }
        }
    }
]

With no clue …

2

Answers


  1. Chosen as BEST ANSWER

    Here is the final compose file that is working fine:

    services:
      postgis:
        image: 'postgis/postgis:17-3.5'
        container_name: PosgresServer
        restart: always
        ports:
          - "5432:5432"
        environment:
          POSTGRES_USER: root
          POSTGRES_PASSWORD: root
          POSTGRES_DB: lastkm
        volumes: 
          - local_pgdata:/var/lib/postgresql/data
      pgadmin:
        image: dpage/pgadmin4:8.13
        container_name: PgAadmin4
        restart: always
        ports:
          - "5050:80"
        environment:
          PGADMIN_DEFAULT_EMAIL: [email protected]
          PGADMIN_DEFAULT_PASSWORD: root
        volumes:
          - pgadmin-data:/var/lib/pgadmin
    
      rabbitmq:
        image: rabbitmq:3-management-alpine
        container_name: 'RabbitMQ'
        ports:
            - 5672:5672
            - 15672:15672
        volumes:
            - rabbitData:/var/lib/rabbitmq/
            - rabbitLogs:/var/log/rabbitmq
        networks:
            - rabbitmq_go_net
    networks:
      rabbitmq_go_net:
        driver: bridge
    volumes:
      local_pgdata:
        name: postGresData
      pgadmin-data:
        name: pgAdminData
      rabbitData :
       name: myRabbitData
      rabbitLogs:
       name: myRabbitLogs
    

  2. docker volume prune -a removes all unused volumes.
    Is the volume still in use? Check docker ps what is still running after stopping those 3 containers.
    Also check locations of your docker-compose.yml files docker compose ls .

    Backup the volume or check what’s inside i.e. /var/lib/docker/volumes/7b5../_data – then try to delete it manually with docker volume rm 7b5 this might give you a message like "cannot delete volume 7b5, it’s used by <container-id>.

    docker inspect <container-id> will help you to find out more.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search