Resolve Dockerfile issues

@rahul456

Items underlined in red are altered in order to build the image correctly. Image is built successfully from the dockerfile as shown. Where is the problem?

Hello @Devops
But as per my understanding image name and tag <none> comes only when image build process is not done successfully.

The command I used to build the image without tagging ( intentionally) is : docker build .

I want to know what is my mistake.

I have attempted this in past and this is what is my output from build. The only difference i noticed is in my Dockerfile i didn’t had ^ symbol for sed and also i have used single quotes. Though that doesn’t makes any difference, the reason is we can see you have successfully built the image. So, now we need to know how the KodeKloud validates this question at their algorithm.

[root@stapp03 docker]# docker build .
Sending build context to Docker daemon  9.216kB
Step 1/8 : FROM httpd:2.4.43
 ---> f1455599cc2e
Step 2/8 : RUN sed -i 's/Listen 80/Listen 8080/g' /usr/local/apache2/conf/httpd.conf
 ---> Running in 90c91c24360e
Removing intermediate container 90c91c24360e
 ---> 1aeb91a395ac
Step 3/8 : RUN sed -i '/LoadModule\ ssl_module modules\/mod_ssl.so/s/^#//g' conf/httpd.conf
 ---> Running in 812bc7aa167d
Removing intermediate container 812bc7aa167d
 ---> 13a1ed167132
Step 4/8 : RUN sed -i '/LoadModule\ socache_shmcb_module modules\/mod_socache_shmcb.so/s/^#//g' conf/httpd.conf
 ---> Running in 35e46d5f5830
Removing intermediate container 35e46d5f5830
 ---> 4f590c2ee199
Step 5/8 : RUN sed -i '/Include\ conf\/extra\/httpd-ssl.conf/s/^#//g' conf/httpd.conf
 ---> Running in 0f3d6df0b3e1
Removing intermediate container 0f3d6df0b3e1
 ---> c106f2bd6d86
Step 6/8 : COPY certs/server.crt /usr/local/apache2/conf/server.crt
 ---> 027a1a71ed72
Step 7/8 : COPY certs/server.key /usr/local/apache2/conf/server.key
 ---> d3a4049a4987
Step 8/8 : COPY html/index.html /usr/local/apache2/htdocs/
 ---> cbc204fb314e
Successfully built cbc204fb314e
[root@stapp03 docker]#

[root@stapp03 docker]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              cbc204fb314e        44 seconds ago      166MB
httpd               2.4.43              f1455599cc2e        2 weeks ago         166MB
[root@stapp03 docker]#

@ramashish.sharma

Same output I got in my case.
@rahul456
Please let me know where is my mistake

@rahul456
I found a typo mistake in my Dockerfile when copying from my laptop to KK lab

I copied index.html to /usr/local/apache2/conf/htdocs and it should /usr/local/apache2/htdocs

1 Like

Nice @Devops. Good to hear you found your solution.

Hi Sharma

Can you explain to me, why do you know certs path and html/index.html ? at step 6,7,8

Thanks