![]() ![]() Set the name for your container using the –name parameter and set your container’s hostname using the -h parameter. Map TCP ports using the -p parameter in the format. You set the sa password for the SQL instance using the SA_PASSWORD parameter. To briefly recap the other parameters, the ACCEPT_EULA parameter is where you agree to Microsoft’s End User Licensing Agreement, EULA. If the mount location in the container doesn’t already exist, it will be created for you. In this example, I’m mounting the C:\Users\JoeWebb\sql folder to /mnt/myhost/sql in the container. The -v parameter mounts the host volume to a folder in the container. docker run -v C:\Users\JoeWebb\sql:/mnt/myhost/sql -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=34r0TNhvgOde" -p 1433:1433 -name sql2019a -h sql2019 -d /mssql/server:2019-latest We do this by adding the -v parameter to the same docker run command we used before. To use a host folder from inside the Docker container, we must mount the folder when we first run the container. Mounting a host folder to a Docker container A similar approach will work for other hosts and images. As before, I’m using a Windows host computer and SQL Server 2019 in a Ubuntu Linux image. If not, go back to the Getting Started blog before continuing. ![]() Using a Docker host folder for a SQL Server databaseįor this example, I’m assuming you already have Docker Desktop installed and a SQL Server image available. So, let’s look at how to mount a Docker host folder in a containe for a SQL Server database. But what if you wanted the database to reside on the host instead of inside the Docker container? That would allow you to upgrade the container anytime you’d like and just run a few scripts to create users, attach databases, etc., afterward. I described how to copy database backup files from your host to the container and then restore them in the container. In Getting Started with SQL Server in a Docker Container, I shared my SQL Server Docker container configuration. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |