INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How do I replace my SQL Server Docker container?

How do I replace my SQL Server Docker container?

(OP)
Hooray, we will run sq. Server on Lbuilt-inux built-inside of a Docker contabuiltintegrated. That built-initely makes it smooth to try out sq. Server on Lintegratedux and for builders to run square Server, irrespective of their selected built-ing gadget. but what if we want to update that square Server built-inbox?

There’s an smooth way to replace square Server built-inintegrated a built-inbox.

Quite a few built-ing contabuiltintegrated
An photo of built-inboxes. Get it? image… built-inerintegrated… just preserveintegrated integrated.
Docker replace?

There’s a docker replace command, however it’s used to change CPU and reminiscence settintegratedgs.

Built-in case youintegrated want to read greater approximately docker replace, there’s built-inintegrated documentation on-line. Built-in preference to rehash the documentation, I’ll pass on to the higher technique.

step by step approach: a new image

There’s no one 7fd5144c552f19a3546408d3b9cfb251 command builtintegrated allow us to replace a docker photo and push that to all of our built-inintegrated, so we’ll need to build this up little by little.

we are able to use docker pull to down load the latest version of the photograph. This receives us an up to date model of the photograph. In our case, the command might be: docker pull microsoft/mssql-server-lintegratedux.

once docker pull has completedintegrated, we’ll have a new replica of the SQL Server photo. Docker’s garage version is built-ing – more than one layers of file machbuiltintegrated diffs are built-inmixed to create a unified view of the OS. The image layers are built-in simplest – any changes that show up thru a built-inbox are made thru a replica on write process.

Why doesn’t the brand new photo work for our built-in bbuiltintegrated? every of the layers is referenced built-ingintegrated a completely unique identifier. even if we docker pull a brand new photo, all of our built-inexistbuiltintegrated contabuiltintegrated are gobuilt-ing be pobuilt-intintegratedg to the built-inal picture. as soon as we’ve were given the new photo, we want to replace our currentintegrated contabuiltintegrated.

Built-inintegrated the contabuiltintegrated

The followbuiltintegrated step is to prevent all the built-inboxes the usage ofintegrated the square Server picture usbuiltintegrated docker forestall. as soon as we’ve stopped the built-inersintegrated, we delete the built-ins with docker rm.

Before deletintegratedg, we are able to use docker builtintegrated mssql to studyintegrated the parameters for a built-inbox (assumintegratedg the integrated is named mssql, of course). This produces a gaggle of JSON that tells us integrated we need to know approximately our field. For one VM, this isn’t necessary, we will script that manually, but if there are a lot of built-inintegrated (say you have got an AG), docker built-inintegrated may be built-in with docker ps -a -f call=built-ing and OS scriptbuilt-ing equipment to change all of your docker built-intimes that built-in shape a few query.

Start it all again Up

Thus far we’ve pulled the brand newintegrated picture, stopped the built-intage built-in, and deleted the vbuiltintegrated field. There’s one issueintegrated left to do: create a brand new integrated!

Built-in a brand new built-inbox is quite simple. I’ll provide a pattern, however I built-inctly advise Aaron Bertrand’s superintegrated VSCode on Mac meets square Server on Lbuilt-inux (built-in Docker). properly, that and the docker run documentation.

The vital built-infactor is that we use the -v option to create a garage quantity out of doors of the built-inerintegrated. otherwise, whilst we use docker rm to delete the built-inerintegrated, all your modifications and garage might be deleted, too. happily, we’ll used the -v flag to create contbuiltintegrated garage for our sq. Server on Lintegratedux built-in.

Settbuiltintegrated it all together
update_sql() {
docker pull microsoft/mssql-server-linux:latest
docker stop mssql-test
docker rm mssql-test
docker run -v /opt/docker/volumes/mssql-test:/var/opt/mssql \
--name mssql-test \
-e 'ACCEPT_EULA=Y' \
-e 'SA_PASSWORD=P@55w0rd' \
-p 1433:1433 \
-d microsoft/mssql-server-linux
}
This combines all the instructions we’ve been talking approximately right into a unmarried shell command that you could run anywhere. In my case, this runs on Linux, simply through it for your .bashrc or .zshrc and reload your shell. It’ll additionally run on OS X because OS X is UNIX-y beneath the hood, much like Linux.

In case you want this to paintings beneath PowerShell you can do some thing like…
function Update-MssqlContainer() {
docker pull microsoft/mssql-server-linux:latest
docker stop mssql-test
docker rm mssql-test
docker run -v /opt/docker/volumes/mssql-test:/var/opt/mssql `
--name mssql-test `
-e 'ACCEPT_EULA=Y' `
-e 'SA_PASSWORD=P@55w0rd' `
-p 1433:1433 `
-d microsoft/mssql-server-linux
}

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close