我有两个问题关于如何从我正在运行的Ubuntu和工作项目目录中构建docker镜像到带有版本的基础镜像
1)如何在我运行的Ubuntu (14.0.4)中创建基础镜像。它有MongoDB和其他必需的依赖项来支持我们的应用程序。
2)基于之前的镜像,希望为应用程序(项目目录)创建基础镜像,以创建用于部署的zed版本镜像。
提前谢谢。
发布于 2017-02-09 04:41:47
您可以使用docker commit
将容器转换为图像
# start a new ubuntu container, change some things and stop it again
$ docker run -it ubuntu
root@ca93ddb728ae:/# echo "changed image" > file
root@ca93ddb728ae:/# cat /file
changed image
root@ca93ddb728ae:/# exit
exit
# the container still exists but it's stopped now
# turn it's current state into an image called 'my-ubuntu-image'
$ docker commit ca93ddb728ae my-ubuntu-image
sha256:47b71ccc78ae0b54598f153b1c999c01a9039b654e90da3a3ef3514b2f987df0
# start a container of our new 'my-ubunut-image' and find the previously
# changed file
$ docker run -it my-ubuntu-image
root@2732f428bf8a:/# cat /file
changed image
在此之后,您可以像以前一样使用新映像构建新映像。但是,建议使用Dockerfile来创建映像。
https://stackoverflow.com/questions/42122744
复制相似问题