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?

2 Answers 2

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

5
  • Can I use backup command without getting bash access to inside of the container, my goal is to use rest request to the listening sql container, to backup. Commented Nov 11, 2018 at 9:26
  • I am getting the following "bash: mysqldump: command not found" Commented Nov 11, 2018 at 10:07
  • for the first comment, you can but you need to write a web service or you can use an open source project here: github.com/arut/nginx-mysql-module Commented Nov 11, 2018 at 21:22
  • mysql != mssql. As such, I wouldn't expect a backup command for the former to work on the latter.
    – Ben Thul
    Commented Nov 11, 2018 at 21:27
  • oh sorry!these days I work on different projects with different RDBMS and I mixed them up! I edited my answer thank you @BenThul Commented Nov 11, 2018 at 21:44
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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.