Docker镜像服务

基于已有镜像容器创建

Docker commit -m “new” -a “liu” 581d08c5549e nginx:liu

-m:(说明信息) -a:(作者信息)后接容器ID 新镜像名:标签

 

 

 

基于本地模板创建

导入本地镜像debian-7.0-x86-minimal.tar.gz

cat debian-7.0-x86-minimal.tar.gz | docker import – 镜像名:标签

 

 

 

 

 

 

 

基于dockerfile创建

创建一个文件使用

Mkdir apache

Cd apache

Vim Dockerfile(名字不要更改,D必须是大写)

 

 

 

vim run.sh #和Dockerfile文件位于相同目录下

 

 

 

编辑首页文件,echo “this is ky0666” > index.html

 

 

 

创建好这三个文件,在同一目录下

 

 

 

生成镜像

docker build -t httpd:test .  (注意末尾有".")

每加载一步会生成一个临时的容器,在加载完成后会自行删除

 

 

 

 

 

 

创建完成

 

新镜像运行容器

 

 

 

 

 

 

到网页上测试

 

 

posted @ 2020-11-30 00:08  escape丶丶  阅读(68)  评论(0)    收藏  举报