如何在不存在docker文件的情况下构建docker映像

如何在不存在docker文件的情况下构建docker映像,docker,dockerfile,Docker,Dockerfile,码头工人的新手 运行此docker构建。 这是Dockerfile FROM gcr.io/google_appengine/python # Create a virtualenv for dependencies. This isolates these packages from # system-level packages. RUN virtualenv /env # Setting these environment variables are the same as runni

码头工人的新手

运行此
docker构建。

这是
Dockerfile

FROM gcr.io/google_appengine/python

# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
RUN virtualenv /env

# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH

# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv.
#ADD requirements.txt /app/requirements.txt
#RUN pip install -r /app/requirements.txt

# Add the application source code.
ADD . /app

# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.
CMD gunicorn -b :$PORT main:app

CMD bash1  "while true; do echo hello; sleep 1;done"

CMD ["sh", "while true; do echo hello; sleep 1;done"]
CMD "echo" "Hello docker!"

但是之后,当我运行
docker ps
时,我看不到图像

要构建图像,您必须使用:

docker build -t username/imagename .
您必须使用文档中的
-t
标记图像并为其命名:

-t、 --标记值名称,并可选地在 “名称:标记”格式(默认值[])

然后,您可以使用以下工具查看图像列表:

docker images
您使用的是
docker ps
,它用于列出容器而不是图像

更多信息


检查。

要创建您必须使用的图像,请执行以下操作:

docker build -t username/imagename .
您必须使用文档中的
-t
标记图像并为其命名:

-t、 --标记值名称,并可选地在 “名称:标记”格式(默认值[])

然后,您可以使用以下工具查看图像列表:

docker images
您使用的是
docker ps
,它用于列出容器而不是图像

更多信息


检查。

使用“docker run”创建并运行容器。docker build所做的就是创建一个映像

使用“docker run”创建并运行容器。docker build所做的就是创建一个映像