首页 > 解决方案 > 如何解决“docker build”只需要 1 个参数。错误?

问题描述

我正在尝试使用以下命令进行 docker build 并收到以下错误:

C:\>docker build --no-cache -t myrabbit -f dockerfile_rabbitmq
"docker build" requires exactly 1 argument.
See 'docker build --help'.Usage:  docker build [OPTIONS] PATH | URL | -Build an image from a Dockerfile

我的 dockerfile:dockerfile_rabbitmq已定义并存在于该目录中。我不完全确定为什么会收到此错误。任何帮助,将不胜感激!

标签: dockerdockerfile

解决方案


您忘记了.docker build 命令末尾的 。

所以你的 docker build 命令应该是这样的

docker build --no-cache -t myrabbit -f Dockerfile .

推荐阅读