为什么Docker版本没有-f参数?

从输出

sudo docker build --help 

 --force-rm=false Always remove intermediate containers, even after unsuccessful builds --no-cache=false Do not use cache when building the image -q, --quiet=false Suppress the verbose output generated by the containers --rm=true Remove intermediate containers after a successful build -t, --tag="" Repository name (and optionally a tag) to be applied to the resulting image in case of success 

在线文档中有更多的参数https://docs.docker.com/reference/commandline/build/

例如参数-f来指定Dockerfile的文件名

你应该检查你的docker版本,你需要升级它。 根据docker的更新日志 , docker build -f参数在版本1.5.0中实现

另外,我用docker 1.6.2版在我自己的机器上做了一个testing

 $docker --version Docker version 1.6.2, build 7c8fca2 $docker build --help Usage: docker build [OPTIONS] PATH | URL | - Build a new image from the source code at PATH -c, --cpu-shares=0 CPU shares (relative weight) --cpuset-cpus= CPUs in which to allow execution (0-3, 0,1) -f, --file= Name of the Dockerfile (Default is 'PATH/Dockerfile') --force-rm=false Always remove intermediate containers --help=false Print usage -m, --memory= Memory limit --memory-swap= Total memory (memory + swap), '-1' to disable swap --no-cache=false Do not use cache when building the image --pull=false Always attempt to pull a newer version of the image -q, --quiet=false Suppress the verbose output generated by the containers --rm=true Remove intermediate containers after a successful build -t, --tag= Repository name (and optionally a tag) for the image 

你可以看到它支持-f参数。