Compose: docker-compose -f /my/path/docker-compose.yml - No such file or directory

Created on 25 Aug 2016  路  26Comments  路  Source: docker/compose

Hi guys !

When doing a docker-compose -f /a/b/c/docker-compose.yml pull from /a -> it works.
When doing a docker-compose -f /a/b/c/docker-compose.yml pull from /a/foo/bar -> it does not work:

ERROR: .IOError: [Errno 2] No such file or directory: '/a/b/c/docker-compose.yml'

Didn't investigate more on this problem.

$ docker-compose  version
docker-compose version 1.8.0, build f3628c7
docker-py version: 1.9.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2h  3 May 2016

Most helpful comment

Hi guys I'm getting this error while giving command can someone help in this...
docker error

THanks in advance

All 26 comments

Having the same probleme here.
Any news on this?

+1, met same issue on 1.8.0 version

Same issue.

Docker version: 1.12.5
docker-compose version: 1.9.0

How to reproduce:

cd /home/userBBB/
docker-compose -f /home/userAAA/subdir/test.yml up -d
# ERROR: .IOError: [Errno 2] No such file or directory: '/home/userAAA/subdir/test.yml'

cd /home/userAAA/
docker-compose -f /home/userAAA/subdir/test.yml up -d
# it works

It is NOT a premissions problem on /home/userAAA/subdir/test.yml or any part of the path (i checked this).

Same problem here, v1.8.0 build f3628c7.

Same problem here, I saw it when I added a systemctl service and it fails to run in system boot with this message.

Same problem, it's really weird. I've no clue why that's not working.

Version 17.11.0-ce-rc3-mac38 (20152)
Channel: edge
a091b4ad0a

Same problem here... Someone solved this? Pliz share :(

i'm on windows and that's my docker version:

$ docker-compose version
docker-compose version 1.16.1, build 6d1ac219
docker-py version: 2.5.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016

My problem seems to be an issue using many files...

i'm not that good in docker and i really don't know how to solve this. Even because i'm using laradock and it has a lot of things on it that i don't understand.

Any way, when i remove the bold text, it runs.

COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml

But it feels wrong. I'm going to downgrade docker version tomorrow and see how it works.

Getting the same thing as @rafadpedrosa, thanks for the solution!

Don't really know docker yet though so not sure if this is an issue.

@samber @coolcow trying to reproduce but can't. Can you elaborate test steps pls?

@coolcow I can't see what is different between these two
cd /home/userBBB/ docker-compose -f /home/userAAA/subdir/test.yml up -d
# ERROR: .IOError: [Errno 2] No such file or directory: '/home/userAAA/subdir/test.yml'

cd /home/userAAA/ docker-compose -f /home/userAAA/subdir/test.yml up -d
# it works

Was able to reproduce. Works for me.

Ubuntu Linux,
docker-compose version 1.21.0-rc1, build 1d32980
docker-py version: 3.2.1
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.1t 3 May 2016

m@m:~/userBBB$ docker-compose -f /home/m/userAAA/subdir/docker-compose.yml up -d
Starting subdir_web_1 ... done
Starting subdir_redis_1 ... done

@samber Hey, could we close this issue? It seems it has been resolved. Works for me. Can you try again and then close it?

@Mat001 Cannot reproduce this bug with docker-compose 1.20.1.

Thanks to whoever fixed that ;)

I have the same problem

docker-compose version 1.22.0, build f46880fe
docker-py version: 3.4.1
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.1.0f 25 May 2017

(18-10-05 0:56:06) <0> [/]
ocker-compose -f /tmp/tmpfRtJlW/docker-compose.yaml up --build --abort-on-container-exit
ERROR: .FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpfRtJlW/docker-compose.yaml'

(18-10-05 1:03:58) <0> [/tmp]
docker-compose -f /tmp/tmpfRtJlW/docker-compose.yaml up --build --abort-on-container-exit
Working!

It works for me (OSX, 1.22).

@samber
Thanks for confirming, do you think that's because I use an old docker?
Client:
Version: 1.12.6
API version: 1.24
Go version: go1.6.3
Git commit: 7392c3b/1.12.6
Built: Thu Jan 26 09:26:48 2017
OS/Arch: linux/amd64

Server:
Version: 1.12.6
API version: 1.24
Go version: go1.6.3
Git commit: 7392c3b/1.12.6
Built: Thu Jan 26 09:26:48 2017
OS/Arch: linux/amd64

Yes, maybe...

But I think this issue was for docker-compose, not docker engine.

Anyway, using an old docker-compose version with a recent docker engine does not guaranty that everything is working well! At that time, Docker retro-compatibility was not very nice :-(.

My pc docker compose current versionis 1.22.0 how can i downgrade it to 1.20.0 where i wont reproduce that error?

Hi guys I'm getting this error while giving command can someone help in this...
docker error

THanks in advance

Any follow up on this? I've spend a lot of time with this lately, but it seems like the -f option to docker-compose is rather useless, or at least misleading. As is the error message.

It seems natural to have one docker-compose file in a central location that starts multiple containers from multiple directories (each in different repositories).

Not sure if my problem is actually related to this Issue or not because the error is extremely unhelpful.

What I've found is that you should just absolutely always be starting from some common root directory. The trick with multiple overrides is then apparently they cannot be specified by absolute path but instead must be relative.

From Understanding multiple Compose files.

When you use multiple configuration files, you must make sure all paths in the files are relative to the base Compose file (the first Compose file specified with -f). This is required because override files need not be valid Compose files. Override files can contain small fragments of configuration. Tracking which fragment of a service is relative to which path is difficult and confusing, so to keep paths easier to understand, all paths must be defined relative to the base file.

Which seems like a weak argument to me. Far more confusing is the fact that an absolute path will not work and will throw a completely misleading error message.

Same issue. Any solution to fix :-?

docker-compose version 1.25.0-rc2, build 661ac20
docker-py version: 4.0.1
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c  28 May 2019

For me , work this : docker-compose -f ./a/b/c/docker-compose.yml

Have been reproduced on docker installation only

docker-compose version 1.25.5, build unknown
Docker version 19.03.11, build dd360c7
Ubuntu 18.04
same error for me.
image

I was facing the same issue. My solution was changing the extension of docker-compose file from yaml to just yml.

Was this page helpful?
0 / 5 - 0 ratings