Skip to content

Instantly share code, notes, and snippets.

@ivuorinen
Last active January 21, 2020 09:33
Show Gist options
  • Save ivuorinen/e23f53cffe37a0025986b6b9e647310b to your computer and use it in GitHub Desktop.
Save ivuorinen/e23f53cffe37a0025986b6b9e647310b to your computer and use it in GitHub Desktop.
Docker MSSQL Database: Copy backup to container
# Run these as root or prefix with sudo on the Docker host machine
# $MACHINE = Container ID, or part of it.
# Usually 3 first chars are enough. Get it with `docker ps|grep mssql-server`
# Create backup folder
docker exec -it $MACHINE mkdir /var/opt/mssql/backup
# Copy backups to the machine
docker cp backup.bak $MACHINE:/var/opt/mssql/backup
# Might work, haven't tried
docker cp */**/*.bak $MACHINE:/var/opt/mssql/backup
# Then import them in SQL Server Management Studio, or your preferred way
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment