Search code examples
dockerdocker-compose

Docker - max depth exceeded


So I am using this example:

https://github.com/mcmoe/mssqldocker

In order to create a SQL Server image and load it with data. I have several sql scripts which I run when I run the container.

However, I started getting this error when building the image:

Step 7/9 : ENTRYPOINT ./entrypoint.sh
 ---> Running in c8c654f6a630
max depth exceeded

I'm not sure how to fix this, I restarted docker and even updated it. I read something about 125 layers? Can anyone explain the cause of this and a potential fix?

I found this command to run:

docker history microsoft/mssql-server-linux:latest | wc -l
 312

My docker-compose yml:

version: "3"
services:
  mssql:
      build: .
      image: 'microsoft/mssql-server-linux'
      ports:
          - '1433:1433'
      environment:
          - ACCEPT_EULA=Y
          - SA_PASSWORD=Abcgfgh123!
      volumes:
          - db_volume:/var/lib/mssql/data
volumes:
  db_volume:

Solution

  • 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 build stanza, The image will just be pulled and run.

    • If you have a build stanza, image will 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'