docker - Advantages of a Dockerfile -
we can create docker images , push them hub without dockerfile. why useful, have dockerfile? advantages of it? dockerfile creation process high consumption of time , can made human. know main difference between base image based, committed image , dockerfile based image.
dockerfile
used automation of work specifying step want on docker image.
a dockerfile text document contains commands user call on command line assemble image. using docker build users can create automated build executes several command-line instructions in succession.
yes , can create docker images every time when want make change have change manually , test , push .
or if use dockerfile dockerhub rebuild automatically , make change on every modification , if wrong rebuild fail.
advantages of dockerfile
- dockerfile automated script of docker images
- manual image creation become complicated when want test same setup on different os flavor have create image flavor small changing in dockerfile can create images different flavor
- it have simple syntax image , many change automatically take more time while doing manually.
- dockerfile have systematic step can understand others , easy know exact configuration changed in base image.
advantage of dockerfile dockerhub
- docker hub provide private repository dockerfile.
- dockerfile can share among team , organization.
- automatic image builds
- webhooks attached repositories allow trigger event when image or updated image pushed repository
- we can put dockerfile on
github
orbitbucket
difference between committed image , dockerfile image
committed image : commit container’s file changes or settings new image.
usage: docker commit [options] container [repository[:tag]] create new image container's changes -a, --author= author (e.g., "john hannibal smith <hannibal@a-team.com>") -c, --change=[] apply dockerfile instruction created image --help=false print usage -m, --message= commit message -p, --pause=true pause container during commit
it option debug container , export changed setting image.but docker suggest use dockerfile see here or can commit versioning of docker or backup of image.
the commit operation not include data contained in volumes mounted inside container.
by default, container being committed , processes paused while image committed. reduces likelihood of encountering data corruption during process of creating commit. if behavior undesired, set ‘p’ option false.
dockerfile based image:
it use base image creating new image. let suppose if made change in dockerfile apply dockerfile steps on fresh image , create new image. commit use same image.
my point of view have use dockerfile have step want on image if create image commit have document change made may needed if want create new image , can dockerfile documentation of image.
Comments
Post a Comment