kubernetes tutorial | Dockerfile | Create a docker image using Dockerfile | DEMO

Published: 22 July 2021
on channel: VSPARKZ
568
9

Certified Kubernetes Administrator
*************************************

kubernetes tutorial | Dockerfile | Create a docker image using Dockerfile | DEMO

Description:
*************
In this video, you are going to learn the basics of Dockerfile & how to Create a container Image using Dockerfile.

1. How to create our own Images ?
2. What is Dockerfile ?
3. Approach to create an image using Dockerfile
4. Images Layers
5. Docker File Instructions
6. DEMO: Create a docker Image using Dockerfile



For suggestions/feedback/doubts contact
email: [email protected]

Happy Learning !!!


===========================================================================================
USEFUL LINKS:
###########


Docker Documentation:
***********************
https://docs.docker.com/

Dockerfile Reference:
***********************
https://docs.docker.com/engine/refere...

Dockerfile best practices:
***************************
https://docs.docker.com/develop/devel...


==========================================================================================
#cka #kubernetes #k8s #containers #docker


DEMO Steps:
**************

Step 1: Connect to Docker Host & Check docker is started
---------------------------------------------------------------------------------------------

$ service docker status


Step 2: Create & Review the Dockerfile
-------------------------------------------------------------

$ vi Dockerfile


Dockerfile to build the VSPARKZ webserver

FROM ubuntu:latest

RUN apt-get update -y

RUN DEBIAN_FRONTEND=noninteractive apt-get install apache2 -y

COPY index.html /var/www/html/index.html

EXPOSE 80

ENTRYPOINT ["apachectl", "-D", "FOREGROUND"]


Step 3: Build the image using Dockerfile
----------------------------------------------------------------

$ docker build -t vsparkz/webserver:latest .


Step 4: Push the new image to docker hub
----------------------------------------------------------------------

$ docker login

$ docker push vsparkz/webserver:latest


Step 5: Clean the local registry & the other traces
-------------------------------------------------------------------------------


$ docker rmi ubuntu:latest

$ docker rmi vsparkz/webserver:latest


Step 6: Test the New Image
----------------------------------------------

$ docker run -d -p 8080:80 --name happy vsparkz/webserver:latest