Docker 拼写提示错误: 没有提供配置文件 : 找不到
原标题:Docker Compose prompted error: no configuration file provided: not found
I had setup Docker Desktop with Windows WSL integration version 2 and I run into issue when execute certain docker compose command with following errors
docker compose logs
no configuration file provided: not found
However, there were no problem found when executing the following
docker compose up
and image built and fired up successfully.
Is there anyone who can help with this?
Output of docker info
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.7.1)
compose: Docker Compose (Docker Inc., v2.2.1)
scan: Docker Scan (Docker Inc., 0.9.0)
Server:
Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 4
Server Version: 20.10.11
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: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc version: v1.0.2-0-g52b36a2
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.60.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 24.95GiB
Name: docker-desktop
ID: FUMA:ZOXR:BA4L:YSOZ:4NQT:HHIZ:ASAD:EJGA:NJRG:SO4S:GXN3:JG5H
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 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
UPDATED
It was my mistake that I should execute the docker compose command under the correct directory where docker-compose.yml file located at.
The issue is resolved.
最佳回答
execute docker-compose command where docker-compose.yml file located at should resolved it.
or specify the docker-compose.yml file as bellow
docker-compose -f logs
as suggested
问题回答
For anyone who s getting
no configuration file provided: not found
I was getting the same message on Mac trying to execute
docker-compose up
The problem was with docker-compose.yml file. I saved it from Visual Studio Code as a text file though OS determined it like a proper YAML file. Look at the screenshot: left file is wrong but seems the same.
Make sure you select YAML format when you saving it.
Just had the very same issue on Ubuntu 22.04.3 LTS (Jammy) with a minimal server install that had the "docker" checked during the installation. It appears that the installer choose to install the snap version of docker, resulting in this error:
root@server:/srv/project# docker compose -f docker-compose.yml up
stat /var/lib/snapd/void/docker-compose.yml: no such file or directory
I removed the snap version (snap remove docker), then followed the official installation steps and added the compose plugin (apt install docker-compose). I needed to remove the link to the snap binary (rm /snap/bin/docker) and updated my PATH (as in a logout / login) and voilà.
My configuration:
Ubuntu Server 22.04.4 LTS
Docker installed via snap
Solution
Move docker-compose.yml file under a user home directory (ie /home/user/plex) and run docker compose up -d in this directory.
Additional Context
I was originally planning to aggregate all my containers into /opt/stacks Referencing compose files outside a user home directory results in the error message even if you use a fully qualified path (-f option)
Docker Compose version v2.17.2
Docker version 24.0.5, build ced0996
Ubuntu 22.04.3 LTS
In my case the problem was that from some point the command became docker compose, but not docker-compose. So the valid command is docker compose up -d.
https://docs.docker.com/compose/migrate/
In my case, I spelt the file wrongly. I used=> docker.compose.yml rather than=> docker-compose.yml
so check the spelling of the file. it must match the command
Faced the same issue on a Windows PC. The problem was with the extension of the file being assumed by the OS as a known file type.
Solution
Go to Folder options and disable the Hide extensions for known file types.
You should be able to see the actual file extension which may looked like proper .txt files now (instead of .yml). Rename the file(s) accordingly, run the command again and viola!
I was getting the similar error on windows 10 and corrected the same by saving my .yaml file again with type as "All files" and extension as .yaml. Before this windows was saving it as text file due to which it was giving error.
I was facing the same issue (while trying to view logs from all services in a compose file) and the top answer here solved it for me with just a small variation.
I had a custom docker-compose file (for example, docker-compose.custom.yml)
I had to use "docker compose" instead of "docker-compose"
So the below command worked for me:
docker compose -f docker-compose.custom.yml logs --follow
for those who may have an issue with Error response from daemon: Conflict. The container name "db" is already in use by container "id". You have to remove (or rename) that container to be able to reuse that name.
check to see which container running on your machine docker ps -a
delete the desired container docker rm [contianer name]
create the container new docker compose -f [where docker data located]/[docker yml file] up --force-recreate --build -d
When I downloaded YAML file it came with docker-compose3.yml file name. From that I am getting this issue.
So, when I renamed above file to docker-compose.yml name and started docker with this command docker compose up it is working fine for kafka.
Issue with Docker Installation via Snap
While attempting to install Docker using Snap, I encountered the issue. However, I resolved it by uninstalling the Snap version and opting for the apt installation method instead.
I had to do docker compose up --file .config.yml -d in windows
相关问题
Unable to connect to docker container inside windows server
As title. I am developing a system with many docker images with ASP.Net MVC core projects. I am publishing these docker images into a docker engine installed on Windows Server OS, and I found that I ...
Only can see postgreSQL as an admin
After installed Wsl and Docker, can t access PSQL and other things.
I was studying Docker, and installed the latest version.
So far so good, I received an error about the WSL version, saw some ...
make docker-compose block until healthy without `depends_on`
I am working with a team that uses docker-compose to start a set of helper services, but does not use docker when the code is being developed.
Here, docker-compose is just a convenient way to run the ...
change grafana port using docker host network
I am trying to spin up a grafana container in docker, however my setup in docker does not allow ipv4 forwarding and thus I cannot use the default bridge network in docker. All I can use is the host ...
Pip instalation for Python 3.11 in docker
I have Dockerfile to build image for Django project that uses Python 3.11 and runs in poetry environment (see content below). Problem is when I try to donwload get-pip.py file and run it using Python, ...
在 Dockerfile 中运行 composer install
我正在尝试将我的Laravel应用程序进行Docker化。
该应用程序已经构建并在Git中,但我将vendor文件夹添加到了.gitignore中。
我添加了一个Dockerfile,看起来像这样:
FROM php:7.1-fpm-alpine
RUN apk update ...
如何在Docker集装箱内操作Nginx而不停泊?
我在Docker集装箱上安装了Nginx,并试图将其照样操作:
How to use NetCat for Windows to send a binary file to a TCP connection?
If I want to transfer a binary file "binary.bin" (located in the same directory as NetCat) to IP address 127.0.0.1 port 1200 using TCP, how do I specify this using NetCat for windows?