microsoft/mssql-docker

install.tar is part of the final image, makes the image 1.3 GB bigger than necessary

andi0b opened this issue ยท 7 comments

andi0b commented

The current 2019 and 2022 containers all contain /install.tar in the image. Inspecting the container you can see this takes around 1.3 GB of space in the 2022 version.

Using a multi stage build to remove the install.tar would make the image 1.3 GB smaller, and pulls much faster. install.tar is not used any more after installation.

Is there anything I'm not considering, or is this really a bug?

Edit: I played a bit with the image and created this Dockerfile, that creates a new image without install.tar. Much smaller, still working (but untested!):

FROM mcr.microsoft.com/mssql/server:2022-CU7-ubuntu-20.04 as mssql

USER root
RUN mkdir /mssqlinstall
RUN tar -h -xf install.tar -C /mssqlinstall

FROM ubuntu:20.04

EXPOSE 1433
ENV MSSQL_RPC_PORT=135
ENV CONFIG_EDGE_BUILD=""
COPY --from=mssql /mssqlinstall /
RUN EXTRA_APT_PACKAGES="" /tmp/install.sh 
USER mssql
ENTRYPOINT ["/opt/mssql/bin/permissions_check.sh"]
CMD ["/opt/mssql/bin/sqlservr"]

This is a bug with which appeared with update 6:

mcr.microsoft.com/mssql/server:2022-CU5-ubuntu-20.04 Imagesize: 1.58GiB

COPY dir:29548ea62e900173228fb760b9b8c3d235dacd1ff54a1a18fc9d49e1d070596a in / 1.33GiB

mcr.microsoft.com/mssql/server:2022-CU6-ubuntu-20.04 Imagesize: 2.9GiB

COPY file:b337ac8d41ea86635a085e5d261c5c4d2367a05bd18dbe731eaf1e189ee78b82 in / 1.33GiB
tar -h -xf install.tar 1.33GiB

For tar files you can use ADD not COPY, docker tries to unpack the archive automatically

andi0b commented

This is a bug with which appeared with update 6:

Oh, I didn't notice that. I checked a few recent images, and they all contained install.tar. Didn't go back far enough.

mcr.microsoft.com/mssql/server:2022-CU5-ubuntu-20.04 Imagesize: 1.58GiB

The resulting image of my Dockerfile based on 2022-CU7 is also displayed with 1.58 GB

Thanks @andi0b and @Herr-Sepp for reporting this issue.

You should only find the extra tar file in CU6 and CU7 for the SQL Server 2022 Ubuntu 20.04 and (preview) 22.04 images. We are looking into ways to address this and will update this thread when we have a better timeline to share.

andi0b commented

You should only find the extra tar file in CU6 and CU7 for the SQL Server 2022 Ubuntu 20.04 and (preview) 22.04 images.

I can confirm that, it was already late when I looked into it and must have overlooked that the 2019 and 2017 versions are not affected.

We are looking into ways to address this and will update this thread when we have a better timeline to share.

Thanks! I was under the impression this repo is abandoned, but actually it isn't ๐Ÿ‘

A fix for that would improve the performance of out integration testing CI pipeline a lot, currently it's wasting a lot of time pulling/pushing the mssql/server image. I guess for now we will try downgrading to 2019-latest.

Thanks @andi0b. I can assure you that the SQL Server on Linux initiative has not been abandoned :-).

We will be addressing this issue in an upcoming Cumulative Update (CU) for SQL Server 2022. It will not be the next CU, which will be CU 8, but should be part of the following CU. We will update this thread if those plans change.

The following link should provide you with a rough estimate around our release cadence for SQL Server 2022 Cumulative Updates until the end of the year - https://learn.microsoft.com/troubleshoot/sql/releases/sqlserver-2022/build-versions. We have had to occasionally delay these releases when unexpected events occur, but the link above should provide you with a relatively good idea when to expect CU 9 for SQL Server 2022.

andi0b commented

Thanks @andi0b. I can assure you that the SQL Server on Linux initiative has not been abandoned :-).

I was more talking about this repository (dockerized sql server). The content of the repository is old and unmaintained, there are no current Dockerfiles here. Most of the examples are outdated, ...

@andi0b the Ubuntu image size issue has been addressed in Cumulative Update 9 for SQL Server 2022 - https://learn.microsoft.com/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate9#2668765. Thank you for letting us know about this issue.