microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.74k stars 759 forks source link

Why isn't sqlpackage bundled in the Docker image? #633

Open jez9999 opened 4 years ago

jez9999 commented 4 years ago

As it's becoming increasingly common to use Azure SQL DBs these days, and in order to backup/restore these you need to use a .bacpac file and sqlpackage to import it, it seems odd to me that sqlpackage isn't bundled for convenience in the /opt/mssql-tools/bin directory. Could it be added?

JeremyVriens commented 4 years ago

+1 for this request. I've solved it with a Docker multi-stage build (https://docs.docker.com/develop/develop-images/multistage-build/), where I install the sqlpackage in the "builder" stage and copy the executable over to the production image.

nlavalle commented 3 years ago

+1 for this request as well. There is an evergreen link for sqlpackage for linux even, so here's what I've been using in a Dockerfile in the meantime in case it helps anyone:

#Connect with docker run -p 1433:1433 test/local-sql
FROM mcr.microsoft.com/mssql/server

WORKDIR /sql

# Root needed for apt-get install, switch to mssql after
USER root

# Install Unzip
RUN apt-get update \
    && apt-get install unzip -y

# Install SQLPackage for Linux and make it executable
RUN wget -progress=bar:force -q -O sqlpackage.zip https://aka.ms/sqlpackage-linux \
    && unzip -qq sqlpackage.zip -d /sql/sqlpackage \
    && chmod +x /sql/sqlpackage/sqlpackage

USER mssql

EXPOSE 1433
jcgillespie commented 3 years ago

@nlavalle I’m doing something similar, but I’ve been using the sqlpackage image as a utility in a multistage build

https://github.com/jcgillespie/mssql-sqlpackage-docker