Hello,
Let me elaborate the problem from the start:
Firstly the problem is OS X specific 10.13.3. For previous versions including (10.11 , 10.12 and upto 10.13.2 it is working fine)
I am using following docker file to create an image.
Below is the docker file content
mssql-agent-fts-ha-tools
Maintainers: Microsoft Corporation (twright-msft on GitHub)
Base OS layer: Latest Ubuntu LTS
FROM ubuntu:16.04
apt-get and system utilities
RUN apt-get update && apt-get install -y
curl apt-transport-https debconf-utils
&& rm -rf /var/lib/apt/lists/*
adding custom MS repository
RUN curl https(Please remove space in order to make link)://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https (Please remove space in order to make link)://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
install SQL Server drivers and tools
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql mssql-tools
RUN echo ‘export PATH="$PATH:/opt/mssql-tools/bin"’ >> ~/.bashrc
RUN /bin/bash -c “source ~/.bashrc”
RUN apt-get -y install locales
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
CMD /bin/bash
#Install curl since it is needed to get repo config
Get official Microsoft repository configuration
RUN export DEBIAN_FRONTEND=noninteractive &&
apt-get update &&
apt-get install -y curl &&
apt-get install apt-transport-https &&
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - &&
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | tee /etc/apt/sources.list.d/mssql-server.list &&
apt-get update
Install SQL Server which a prerequisite for the optional packages below.
RUN apt-get install -y mssql-server
Install optional packages. Comment out the ones you don’t need
RUN apt-get install -y mssql-server-agent
RUN apt-get install -y mssql-server-ha
RUN apt-get install -y mssql-server-fts
Run SQL Server process
CMD /opt/mssql/bin/sqlservr
#These commands are used to build the image from docker file.
cd /Users/paramvir/Desktop/docker-mssql-server-linux-with-fts-master
docker build -t mssqlimagefIle .
Below command is used for saving the newly created to specific folder
docker save mssqlimagefIle -o /Users/paramvir/Desktop/Image/mssqlimagefIle.tar
SERVER_FILE is the path of newly created image file
docker load -i “$SERVER_FILE”
#Creating container
docker run -d --name container -e ‘ACCEPT_EULA=Y’ -e ‘SA_PASSWORD=P@55w0rd’ -e ‘MSSQL_PID=Developer’ -p 1433:1433 mssqlimagefIle
When we are running creating container command, it creates the container but it exits automatically within no time and when we check the status of the container using docker ps -a command, it shows container exited with status 255.
We have tried the same approach using docker edge version and it is working fine for small size data base files. Not sure if it has do anything with it.
My next step after this works is to run these 3 below mentioned commands
sudo docker exec -it container mkdir /var/opt/mssql/containerBak
MSSQL_PATH_NAME="/var/opt/mssql/containerBak/$DATABASE_BAK_FILE_NAME"
ABSOLUTE_PATH_SQL_FOLDER=""$MY_PATH_SOURCE_DIRECTORY"/"$DATABASE_BAK_FILE_NAME""
BAK_FILE="$MY_PATH_SOURCE_DIRECTORY"
docker cp “$ABSOLUTE_PATH_SQL_FOLDER” container:/var/opt/mssql/containerBak
docker exec container /opt/mssql-tools/bin/sqlcmd -U sa -P P@55w0rd -Q "RESTORE DATABASE [DBName] FROM DISK=’$MSSQL_PATH_NAME’ WITH MOVE ‘DBName’ TO ‘/var/opt/mssql/data/DBName.mdf’, MOVE ‘DBName_log’ TO ‘/var/opt/mssql/data/DBName_log.ldf’ "
Please remove the spaces before https link. I have mentioned the same in the docker file content.
Thanks
Itesh Dutt