Recently I needed to have a SQL Server 2008 R2 instance to do some testing. I had to install it on my laptop, but I wasn’t a big fan of installing such an old version locally. A couple of weeks ago at Dataminds Connect I saw Andrew Prusky building customized Docker containers. Because most of the public SQL Server Docker images are only for the most recent SQL Server versions, it seemed like a great opportunity to create my own SQL Server 2008 R2 Docker image.
You can use below instructions for other applications as well. In this example you will see how to build a SQL Server container (I didn’t streamline the SP on purpose) together with one of it’s prerequisites, the .Net feature.
Some preparations:
Here we go
A root folder, containing our dockerfile, start.ps1 and subfolders for SQL Server 2008 R2 , Service Pack 3 and the .Net package
In my case:
D:\temp\docker\
Dockerfile
Start.ps1
\mssql
\sql2008r2sp3
\dotnet
# using Microsoft Windows Server Core image
FROM microsoft/windowsservercore
#install dotnet 3.51 (prereq for SQL Server 2008 R2)
RUN powershell -Command (mkdir C:/source/dotnet)
COPY \dotnet C:/source/dotnet
run powershell Install-WindowsFeature -name NET-Framework-Core -source C:/source/dotnet
# this is ok as well : run Dism /online /enable-feature /featurename:NetFX3 /All /Source:C:/source/dotnet
RUN powershell -Command (rm C:/source/dotnet -recurse)
# create temporary directory to hold SQL Server sources
RUN powershell -Command (mkdir C:/source/sqlserver2008r2)
RUN powershell -Command (mkdir C:/source/sqlserver2008r2SP3)
# copy sources to image
COPY \mssql C:/source/sqlserver2008r2
COPY \sql2008r2sp3 C:/source/sqlserver2008r2sp3
# install SQL Server 2008 R2
RUN C:/source/sqlserver2008r2\setup.exe /q /ACTION=Install /FEATURES=SQL /INSTANCENAME=MSSQLSERVER /SECURITYMODE=SQL /SAPWD="S1mbaS@mbA" /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\Administrators" /TCPENABLED=1 /IACCEPTSQLSERVERLICENSETERMS /SKIPRULES=PerfMonCounterNotCorruptedCheck /AGTSVCACCOUNT="NT AUTHORITY\System"
# install SP3 for SQL 2008 R2
RUN C:/source/sqlserver2008r2sp3/setup.exe /q /IAcceptSQLServerLicenseTerms /Action=Patch /Instanceid=mssqlserver
# remove the sources
RUN powershell -Command (rm C:/source/sqlserver2008r2 -recurse)
RUN powershell -Command (rm C:/source/sqlserver2008r2SP3 -recurse)
# make sure service is set to automatic
RUN powershell -Command (set-service MSSQLSERVER -StartupType Automatic)
# switch shell to powershell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
COPY \start.ps1 /
WORKDIR /
ENV SA_PASSWORD "S1mbaS@mbA"
ENV ACCEPT_EULA "Y"
# run start.ps1
CMD .\start -sa_password $env:SA_PASSWORD -ACCEPT_EULA $env:ACCEPT_EULA -Verbose
! Don’t forget the dot at the end of the command.
Cd d:\temp\docker
docker build -t sql2008r2sp3df .
Download the screen output here.
Port 14567 will be mapped to the SQL Server port 1433, and a container named dckrcntsql2008r2 will be created.
docker run -d -i -p 14567:1433 –name dckrcntsql2008r2 sql2008r2sp3df
PS D:\temp\docker> docker run -d -i -p 14567:1433 –name dckrcntsql2008r2 sql2008r2sp3df
7f4a6ac5eb069370c7fdf83d37c67f8c84265ef5f2c78852765769ef48368fe0
docker start dckrcntsql2008r2
PS D:\temp\docker> docker start dckrcntsql2008r2
dckrcntsql2008r2
-In SSMS, connect to localhost,14576
Cookie | Duration | Description |
---|---|---|
ARRAffinity | session | ARRAffinity cookie is set by Azure app service, and allows the service to choose the right instance established by a user to deliver subsequent requests made by that user. |
ARRAffinitySameSite | session | This cookie is set by Windows Azure cloud, and is used for load balancing to make sure the visitor page requests are routed to the same server in any browsing session. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Advertisement" category. |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | CookieYes sets this cookie to record the default button state of the corresponding category and the status of CCPA. It works only in coordination with the primary cookie. |
elementor | never | The website's WordPress theme uses this cookie. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
__cf_bm | 30 minutes | Cloudflare set the cookie to support Cloudflare Bot Management. |
pll_language | 1 year | Polylang sets this cookie to remember the language the user selects when returning to the website and get the language information when unavailable in another way. |
Cookie | Duration | Description |
---|---|---|
_ga | 1 year 1 month 4 days | Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors. |
_ga_* | 1 year 1 month 4 days | Google Analytics sets this cookie to store and count page views. |
_gat_gtag_UA_* | 1 minute | Google Analytics sets this cookie to store a unique user ID. |
_gid | 1 day | Google Analytics sets this cookie to store information on how visitors use a website while also creating an analytics report of the website's performance. Some of the collected data includes the number of visitors, their source, and the pages they visit anonymously. |
ai_session | 30 minutes | This is a unique anonymous session identifier cookie set by Microsoft Application Insights software to gather statistical usage and telemetry data for apps built on the Azure cloud platform. |
CONSENT | 2 years | YouTube sets this cookie via embedded YouTube videos and registers anonymous statistical data. |
vuid | 1 year 1 month 4 days | Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. |
Cookie | Duration | Description |
---|---|---|
ai_user | 1 year | Microsoft Azure sets this cookie as a unique user identifier cookie, enabling counting of the number of users accessing the application over time. |
VISITOR_INFO1_LIVE | 5 months 27 days | YouTube sets this cookie to measure bandwidth, determining whether the user gets the new or old player interface. |
YSC | session | Youtube sets this cookie to track the views of embedded videos on Youtube pages. |
yt-remote-connected-devices | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt-remote-device-id | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt.innertube::nextId | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
yt.innertube::requests | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
Cookie | Duration | Description |
---|---|---|
WFESessionId | session | No description available. |