I have a SQL Server on a docker container ( microsoft/mssql-server-linux
) I want to Backup the database remotely using Powershell command.
So The final result will be that a .bak
file would be added to the container. Does anyone knows if it is possible, and how?
yes! microsoft/mssql-server-linux
is based on ubuntu 16.04 and its possible to use scp
from inside container to your host!use docker exec -it {container_id} bash
to access your container terminal! after creating .bak
file with this guid:
the file is inside your container!use scp
to copy over ssh!
here is a hint about how to scp
from linux to windows: https://stackoverflow.com/a/37712656/4708874
Backing up the database should work no differently just because the SQL Server is running in a container. That is, issuing a backup database [yourDB] to disk = '«some file path»';
will work. Now, whether that file path is internal to the container or external (ie you are using a persistent volume) depends on how you started the docker instance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.