Docker image versioning and lifecycle management

白昼怎懂夜的黑 提交于 2019-12-08 19:53:13

问题


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

It occurs to me that, in practice:

  • You need a way to version Docker images
  • You need a way to tell the Docker engine (running on a VM) to stop/start/restart a particular container
  • You need a way to tell the Docker engine which version of a image to run

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?


回答1:


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.

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.

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 to see running containers

docker rm <container name/id> to remove containers



来源:https://stackoverflow.com/questions/32098374/docker-image-versioning-and-lifecycle-management

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!