码头工人:“构建"需要 1 个参数.请参阅“docker build --help" [英] docker: "build" requires 1 argument. See 'docker build --help'

查看:26
本文介绍了码头工人:“构建"需要 1 个参数.请参阅“docker build --help"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试按照从 docker 网站构建 docker 镜像的说明进行操作.

Trying to follow the instructions for building a docker image from the docker website.

https://docs.docker.com/examples/running_redis_service/

这是我按照文档上的说明并使用此 Dockerfile 得到的错误

this is the error I get will following the instructions on the doc and using this Dockerfile

FROM        ubuntu:14.04
RUN         apt-get update && apt-get install -y redis-server
EXPOSE      6379
ENTRYPOINT  ["/usr/bin/redis-server"]


sudo docker build -t myrepo/redis
docker: "build" requires 1 argument. See 'docker build --help'.

如何解决?

推荐答案

需要加一个点,表示使用本地目录下的Dockerfile.

You need to add a dot, which means to use the Dockerfile in the local directory.

例如:

docker build -t mytag .

这意味着你使用本地目录中的Dockerfile,如果你使用docker 1.5,你可以在别处指定一个Dockerfile.从 docker build 的帮助输出中摘录:

It means you use the Dockerfile in the local directory, and if you use docker 1.5 you can specify a Dockerfile elsewhere. Extract from the help output from docker build:

-f, --file="";Dockerfile 的名称(默认为上下文根中的 'Dockerfile')

这篇关于码头工人:“构建"需要 1 个参数.请参阅“docker build --help"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆