The image parameter for a service in a docker-compose.yml definition has dual meanings depending on the existence of a build parameter.
-
If there is no
buildstanza, Theimagewill just be pulled and run. -
If you have a
buildstanza,imagewill be the name your built
image is tagged as, and run.
By naming the built image microsoft/mssql-server-linux, which is the same as the FROM microsoft/mssql-server-linux image. Docker was layering the build on top of itself each time.
The original build started on the “official” microsoft/mssql-server-linux but then each subsequent build would start from your local microsoft/mssql-server-linux image which had been appended to, until eventually you hit the maximum number of layers for your storage driver.
Use your own namespace for all images you build:
version: "3"
services:
mssql:
build: .
image: 'user3437721/mssql-server-linux'