0

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?

Dan The Man
  • 1,835
  • 6
  • 30
  • 50

2 Answers2

1

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:

https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-backup-and-restore-database?view=sql-server-2017

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

0

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 (i.e. you are using a persistent volume) depends on how you started the docker instance.

Ben Thul
  • 31,080
  • 4
  • 45
  • 68