compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose.yaml: no such file or directory

Open fregux opened this issue 3 years ago • 6 comments

Description docker compose/docker-compose do not search in parent folder for docker-compose.yaml

Steps to reproduce the issue:

  • in base project, create a working docker-compose.yaml
  • create a folder (www for instance),
  • enter this folder (cd www)
  • run docker compose ps (for exemple) or docker compose exec container bash ...

Describe the results you received:
stat /home/toto/project/www/docker-compose.yaml: no such file or directory

Describe the results you expected:
use of the docker-compose.yaml in project folder

Additional information you deem important (e.g. issue happens only occasionally): Windows 10, WSL2, ubuntu bash
Docker Desktop 4.9.0 (80466)
do not work on windows nor mac

Output of docker compose version:

Docker Compose version v2.6.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.6.0)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)
WARNING: Plugin "/usr/libexec/docker/cli-plugins/docker-app" is not valid: failed to fetch metadata: fork/exec /usr/libexec/docker/cli-plugins/docker-app: no such file or directory

Server:
 Containers: 31
  Running: 21
  Paused: 0
  Stopped: 10
 Images: 86
 Server Version: 20.10.16
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc version: v1.1.1-0-g52de29d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.4.72-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 9.73GiB
 Name: docker-desktop
 ID: FE42:O7W2:J2A3:NKI5:MIV5:BB7H:CHJN:LNAN:EFMQ:PITI:52OV:H7RG
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Additional environment details:

fregux avatar Jun 09 '22 12:06 fregux

Hi, thanks for filing an issue. Is this a feature request? It doesn't feel like a bug. Is there is some documentation that gave you the impression that compose would automatically look in an ancestor directory for a compose file?

nicksieger avatar Jun 15 '22 17:06 nicksieger

Hi, No it's not a feature request.

in previous version, when i was in a child folder, i was able to run docker compose command, and since I updated docker desktop, it doesn't work anymore.

fregux avatar Jun 16 '22 08:06 fregux

I found in https://github.com/docker/compose/blob/v2/docs/reference/compose.md?plain=1#L100

The -f flag is optional. If you don’t provide this flag on the command line, Compose traverses the working directory and its parent directories looking for a compose.yaml or docker-compose.yaml file.

fregux avatar Jun 16 '22 09:06 fregux

Compose is indeed supposed to traverse working directory upwards to search for a compose file. However, I'm having trouble replicating this on macOS, compose v2.6.0, at least.

@fregux The only way I can replicate this error is if I run the command while specifying the compose file, such as compose -f docker-compose.yaml ps, or if I have an env var COMPOSE_FILE set, in which case I get the same error. Can check the output of env to make sure no such env var is set, and that it's not being specified elsewhere?

laurazard avatar Jun 17 '22 13:06 laurazard

Hi @laurazard,

In both case, "-f" or "COMPOSE_FILE", work well. I don't think there is a env var that is set that can disturb (as it work as it before update) and even if I run env - docker compose ps it doesn't work neither

SHELL=/bin/bash
NVM_INC=/home/informatique1/.nvm/versions/node/v12.22.12/include/node
WSL_DISTRO_NAME=Ubuntu
WT_SESSION=c6ed8504-0cfc-409a-a9ae-ab6bed00633c
NAME=PROPRI-26
PWD=/home/informatique1/damp/www
LOGNAME=informatique1
HOME=/home/informatique1
LANG=C.UTF-8
WSL_INTEROP=/run/WSL/12544_interop
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
NVM_DIR=/home/informatique1/.nvm
LESSCLOSE=/usr/bin/lesspipe %s %s
TERM=xterm-256color
LESSOPEN=| /usr/bin/lesspipe %s
USER=informatique1
SHLVL=1
NVM_CD_FLAGS=
WSLENV=WT_SESSION::WT_PROFILE_ID
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/home/informatique1/.nvm/versions/node/v12.22.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/windows/system32:/mnt/c/windows:/mnt/c/windows/System32/Wbem:/mnt/c/windows/System32/WindowsPowerShell/v1.0/:/mnt/c/windows/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/informatique1/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/JetBrains/PhpStorm 2021.3.1/bin:/mnt/c/Users/informatique1/AppData/Local/gitkraken/bin:/snap/bin
NVM_BIN=/home/informatique1/.nvm/versions/node/v12.22.12/bin
HOSTTYPE=x86_64
WT_PROFILE_ID={2c4de342-38b7-51cf-b940-2309a097f518}
OLDPWD=/home/informatique1/damp/www/sf_izilead
_=/usr/bin/env

fregux avatar Jun 17 '22 14:06 fregux

Hi, Is there any news about this issue ? Still in docker Desktop 4.11.1 (84025)

 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.7.0)
  extension: Manages Docker extensions (Docker Inc., v0.2.8)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)
WARNING: Plugin "/usr/libexec/docker/cli-plugins/docker-app" is not valid: failed to fetch metadata: fork/exec /usr/libexec/docker/cli-plugins/docker-app: no such file or directory

Server:
 Containers: 21
  Running: 21
  Paused: 0
  Stopped: 0
 Images: 87
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc version: v1.1.2-0-ga916309
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.4.72-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 9.73GiB
 Name: docker-desktop
 ID: MWLS:AMZQ:NOTJ:P2TR:Y3FF:W27H:7PJU:BSJ4:NYRU:7CFA:HTSX:EUCI
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

fregux avatar Aug 24 '22 12:08 fregux

I confirm compose do search for config file in parent folders (https://github.com/compose-spec/compose-go/blob/master/cli/options.go#L136) Tried to reproduce your issue, but "works for me"

ndeloof avatar Dec 09 '22 09:12 ndeloof

Hi,

I just notice that i have a .env file that define COMPOSE_FILE=docker-compose.yaml:docker-compose.override.yaml:docker-compose.dev.yaml

I didn't think that docker load .env file before running.

Sorry

fregux avatar Dec 13 '22 07:12 fregux

stat /root/docker-compose.env.yml: no such file or directory

ZLFjiayou avatar Mar 20 '24 13:03 ZLFjiayou