Managing database files for SQL Server containers

A database container is like any other Docker container, but with a focus on statefulness. You'll want to ensure your database files are stored outside of the container, so you can replace the database container without losing any data. You can easily do this with volumes as we saw in the last chapter, but there is a catch.

If you build a custom SQL Server image with a deployed database schema, your database files will be inside the image in a known location. You can run a container from that image without mounting a volume and it will just work, but the data will be stored in the container's writeable layer. If you replace the container when you have a database upgrade to perform, then you'll ...

Get Docker on Windows - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.