上一篇文章中,我们是使用了别人做好的镜像来使用docker。
更多的镜像可以到https://hub.docker.com/查找
这篇文章,我们将自己来制作镜像。
自己制作镜像非常简单,只需要自己写一个Dockerfile,build之后就能得到一个镜像。
下面的例子,参考官网
1.新建文件夹test
>mkdir test
>cd test
==注:该文件夹下最好不要放置其他与制作镜像无关的文件,因为docker在build阶段会扫描当前文件夹下的所有文件,会影响到制作效率。==*
2.新建Dockerfile
> vim Dockerfile
注:文件名必须为Dockerfile
写入以下内容
Use an official Python runtime as a parent image
FROM python:2.7-slim
Set the working directory to /app
WORKDIR /app
Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages spec

----使用Dockerfile创建自己的镜像&spm=1001.2101.3001.5002&articleId=79007163&d=1&t=3&u=0b7da4ba6c1d46a2ae08db6d118541f0)
2476

被折叠的 条评论
为什么被折叠?



