我正在按照“Docker书”的步骤进行操作,当我尝试从Dockerfile构建镜像时,我总是有相同的答案:

nisevi@localhost static_web:$ ll
total 24
drwxrwxr-x. 2 nisevi nisevi 4096 Feb  3 09:46 ./
drwxrwxr-x. 8 nisevi nisevi 4096 Feb  2 21:28 ../
-rw-rw-r--. 1 nisevi nisevi  215 Feb  3 09:04 Dockerfile
nisevi@localhost static_web:$ sudo docker build -t="nisevi/static_web"

Usage: docker build [OPTIONS] PATH | URL | -

Build a new image from the source code at PATH

  --force-rm=false     Always remove intermediate containers, even after unsuccessful builds
  --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) to be applied to the resulting image in case of success
nisevi@localhost static_web:$

这是我的Dockerfile:
# Version: 0.0.1
FROM ubuntu:14.04
MANTAINER nisevi "[email protected]"
RUN apt-get update
RUN apt-get install -y nginx
RUN echo 'Hi, I am in your container'\
    >/usr/share/nginx/html/index.html
EXPOSE 80

有人知道为什么会这样吗?我将非常感谢您的帮助。

最佳答案

我认为您忘记了.

cd /where/the/Dockerfile/is
sudo docker build -t=nisevi/static_web .

关于docker - sudo docker build -t =“nisevi/static_web”无法正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28299458/

10-16 03:27