Docker HandsOn For Freshers - NON IT

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

DOCKER

PROJECT HANDSON
HandsOn video-
https://www.youtube.com/watch?v=5FfpNuk0sBg&t=4s

Step1 - Take the EC2 Ubuntu instance from AWS with


below configurations
Type - Ubuntu
Size - T2.Micro
GB - 8

Step 2 Install tools like

Maven -

sudo apt update -y


sudo apt install maven -y
mvn -version

Docker -

sudo apt update -y

sudo apt install apt-transport-https ca-certificates curl


software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg
| sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64]


https://download.docker.com/linux/ubuntu bionic stable"
-y

sudo apt update -y

apt-cache policy docker-ce -y

sudo apt install docker-ce -y

#sudo systemctl status docker

sudo chmod 777 /var/run/docker.sock

Git

apt install git

Step 3 - Clone the code

git clone
https://github.com/DEVOPS-WITH-WEB-DEV/spring-clo
ud-kubernetes.git

Step 4 - Go over the docker file in above repo


https://github.com/DEVOPS-WITH-WEB-DEV/spring-clo
ud-kubernetes/blob/main/kubernetes-configmap-reload/
Dockerfile

Step 5 - Build the code with maven

mvn clean install -DskipTests

Step 6 - Go to project folder in Ubuntu where dockerfile


is present

Step 7 - Run the below command to create the docker


image
docker build -t bahubali/1:latest .

Step 7 - Run the below command to create the image


into container

docker run -itd <imageID> –name chirutha

Here chirutha is container name


ImageId is from above screenshot

Step 8 - Go inside the container and check the data

docker exec -it <containerID> /bin/sh


Step 9 - Check the app.jar file in docker