Forum Discussion
Jords_2point0
Oct 04, 2023Copper Contributor
Converting an SQL Server 2019 Ubuntu image to Alpine
Hi I want to host my SQL Server image on AWS Elastic Container Registry but want to make it smaller than this huge Ubuntu bloated image by converting the image to Alpine to save some dinero. It's more than 1GB right now on Ubuntu. I'm doing this on Powershell, windows 10.
The problem is Microsoft doesn't support it.
And yes I tried using Mssql Tools and had no success.
I will probably have to end up using Ubuntu but if anyone knows how to use Alpine for this use case then please let me know what I can do. Basically, if I run the container I built it doesn't start.
So I first run this command to build the image.
docker build -t img_pitcher8_alpine .
Then this command to create the container:
docker run -d -p 1440:1444 --name contai_pitcher8_sql_server_alpine img_pitcher8_alpine
>>
033e377f8c101155afa1e4ef42ea1583365133237e414d30b6a770e1b7b08790
I cannot find any logs for the container in Docker Desktop if I run:
docker logs contai_pitcher8_sql_server_alpine
If it helps this is the docker file with the password omitted.
# Use mcr.microsoft.com/mssql/server:2019-latest as the base image
FROM mcr.microsoft.com/mssql/server:2019-latest as base
# Set environment variables
ENV ACCEPT_EULA=Y
ENV SA_PASSWORD=*****
ENV MSSQL_PID=Developer
# Copy database files into image
COPY ./Pitcher8.mdf /var/opt/mssql/data/Pitcher8.mdf
COPY ./Pitcher8_log.ldf /var/opt/mssql/data/Pitcher8_log.ldf
# Start a new stage with Alpine Linux as the base image
FROM alpine
# Install necessary dependencies
RUN apk add --no-cache openssl libintl icu
# Copy files from base into current image
COPY --from=base /opt/microsoft/ /opt/microsoft/
COPY --from=base /opt/mssql-tools/ /opt/mssql-tools/
# Set up volume for database data
VOLUME /var/opt/mssql/data
# Expose port 1444 inside the container
EXPOSE 1444
I bound it to 1444 as I already have a container on port 1433 and want to avoid conflicts.
- olafhelperBronze Contributor
The problem is Microsoft doesn't support it.Jords_2point0 ; as you wrote, Alpine as OS is not supported by MS SQL Server.