*Executed some more Docker commands *
• cp 
• diff 
• rename 
• port 
• update 
• wait 
• logs 
• events 
• top 
• inspect 
*Docker commands for images *
• docker images 
• docker pull 
• docker info 
• docker rmi 
• docker inspect 
• docker commit – m “message” – a”name” container id alias name 
*How to design docker image *
docker run -itd ubuntu
docker exec -it “containerid” /bin/bash
install java 
apt-get update
apt-get install openjdk-11-jdk -y
apt-get install openjdk-11-jdk-headless -y
install apache 
apt-get install apache2 -y
Install wget 
apt-get install wget -y
Install war file 
wget https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war
chmod 755 sample.war
commit the image 
docker commit -m"message" -a"Palak" containerid name 
docker images
Validate java and apache 
docker exec containerid java
docker exec containerid which apache2
docker exec containerid ls /opt/
Saving and loading tar file 
After committing the docker image 
Save the file 
docker save -o image.tar name of image
you can stop the containers if u want 
Load the file 
docker load -i image.tar
Pushing the docker image to repository 
Create an account in docker hub 
Login to docker hub in putty 
docker login
provide username and password 
tag the image matching to repo name 
docker tag image palakg1904/demo
Push the image to repo
docker push palakg1904/demo
Top comments (0)