docker-compose build takes a very long time is there a verbose/debug log I can enable when building?
Answer a question
It gets stuck on "Building blahblah" for around 18+ minutes sometimes longer...
After waiting a long time everything builds and it runs up.
docker-compose --verbose build Does not give me much info.
Docker Engine - Community Engine Version: 19.03.8
docker-compose version 1.25.4, build 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)
Answers
Make a .dockerignore file in your Docker Build Context (Same place as Dockerfile/docker-compose.yml if not specified)
Inside it put your directory/files to ignore from the Docker context.
e.g. for me it was
html
Which my docker-compose later maps in as a volume.
Or you can specify the Build context to use e.g. a folder containing what you need to add/use in the Dockerfile. Any volumes for code/files that you want to map into the running container should not be in the same directory, or they should be in a .dockerignore.
The build context can be configured to another path in the docker-compose.yml
build:
context: .
dockerfile: Dockerfile
So you could have a docker directory as the context with the Dockerfile and docker-compose.yml outside of it, then have your src directory and other things elsewhere.
更多推荐



所有评论(0)