Docker Run Without Pull: Start SQL Server in One Command

Docker run without pull works because docker run downloads the image for you when it is not on your machine. You can skip the pull command and start SQL Server in one step. The first start is slower, because the download happens inside it.

Gouache painting of a village well with a vermilion bucket brought up full beside a jug

What Happens on the First Run

Docker stores images on your machine. When you run a container, Docker looks in that store first. If it finds the image, it starts the container at once. If it does not, it downloads the image from the registry and then starts the container.

That is why docker run without pull works on a clean machine. Docker prints a line that begins with Unable to find image and ends with the word locally. Then the download progress appears. The container starts when the download ends.

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<your strong password>" -p 1433:1433 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2025-latest

The commands here follow the documented steps for the image mcr.microsoft.com/mssql/server:2025-latest. They are commands for a machine with Docker, not T-SQL. The placeholder stands for your own password, and you should not save a real one in a script you share. The image name has two parts: the repository, and a tag after the colon. The tag picks the version.

Check Which Images You Already Have

Before you run anything, ask Docker what it holds. The list shows the repository, the tag, the image ID, the age and the size. Add the repository name to see only the SQL Server images.

docker image ls mcr.microsoft.com/mssql/server

An empty list means the next run will download. A row with your tag means the next run starts from the local copy. Run the same command after the first start, and the new row shows what Docker fetched.

Control the Download With the Pull Option

The default behavior has a name. It is the value missing, which means download only when the image is not there. Two other values change the rule. Always checks the registry every time and downloads what changed. Never refuses to download and fails when the image is missing. The next example uses a new container name, because sql1 from the first command already exists.

docker run --pull=never -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<your strong password>" -p 1433:1433 --name sql2 --hostname sql2 -d mcr.microsoft.com/mssql/server:2025-latest

Never suits a machine without internet access. It also makes a script stop when nobody loaded the image. Always suits a moving tag, because a tag such as 2025-latest points to a newer build after each release.

A local copy does not update itself. If you ran the image last month, Docker keeps using that copy. To refresh it, run docker pull for the tag, or use the always value on the next run.

For a quick test, docker run without pull is the shortest path. For a script that other people run, say what you want. Then the result does not depend on what is already on the machine.

When an Explicit Pull Is Better

You could argue that a separate pull is clearer, and in some cases it is. A pull shows the download progress by itself. A slow network or a wrong tag then fails before any container exists. In a script, I put the pull on its own line for that reason.

It also separates two jobs that fail in different ways. A download fails because of the network or the registry. A start fails because of the password rules, a busy port or too little memory. With one command, you have to read the output to tell which one broke.

Disk Space and Clean Up

SQL Server images are large, and every tag you try adds another. Check your disk before you test several versions. A running container cannot be removed. When you finish with a version, stop its container, remove it, and then remove the image. The flag -f on docker rm stops and removes in one step. It ends the container without a clean shutdown, so use it only for a test.

docker stop sql1

docker rm sql1

docker image rm mcr.microsoft.com/mssql/server:2025-latest

Docker refuses to remove an image that a container still uses, which protects you from deleting the wrong one. The command docker image prune removes the unnamed leftovers from older downloads. Data kept in a volume is safe from both commands. My article on a Docker volume for SQL Server shows how.

What to Remember

Docker run without pull works because the default is to download a missing image. A clean machine needs no extra step. Check the list of local images first, and read the tag in the image name. The tag decides which version you get.

Use the pull option when the rule matters. Choose never to refuse a download and always to refresh a moving tag. In scripts, add a separate pull so the download fails on its own. Write down the tag you ran, because the newest tag changes.

A pull is not a step to remember, it is a download docker run can do for you.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

Docker, PowerShell, SQL Command, SQL Server
Previous Post
SQL SERVER – Stored Procedure sp_datatype_info to Get Supported Data Types
Next Post
SQL SERVER – Fix Error – Login failed for user. Reason: Server is in script upgrade mode. Only administrator can connect at this time. (Microsoft SQL Server, Error: 18401)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.