Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker image versioning and lifecycle management

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?

like image 631
smeeb Avatar asked Aug 19 '15 14:08

smeeb


People also ask

What is Docker life cycle?

Docker Container Lifecycle Management The lifecycle of a docker container consists of five states: Created state. Running state. Paused state/unpaused state. Stopped state.

Does Docker have version control?

As discussed above, Docker containers ensure consistency across multiple development and release cycles, standardizing your environment. On top of that, Docker containers work just like GIT repositories, allowing you to commit changes to your Docker images and version control them.

Where do you store versions of a specific Docker image?

If you use the default storage driver overlay2, then your Docker images are stored in /var/lib/docker/overlay2 . There, you can find different files that represent read-only layers of a Docker image and a layer on top of it that contains your changes.


1 Answers

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

like image 140
Chris Avatar answered Sep 20 '22 21:09

Chris