Hi, Is it mandatory to use base image for building image through Dockerfile? if yes, how to proceed for any app containerization whose base image is not found under docker hub?
You can use any base image from any registry and push to any registry if you want. You could create an image from scratch (FROM scratch) which means you need to create the entire filesystem and copy into the image.
You could also install interactively and commit the container to an image but that is a bad practice:
I am trying to build and run container, build is ok but while running container I m getting exception, below is details.
*
Dockerfile
FROM centos:centos7.9.2009
RUN yum -y install java-1.8.0-openjdk \ net-tools which \ && yum clean all
RUN mkdir /vxi
WORKDIR /vxi
COPY vxi_1091 /vxi
CMD /vxi_1091/bin/run_vxi_1091.sh
build o/p
[root@imi-hyd-rnd1 docker]# docker build -t vxi .
Sending build context to Docker daemon 87.73MB
Step 1/6 : FROM centos:centos7.9.2009
—> eeb6ee3f44bd
Step 2/6 : RUN yum -y install java-1.8.0-openjdk \ net-tools which \ && yum clean all
—> Using cache
—> daab11a97cca
Step 3/6 : RUN mkdir /vxi
—> Using cache
—> 41f32cba0657
Step 4/6 : WORKDIR /vxi
—> Using cache
—> b2aba0e1ac69
Step 5/6 : COPY vxi_1091 /vxi
—> Using cache
—> b015ea8589cd
Step 6/6 : CMD /vxi_1091/bin/run_vxi_1091.sh
—> Running in b56215edb1f9
Removing intermediate container b56215edb1f9
—> f5409f5d35e3
Successfully built f5409f5d35e3
Successfully tagged vxi:latest
* running container
[root@imi-hyd-rnd1 docker]# docker run -it vxi
/bin/sh: /vxi_1091/bin/run_vxi_1091.sh: No such file or directory