Docker Tag, Containers and Kubernetes Pods

From NovaOrdis Knowledge Base
Revision as of 20:54, 12 August 2019 by Ovidiu (talk | contribs)
Jump to navigation Jump to search

Internal

Overview

Containers executed by Docker behave differently in respect to tag resolution than the same containers executed from a Kubernetes pod.

We create a "color:latest" image that serves "blue" and push it on Docker Hub.

Dockerfile:

FROM busybox
CMD echo "I am blue"
docker build -t docker.io/ovidiufeodorov/color:latest .
docker push ovidiufeodorov/color

We run the image:

docker run ovidiufeodorov/color:latest
I am blue


We create a local image that serves "red"

Dockerfile:

FROM busybox
CMD echo "I am red"
docker build -t localimage:latest .
docker run localimage:latest 
I am red

We retag localimage:latest as ovidiufeodorov/color:latest:

docker tag localimage:latest ovidiufeodorov/color:latest

When we run ovidiufeodorov/color:latest we get "red"

docker run ovidiufeodorov/color:latest
I am red