I have a docker-compose.yml
having this lines.
version: "3.9"
services:
mssql:
image: localhost/local_mssql_server:mssqlserver
ports:
- "1433:1433"
volumes:
- sqlfolder1234:/var/opt/mssql
The Docker is starting up successfully and serving data.
But I seldom work with windows and I like to know where is the host-folder sqlfolder1234
?
I tried the windows-explorer to search for that folder. Since an hour he not finished yet.
Where is that folder sqlfolder1234
on my host system?
CodePudding user response:
This volume type is called Named volume
Here is some description from the official document. Short syntax
In the absence of having named volumes with specified sources, Docker creates an anonymous volume for each task backing a service. Anonymous volumes do not persist after the associated containers are removed.
volumes:
# Just specify a path and let the Engine create a volume
- /var/lib/mysql
# Specify an absolute path mapping
- /opt/data:/var/lib/mysql
# Path on the host, relative to the Compose file
- ./cache:/tmp/cache
# User-relative path
- ~/configs:/etc/configs/:ro
# Named volume
- datavolume:/var/lib/mysql
If you want to keep persistent data in your host computer, I would use another volume way to do that. this sample provides Path on the host, relative to the Compose file that help us can see the volumn folder in the docker-compose file level.
volumes:
- ./sqlfolder1234:/var/opt/mssql