Mostefai Mohammed Amine

Software and Cloud Architect

Amine
  • Contact
Previous Post
Next Post
Jan 14, 2021 DockerSQL ServerDatabases

Backing up a database from a SQL Server 2019 container

Hi all,

If you have pulled the latest version of the Linux-based SQL Server 2019 containers, you will notice that you cannot backup databases anymore in the container file system. That's because the cause is pretty obvious, the mssql user has no longer the required permissions to create files.

One of the quickest workarounds is to execute the container using the root user. For example, the command below, runs a container using the root user.

docker run -u root mcr.microsoft.com/mssql/server

If you are using the container inside a compose, just modifiy the configuration by adding "root" for the "user" parameter as follows :

services: 
  sqldb:
    image: 'mcr.microsoft.com/mssql/server:2019-latest'
    user: root
    environment:
        SA_PASSWORD: "Vibr@tion99"
        ACCEPT_EULA: "Y"
    ports:
        - 1433:1433
    volumes:
        - sqlvolume:/var/opt/mssql
        - c:/temp/backup:/var/backup

Hope that was helpful !

SQL ServerSQL Server 2019DockerDocker Compose
Share This Post

Related posts

  • Backing up a database from a SQL Server 2019 container This post is a workaround for backing up databases in SQL 2019 Linux containers after the last updat...
  • The ultimate checklist for making your making your .NET core docker containers access your SQL Server databases Hi, working with docker and .NET core is really cool in matters of scalability and separation of mic
  • Database Engine of SQL Server 2014 SP1 not installing on Windows 2012 Server R2 Hi,L'm getting the following issue on several servers when trying to install : "Wait on the Database
Saving the comment

Cancel reply to comment

The captcha value you provided is incorrect.