Introduction

this is part 10:1 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.


Docker image

image_help

Docker came with a built-in help command . type docker --help you will get all the commands , from them we need the image command so we type docker image --help

we need the build command to build our image if you are not in the folder already,

cd DevOpsJourney/app_009

then let's start the action!

docker image build -t app_009_1 .

let's break it , -t mean the tag we didn't put app0091:version so the version will be latest tag

the . it's mean the Dockerfile is inside the folder that we are in

press enter , and let's take a look

image_build

as we see the docker start to pull the python-alpine image from the internet .

done

as we see he start to run it line by line , as we notice he give it tagged app0091:latest

let's try to build it again ...

cached

We notice that he didn't get any thing from the hub this time! it's all cached . (as a challenge try and change the maintainer name and build it on your own again )

inspect

we ged some info about the build in JSON form , we notice in RepoTags we get the tag.

taged_again

docker image build -t app_009_1:1.0 .

we give it now the tag 1.0

tag1.0

we inspect again and we notice now we have 2 tags in the repo latest and 1.0

if we list the image using

docker image ls

we can see we have 3 images , app0091 with 1.0 and another with latest tag.

python 3.9-rc-alpine

all are now local if we need to build again it's all cached.

with simple math 83.3 - 77.7 = 5.6 MB our app and alpine image is just 5.6 MB !

End

I will split it into 2 parts to make it easier to read

This post is also available on DEV.