mssql-docker icon indicating copy to clipboard operation
mssql-docker copied to clipboard

Why isn't sqlpackage bundled in the Docker image?

Open jez9999 opened this issue 3 years ago • 3 comments

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?

jez9999 avatar Jul 24 '20 19:07 jez9999

+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.

JeremyVriens avatar Aug 03 '20 10:08 JeremyVriens

+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

nlavalle avatar Mar 13 '21 00:03 nlavalle

@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

jcgillespie avatar Mar 13 '21 13:03 jcgillespie