它会卡在“建筑blahblah”上大约18+分钟,有时更长。
等了很长时间之后,一切都建立起来了,它运行起来了。docker-compose --verbose build
没有给予太多信息。
Docker引擎-社区引擎版本:19.03.8
停靠合成版本1.25.4,内部版本号8d 51620 a
root@someserver:/opt/containers/sites/somesite.nz# docker-compose --verbose build
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
docker.utils.config.find_config_file: No config file found
docker.utils.config.find_config_file: Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
docker.utils.config.find_config_file: No config file found
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/version HTTP/1.1" 200 862
compose.cli.command.get_client: docker-compose version 1.25.4, build 8d51620a
docker-py version: 4.1.0
CPython version: 3.7.5
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
compose.cli.command.get_client: Docker base_url: http+docker://localhost
compose.cli.command.get_client: Docker version: Platform={'Name': 'Docker Engine - Community'}, Components=[{'Name': 'Engine', 'Version': '19.03.8', 'Details': {'ApiVersion': '1.40', 'Arch': 'amd64', 'BuildTime': '2020-03-11T01:24:19.000000000+00:00', 'Experimental': 'false', 'GitCommit': 'afacb8b7f0', 'GoVersion': 'go1.12.17', 'KernelVersion': '4.15.0-108-generic', 'MinAPIVersion': '1.12', 'Os': 'linux'}}, {'Name': 'containerd', 'Version': '1.2.13', 'Details': {'GitCommit': '7ad184331fa3e55e52b890ea95e65ba581ae3429'}}, {'Name': 'runc', 'Version': '1.0.0-rc10', 'Details': {'GitCommit': 'dc9208a3303feef5b3839f4323d9beb36df0a9dd'}}, {'Name': 'docker-init', 'Version': '0.18.0', 'Details': {'GitCommit': 'fec3683'}}], Version=19.03.8, ApiVersion=1.40, MinAPIVersion=1.12, GitCommit=afacb8b7f0, GoVersion=go1.12.17, Os=linux, Arch=amd64, KernelVersion=4.15.0-108-generic, BuildTime=2020-03-11T01:24:19.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('someproject_internal')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/networks/someproject_internal HTTP/1.1" 404 68
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('web')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/networks/web HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': False,
'ConfigFrom': {'Network': ''},
'ConfigOnly': False,
'Containers': {'31db88fbbf7b3cc7da09559e024287424c4c689afdb0e924558583339233fec3': {'EndpointID': '798b82453ee5b309bccd5cb230e440bbbb79fe2b7746e668291cd88ca76b3c2f',
'IPv4Address': '172.19.0.3/16',
'IPv6Address': '',
'MacAddress': '02:42:ac:13:00:03',
'Name': 'someproject_someproject_1'},
'405639a07d229936eabfd6a766a6ce053ca5647e11f06dec3d15413d5c230b5e': {'EndpointID': '2aec703aeb0a86ce68ffae4a042fc405be9996aa19d5c288701702fc40d4e486',
'IPv4Address': '172.19.0.10/16',
...
compose.project.build: es-someproject uses an image, skipping
compose.service.build: Building someproject
compose.cli.verbose_proxy.proxy_callable: docker build <- (path='/opt/containers/sites/somesite.nz', tag='someproject_someproject', rm=True, forcerm=False, pull=False, nocache=False, dockerfile=None, cache_from=None, labels=None, buildargs={}, network_mode=None, target=None, shmsize=None, extra_hosts=None, container_limits={'memory': None}, gzip=False, isolation=None, platform=None)
3条答案
按热度按时间dy2hfwbg1#
这就是为什么上下文太大或太深的原因。尝试创建一个空文件夹,将docker-compose.yml和Dockerfile移到那里,然后
这个问题通常发生在你的上下文有很多文件夹,符号链接,和/或太深的时候。上下文是你的Dockerfile所在的位置:
a7qyws3x2#
在您的Docker构建环境中创建一个.dockerignore文件(如果未指定,则与Dockerfile/docker-compose.yml在同一位置)
在它里面放置你的目录/文件从Docker上下文忽略。
对我来说
html
我的docker-compose后来Map为一个卷。
或者,您可以指定要使用的生成上下文,例如,包含需要在Dockerfile中添加/使用的内容的文件夹。要Map到运行容器中的代码/文件的任何卷都不应位于同一目录中,或者它们应位于. dockerignore中。
可以将构建上下文配置为docker-compose.yml中的另一个路径
因此,您可以将一个docker目录作为上下文,并在其外部放置Dockerfile和docker-compose.yml,然后在其他位置放置src目录和其他内容。
gr8qqesn3#
如果您希望从docker compose build获得完整的输出,则应使用
--progress
标志,并将其设置为plain
,如下所示我也会考虑添加
--no-cache
标志来查看映像的整个构建。参考:https://docs.docker.com/engine/reference/commandline/compose_build/#options