Base images are images that are built using scrtach. This can be seen in their Dockerfiles.
## debian:buster-slim
FROM scratch
ADD rootfs.tar.xz /
CMD ["bash"]
On the other hand, parent images are built on top of base images. Parent Images can also be built on top other parent images, An example of this is the HTTP image.
## httpd
FROM debian:buster-slim
ENV HTTPD_PREGIX /usr/local/apache2
ENV PATH $HTTPD_PREFIX/bin:$PATH
WORKDIR $HTTPD_PREFIX
. . . .
When choosing base images in Dockerhub:
Application container MUST ONLY CONTAIN:
Application container MUST NO CONTAIN:
Naming convention of images:
If the images are stored in private registries, then the “docker.io” should be the name of your private registry. To pull and run containers from private registries:
To use containers stored in private registries on our Pod definition files, we must first creaate the secret with type docker-registry. This secrets is designed specifically to store Docker credentials.
kubectl create secret docker-registry my-creds \
--docker-server=private-registry.io \
--docker-username=registry-user \
--docker-password=registry-password \
--docker-email=registry-user@org.com
Now we specify the image in the Pod manifest.
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mycontainer
image: private-registry.io/apps/internal-app:latest
imagePullSecrets:
- name: my-creds