Kishan
Kishan

Reputation: 73

Docker Compose & Volumes issues

I have been trying to run the my docker-compose.yml file for 2-3 days and have spent so much time finding the fix on internet but nothing seems to be working. The host computer is Windows 10 and Docker computer is Linux.

Created volume using this command: docker volume create --driver local --opt type=none --opt device='C:\Users\Kishan\Desktop\db' --opt o=bind mssqldb

and following is my docker-compose.yml file

version: '3.8'

services:
   db:
     image: mcr.microsoft.com/mssql/server:2017-latest
     volumes:
       - mssqldb:/opt/var/mssql/data
     environment:
       - ACCEPT_EULA=Y
       - SA_PASSWORD=yourStrong@Password
       - COMPOSE_CONVERT_WINDOWS_PATHS=1
     restart: always
     ports:
       - "1433:1433"

   api:
     depends_on:
       - db
     entrypoint: ["./wait_for.sh", "db:1433", "-t", "3600", "--", "execute", "api"]
     image: api:latest
     ports:
       - "80:80"
     restart: always

volumes:
    mssqldb:
        external: true

I am not sure its runs without any error but I see no database files (MDF & LDF files) getting created in my C:\Users\Kishan\Desktop\db. Can somebody please help me?

Upvotes: 3

Views: 760

Answers (1)

frank_lee
frank_lee

Reputation: 431

change the volume destination from - mssqldb:/opt/var/mssql/data to - mssqldb:/var/opt/mssql

Upvotes: 1

Related Questions