正在按照docker网站上的说明构建docker映像。
https://docs.docker.com/examples/running_redis_service/
这是我得到的错误将遵循文档上的说明,并使用这个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'.
如何解决?
Docker构建命令格式
在powershell中:
出现这种类型的错误是因为您没有在Dockerfile中指定路径。
试试这个:
$ docker build -t friendlyhello:latest -f C:\\TestDockerApp\\Dockerfile.txt
Friendlyhello是你分配给你的容器的名称,并添加版本,只需使用:latest
- f C: \ TestDockerApp \ Dockerfile.txt
-你想添加一个标签,因为构建命令需要一个参数或标签
DockerFile是一个文本文档,所以明确添加扩展名。txt
**尝试以下格式:
$ docker build -t friendlyhello:latest -f C:\\TestDockerApp\\Dockerfile.txt .**
打开PowerShelland并遵循以下说明。
这种类型的错误通常出现在Windows S.O.中
当您使用命令构建时,需要一个选项和路径。
出现这种类型的错误是因为您没有在Dockerfile中指定路径。
试试这个:
C:\Users\Daniele\app> docker build -t friendlyhello C:\Users\Daniele\app\
Friendlyhello是分配给容器的名称
c:\ users \ daniel \app\是包含Dockerfile的路径
如果你想添加一个标签
C:\Users\Daniele\app> docker build -t friendlyhello:3.0 C:\Users\Daniele\app\