Docker Compose V2: 未知的快捷标志 ‘f’ (Windows)

huangapple go评论119阅读模式
英文:

Docker compose V2: unknown shorthand flag 'f' (windows)

问题

I'm currently running docker desktop version 20.10.22 (build 3a2c30b, fresh install) on Windows (using wsl2), but docker compose commands with the -f flag do not work correctly. Since I'm using docker compose V2 (checked the option in the docker desktop settings), my commands are with a space instead of a hyphen. I get the following message when running any docker compose command using -f:

> unknown shorthand flag: 'f' in -f See 'docker --help'.

Specifically, I'm running the FIWARE NGSI-LD tutorials. All docker compose commands that are used within those tutorials fail. The commands can be found in the services file for each tutorial. For example, a command that fails (saying that the -f flag does not exist) within the Short-Term-History tutorial is the following:

docker compose -f docker-compose/mintaka.yml -p fiware up -d --remove-orphans --renew-anon-volumes

The weird thing is that docker compose --help and docker compose --version both return the output from respectively docker --help and docker --version, as if it excludes the compose keyword. The output of the above command also refers to the standard docker help command instead of the docker compose help.

UPDATE: Docker excludes the compose keyword between docker and the rest of the command. Replacing compose with a random string of letters gives the same effect. It seems as if it cannot recognize the compose keyword.

The old docker-compose is not installed so that does not work either. Running which docker-compose returns the docker-compose.exe location, inside the .../Docker/resources/bin folder. Running which docker compose returns the location of docker.exe. The .../Docker/resources/bin folder is inside the path environment variable.

Does anybody know what the problem might be? I've searched countless websites but did not find any solutions for this problem yet.

Kind regards

英文:

I'm currently running docker desktop version 20.10.22 (build 3a2c30b, fresh install) on Windows (using wsl2), but docker compose commands with the -f flag do not work correctly. Since I'm using docker compose V2 (checked the option in the docker desktop settings), my commands are with a space instead of a hyphen. I get the following message when running any docker compose command using -f:

> unknown shorthand flag: 'f' in -f See 'docker --help'.

Specifically, I'm running the FIWARE NGSI-LD tutorials. All docker compose commands that are used within those tutorials fail. The commands can be found in the services file for each tutorial. For example, a command that fails (saying that the -f flag does not exist) within the Short-Term-History tutorial is the following:

docker compose -f docker-compose/mintaka.yml -p fiware up -d --remove-orphans --renew-anon-volumes

The weird thing is that docker compose --help and docker compose --version both return the output from respectively docker --help and docker --version, as if it excludes the compose keyword. The output of the above command also refers to the standard docker help command instead of the docker compose help.

UPDATE: Docker excludes the compose keyword between docker and the rest of the command. Replacing compose with a random string of letters gives the same effect. It seems as if it cannot recognize the compose keyword.

The old docker-compose is not installed so that does not work either. Running which docker-compose returns the docker-compose.exe location, inside the .../Docker/resources/bin folder. Running which docker compose returns the location of docker.exe. The .../Docker/resources/bin folder is inside the path environment variable.

Does anybody know what the problem might be? I've searched countless websites but did not find any solutions for this problem yet.

Kind regards

答案1

得分: 1

以下是在运行docker compose events时我拥有的正在运行的进程:

Docker Compose V2: 未知的快捷标志 ‘f’ (Windows)

请检查是否有所有这些目录和文件。然后我们可以进一步进行故障排除。

英文:

Here is what I have in running processes when I run docker compose events:

Docker Compose V2: 未知的快捷标志 ‘f’ (Windows)

Please check if you have all these directories and files. Then we can troubleshoot further.

答案2

得分: 0

我重新使用相同的安装程序(也是相同版本)安装了Docker桌面,奇怪的是这解决了问题...

我旧安装和新安装的唯一区别是这次我已经安装了WSL 2。

英文:

I reinstalled docker desktop with the same installer (also same version) and this resolved the problem weirdly enough...

The only difference between my old and new installation was that I already had wsl2 installed this time.

huangapple
  • 本文由 发表于 2023年2月7日 01:04:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75364392.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定