Context is weird when using several config files
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
Description
It looks like build.context is resolved from current context rather than from config file for second and past files passed through -f. Such behavior prohibits using those extending (second, third, etc) config files on their own.
Steps to reproduce the issue:
cd /tmpgit clone https://github.com/SCIF/docker-ignore-failcd docker-ignore-faildocker-compose -f ./docker-compose.yml -f ./b/docker-compose.yml build
Describe the results you received:
When I cloned this repo in /tmp:
File "/usr/lib/python3/dist-packages/docker/utils/build.py", line 184, in rec_walk
for f in os.listdir(current_dir):
PermissionError: [Errno 13] Permission denied: '/tmp/systemd-private-3…'
When I moved whole repo in /tmp/1/:
Building b
ERROR: Cannot locate specified Dockerfile: b/Dockerfile
Describe the results you expected:
Build both services without issues.
Output of docker version:
Docker version 19.03.6, build 369ce74a3c
Output of docker info:
docker info
Client:
Debug Mode: false
Server:
Containers: 16
Running: 7
Paused: 0
Stopped: 9
Images: 149
Server Version: 19.03.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 35bd7a5f69c13e1563af8a93431411cd9ecf5021
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-3-amd64
Operating System: Debian GNU/Linux bullseye/sid
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.59GiB
Name: scif
ID: FTBI:3QBW:66NA:PYQI:P5GQ:6SRQ:3XTJ:T3MP:6BSE:JFD4:OS4J:P7L3
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
** docker-compose --version **
docker-compose version 1.25.0, build unknown
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with docker-compose.yml and b/docker-compose.yml using the documented docker-compose build command. Trace how build.context is resolved for files passed after the first -f; done means both services build from their config-relative contexts without scanning /tmp or failing to locate b/Dockerfile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker-compose, python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100