Debug School

Nilesh Kumar
Nilesh Kumar

Posted on

Steps to create docker image

Here we are trying to create an image out of base ubuntu image.

======================================================================

How to create an image?

Method - 1 - using containers - 1 Layer a time == docker commit

Method - 2 - using Dockerfile - N Layer a time == docker build


Method - 1 - using containers - 1 Layer a time == docker commit

IMAGE= ubuntu + git + apache2 + java

237 docker run -itd --name raj1 ubuntu
238 docker ps
239 docker exec -it raj1 /bin/bash


INSIDE Container

apt-get update
apt-get install git
apt-get install apache2
apt-get install openjdk-11-jdk -y


240 docker ps
241 clear
242 docker history ubuntu
243 docker ps
244 docker commit -m"up-ub-git-ap-java" -a"Rajesh Kumar" up-ub-git-ap-java
245 docker history ubuntu
246 docker history up-ub-git-ap-java
247 docker images
248 docker run -itd --name newcont up-ub-git-ap-java
249 docker ps
250 dcoker exec git
251 docker exec git
252 docker exec java
253 docker exec which apache2

Top comments (0)