docker-composeliquibasedocker-desktopdocker-for-windows

Docker volume mapping is not showing files


I have a Liquibase image created via a Docker compose file. I would like to mount a local folder so I can access some files that are required by the update command.

Within the container the mynewchangelog folder is getting created, but there are no files inside.

I was expecting to see all the respective files and folders from my local drive in there.

I'm new to docker, am I doing something fundamentally wrong?


Docker compose file: (note that the servers.json is mapped correctly in the pgadmin container and the ./data and ./mydb-backup.sql are mapped correctly in the db container)

services:

  db:
    image: postgres:13.13
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=mydb
    volumes:
      - ./data:/var/lib/postgresql/data
      - ./mydb-backup.sql:/docker-entrypoint-initdb.d/mydb-backup.sql
    ports:
      - "5432:5432"

  pgadmin:
    image: dpage/pgadmin4
    environment:
      - PGADMIN_DEFAULT_EMAIL=admin@example.com
      - PGADMIN_DEFAULT_PASSWORD=root
    ports:
      - "8081:80"
    depends_on:
      - db
    volumes:
      - ./servers.json:/pgadmin4/servers.json

  liquibase:
    image: liquibase:latest
    depends_on:
      - db
      - pgadmin
    # Volume to add the liquibase collection of scripts
    volumes:
      - ./changelog:/liquibase/mynewchangelog
    # Command to run the liquibase update service
    command: update --url="jdbc:postgresql://db/mydb" --changeLogFile=/liquibase/mynewchangelog/dbchangelog.yaml --username=postgres --password=postgres

Local folder structure and files:

local folder and files

Docker desktop bind mounts show the local folder and container folder are mapped:

docker desktop bind mounts

Docker debug shows the mapped folder has been created in the container, but no files.

enter image description here


Solution

  • The files are there, but...

    I changed the mappings to --changeLogFile=./mynewchangelog/dbchangelog.yaml, so from a root /liquibase path to a respective path.

    The files still don't appear during debug but they are being found during the init, and being executed.