Skip to content

New volume created on each container startup #70

Closed
@krzysiekzabawa

Description

@krzysiekzabawa

I do use fairly standard docker-compose file:

postgresql_backup:
    container_name: my-db-backup
    image: prodrigestivill/postgres-backup-local
    restart: always
    volumes:
        - /opt/db_backups/:/backups
    links:
        - postgresql_database
    depends_on:
        - postgresql_database
    environment:
        - POSTGRES_HOST=postgresql_database
        - POSTGRES_DB=my-db
        - POSTGRES_USER=user
        - POSTGRES_PASSWORD=password
        - POSTGRES_EXTRA_OPTS=-Z6 --schema=public --blobs
        - SCHEDULE=@daily
        - BACKUP_KEEP_DAYS=7
        - BACKUP_KEEP_WEEKS=4
        - BACKUP_KEEP_MONTHS=6
        - HEALTHCHECK_PORT=8080
    networks:
      - my_network

While service itself works fine and backups are created correctly when inspecting the docker container I see that it has 2 mounts created:

{
    "Type": "bind",
    "Source": "/opt/db_backups",
    "Destination": "/backups",
    "Mode": "rw",
    "RW": true,
    "Propagation": "rprivate"
},
{
    "Type": "volume",
    "Name": "1befc40bfde09598482a395405354b1dc1ff02973f4b600f4ea212ba7d568b33",
    "Source": "/var/lib/docker/volumes/1befc40bfde09598482a395405354b1dc1ff02973f4b600f4ea212ba7d568b33/_data",
    "Destination": "/var/lib/postgresql/data",
    "Driver": "local",
    "Mode": "",
    "RW": true,
    "Propagation": ""
}

While the first one is totally expected, the other one seems to be re-created on each container startup and remains empty. This inevitably results in trashing docker/volumes with many not needed and empty volumes.

Is that result of my setup or can it be improved in container itself?

Thanks for letting me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions