Just SqlPackage in a Docker image. It also includes SqlCmd.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
SqlPackage is a Microsoft tool for importing and exporting bacpac and dacpac files from SQL Server.
This Docker image contains sqlpackage and is designed for when you want to run SqlPackage without installing it locally.
This image also contains sqlcmd
. This makes this image very useful for running basic SQL Server tasks.
Run from current release.
docker run --rm -it ghcr.io/ark667/sqlpackage:master sqlpackage
Build the image locally.
docker build --tag sqlpackage .
Make a database backup. After execution, the bacpac file will be placed in sqlpackage folder of the current prompt.
docker run --rm -it --network host -v "$($PWD)/sqlpackage:/home" ghcr.io/ark667/sqlpackage:master sqlpackage `
/Action:Export `
/SourceServerName:"[host],[port]" `
/SourceDatabaseName:"[database]" `
/SourceUser:"[user]" `
/SourcePassword:"[password]" `
/TargetFile:"/home/backup.bacpac"
Make a database restore. The imported bacpac must be placed in sqlpackage folder of the current prompt, and database shoud not exists.
docker run --rm -it --network host -v "$($PWD)/sqlpackage:/home" ghcr.io/ark667/sqlpackage:master sqlpackage `
/Action:Import `
/TargetServerName:"[host],[port]" `
/TargetDatabaseName:"[database]" `
/TargetUser:"[user]" `
/TargetPassword:"[password]" `
/SourceFile:"/home/backup.bacpac"
Deploy a database schema. A folder containing the dacpac file is needed.
docker run --rm -it --network host -v "[dacpac_folder]:/home" ghcr.io/ark667/sqlpackage:master sqlpackage `
/Action:Publish `
/TargetServerName:"[host],[port]" `
/TargetDatabaseName:"[database]" `
/TargetUser:"[user]" `
/TargetPassword:"[password]" `
/SourceFile:"/home/[dacpac_file]"
Delete a database. Highly dangerous!
docker run --rm -it --network host ghcr.io/ark667/sqlpackage:master sqlcmd `
-S "[host],[port]" `
-U "[user]" `
-P "[password]" `
-Q "use [databsae];alter database [database] set single_user with rollback immediate;use master;drop database [database];"
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Aingeru Medrano - @AingeruBlack
Project Link: https://github.com/Ark667/SqlPackage