它在“ Building blahblah”上停留了大约18分钟以上,有时还会更长……
等待了很长时间后,所有东西都建立起来并运行起来。
docker-compose --verbose build
没有给我太多信息。
Docker Engine-社区 引擎版本:19.03.8
docker-compose版本1.25.4,内部版本8d51620a
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)
答案 0 :(得分:0)
这就是为什么上下文太大或太深的原因。 尝试创建一个空文件夹,将docker-compose.yml和Dockerfile移到那里,然后
docker-compose build
docker-compose up -d
问题通常在您的上下文中包含大量文件夹,符号链接和/或深度过大时发生。上下文是您的Dockerfile所在的位置:
version: '3.8'
services:
your-srv:
build:
context: .
dockerfile: Dockerfile
image ...
答案 1 :(得分:0)
在Docker构建上下文中创建一个.dockerignore文件(如果未指定,则与Dockerfile / docker-compose.yml相同)
在其内部,您的目录/文件可从Docker上下文中忽略。
例如对我来说是
data = [[45.0, 58.0, 45.0, 520.0],
[45.0, 58.0, 754.0, 58.0],
...
[562.0, 520.0, 562.0, 581.0],
[563.0, 450.0, 629.0, 450.0]]
#Directly appending an element to item will impact original dataset,
#Since list is reference data structure,
for item in data:
item.append(2)
print(data)
[[45.0, 58.0, 2, 45.0, 520.0, 2],
[45.0, 58.0, 2, 754.0, 58.0, 2],
...
[562.0, 520.0, 2, 562.0, 581.0, 2],
[563.0, 450.0, 2, 629.0, 450.0, 2]]
稍后我的docker-compose会作为卷映射。
或者您可以指定要使用的Build上下文,例如一个文件夹,其中包含您需要在Dockerfile中添加/使用的内容。 您要映射到运行容器中的代码/文件的任何卷都不应位于同一目录中,或者应位于.dockerignore中。
可以将构建上下文配置为docker-compose.yml中的另一个路径
html
因此,您可以将docker目录作为上下文,并在其外部添加Dockerfile和docker-compose.yml,然后将src目录和其他内容放置在其他位置。