Docker映像版本控制和生命周期管理 [英] Docker image versioning and lifecycle management

查看:86
本文介绍了Docker映像版本控制和生命周期管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Docker,并试图更好地了解Docker在现实世界"中的工作方式.

I am getting into Docker and am trying to better understand how it works out there in the "real world".

在我看来,在实践中:

  • 您需要一种对Docker映像进行版本控制的方法
  • 您需要一种方法来告诉Docker引擎(在VM上运行)停止/启动/重新启动特定的容器
  • 您需要一种方法来告诉Docker引擎运行哪个版本的映像

Docker是否附带用于处理每个命令的内置命令?如果不是,使用什么工具/策略来实现它们?另外,当我构建Docker映像时(例如,通过docker build -t myapp .),将生成什么文件类型,以及该文件在计算机上的位置?

Does Docker ship with built-in commands for handling each of these? If not what tools/strategies are used for accomplishing them? Also, when I build a Docker image (via, say, docker build -t myapp .), what file type is produced and where is it located on the machine?

推荐答案

docker具有构建映像和运行容器所需的全部功能.您可以通过编写Dockerfile或从Docker集线器中拉出来创建自己的映像.

docker has all you need to build images and run containers. You can create your own image by writing a Dockerfile or by pulling it from the docker hub.

在Dockerfile中,您指定另一个映像作为映像的基础,运行命令install Things.图像可以具有标签,例如ubuntu图像可以具有最新标签或12.04标签,可以使用ubuntu:latest表示法指定.

In the Dockerfile you specify another image as the basis for your image, run command install things. Images can have tags, for example the ubuntu image can have the latest or 12.04 tag, that can be specified with ubuntu:latest notation.

一旦使用docker build -t image-name .构建了映像,就可以使用docker run --name container-name image-name从该映像创建容器.

Once you have built the image with docker build -t image-name . you can create containers from that image with `docker run --name container-name image-name.

docker ps查看正在运行的容器

docker rm <container name/id>删除容器

这篇关于Docker映像版本控制和生命周期管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆