Docker - 超出最大深度 [英] Docker - max depth exceeded

查看:60
本文介绍了Docker - 超出最大深度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用这个例子:

https://github.com/mcmoe/mssqldocker

为了创建 SQL Server 映像并加载数据.我在运行容器时运行了几个 sql 脚本.

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

我不知道如何解决这个问题,我重新启动了 docker 甚至更新了它.我读了一些关于 125 层的东西?任何人都可以解释造成这种情况的原因以及可能的解决方法吗?

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

我的 docker-compose yml:

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:

推荐答案

docker-compose.ymlservice 的image 参数> 定义具有双重含义,取决于 build 参数的存在.

The image parameter for a service in a docker-compose.yml definition has dual meanings depending on the existence of a build parameter.

  • 如果没有 build 节,image 将被拉取并运行.

  • If there is no build stanza, The image will just be pulled and run.

如果您有 build 节,image 将是您构建的名称图像被标记为,并运行.

If you have a build stanza, image will be the name your built image is tagged as, and run.

通过将构建的镜像命名为microsoft/mssql-server-linux,与FROM microsoft/mssql-server-linux镜像相同.Docker 每次都将构建分层.

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.

原始构建开始于官方"microsoft/mssql-server-linux,但随后的每个构建都将从您本地的 microsoft/mssql-server-linux 开始已附加到的图像,直到最终达到存储驱动程序的最大层数.

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'

这篇关于Docker - 超出最大深度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆