0
点赞
收藏
分享

微信扫一扫

8-docker-compose命令操作容器报“no configuration file provided: not found”

1.问题描述

docker-compose命令操作容器时,有时会报出“no configuration file provided: not found”问题

[root@centos79 opt]# docker-compose ps
no configuration file provided: not found
[root@centos79 opt]#

2.解决方案

最常见的原因是没有在docker-compose.yml文件的路径下执行该命令。

docker-compose命令操作容器时需要在yml文件所在路径执行

[root@centos79 opt]# cd /usr/local/harbor/
[root@centos79 harbor]# ls -l
总用量 782740
drwxr-xr-x 3 root root        20 12月 11 20:20 common
-rw-r--r-- 1 root root      3643 11月  1 15:03 common.sh
-rw-r--r-- 1 root root      5836 12月 11 20:20 docker-compose.yml
-rw-r--r-- 1 root root 801456311 11月  1 15:04 harbor.v2.9.1.tar.gz
-rw-r--r-- 1 root root     13763 12月 11 20:16 harbor.yml
-rw-r--r-- 1 root root     13760 11月  1 15:03 harbor.yml.tmpl
-rwxr-xr-x 1 root root      1975 11月  1 15:03 install.sh
-rw-r--r-- 1 root root     11347 11月  1 15:03 LICENSE
-rwxr-xr-x 1 root root      1881 11月  1 15:03 prepare
[root@centos79 harbor]# docker-compose ps
NAME                IMAGE                                COMMAND                   SERVICE       CREATED          STATUS                    PORTS
harbor-core         goharbor/harbor-core:v2.9.1          "/harbor/entrypoint.…"   core          40 minutes ago   Up 40 minutes (healthy)   
harbor-db           goharbor/harbor-db:v2.9.1            "/docker-entrypoint.…"   postgresql    40 minutes ago   Up 40 minutes (healthy)   
harbor-jobservice   goharbor/harbor-jobservice:v2.9.1    "/harbor/entrypoint.…"   jobservice    40 minutes ago   Up 40 minutes (healthy)   
harbor-log          goharbor/harbor-log:v2.9.1           "/bin/sh -c /usr/loc…"   log           40 minutes ago   Up 40 minutes (healthy)   127.0.0.1:1514->10514/tcp
harbor-portal       goharbor/harbor-portal:v2.9.1        "nginx -g 'daemon of…"   portal        40 minutes ago   Up 40 minutes (healthy)   
nginx               goharbor/nginx-photon:v2.9.1         "nginx -g 'daemon of…"   proxy         40 minutes ago   Up 40 minutes (healthy)   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp
redis               goharbor/redis-photon:v2.9.1         "redis-server /etc/r…"   redis         40 minutes ago   Up 40 minutes (healthy)   
registry            goharbor/registry-photon:v2.9.1      "/home/harbor/entryp…"   registry      40 minutes ago   Up 40 minutes (healthy)   
registryctl         goharbor/harbor-registryctl:v2.9.1   "/home/harbor/start.…"   registryctl   40 minutes ago   Up 40 minutes (healthy)   
[root@centos79 harbor]#

或者使用-f参数指定yml文件方可运行

[root@centos79 opt]# docker-compose -f /usr/local/harbor/docker-compose.yml ps
NAME                IMAGE                                COMMAND                   SERVICE       CREATED          STATUS                    PORTS
harbor-core         goharbor/harbor-core:v2.9.1          "/harbor/entrypoint.…"   core          41 minutes ago   Up 41 minutes (healthy)   
harbor-db           goharbor/harbor-db:v2.9.1            "/docker-entrypoint.…"   postgresql    41 minutes ago   Up 41 minutes (healthy)   
harbor-jobservice   goharbor/harbor-jobservice:v2.9.1    "/harbor/entrypoint.…"   jobservice    41 minutes ago   Up 41 minutes (healthy)   
harbor-log          goharbor/harbor-log:v2.9.1           "/bin/sh -c /usr/loc…"   log           41 minutes ago   Up 41 minutes (healthy)   127.0.0.1:1514->10514/tcp
harbor-portal       goharbor/harbor-portal:v2.9.1        "nginx -g 'daemon of…"   portal        41 minutes ago   Up 41 minutes (healthy)   
nginx               goharbor/nginx-photon:v2.9.1         "nginx -g 'daemon of…"   proxy         41 minutes ago   Up 41 minutes (healthy)   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp
redis               goharbor/redis-photon:v2.9.1         "redis-server /etc/r…"   redis         41 minutes ago   Up 41 minutes (healthy)   
registry            goharbor/registry-photon:v2.9.1      "/home/harbor/entryp…"   registry      41 minutes ago   Up 41 minutes (healthy)   
registryctl         goharbor/harbor-registryctl:v2.9.1   "/home/harbor/start.…"   registryctl   41 minutes ago   Up 41 minutes (healthy)   
[root@centos79 opt]#


举报

相关推荐

0 条评论