Level 4 Docker - Resolve Dockerfile Issues

Hey, I have issue with this task, not sure if it’s something that I missed or misconfiguration of the env. Would appreciate any help (:

This is the initial Docker file:

[root@stapp02 docker]# cat Dockerfile 
FROM httpd:2.4.43
RUN sed -i "s/Listen 80/Listen 8080/g" /usr/local/apache2/conf/httpd.conf
RUN sed -i '/LoadModule\ ssl_module modules\/mod_ssl.so/s/^#//g' conf/httpd.conf
RUN sed -i '/LoadModule\ socache_shmcb_module modules\/mod_socache_shmcb.so/s/^#//g' conf/httpd.conf
RUN sed -i '/Include\ conf\/extra\/httpd-ssl.conf/s/^#//g' conf/httpd.conf
COPY /server.crt /usr/local/apache2/conf/server.crt
COPY /server.key /usr/local/apache2/conf/server.key
COPY ./index.html /usr/local/apache2/htdocs/

Running build without any changes to the file to check what is the first error:

[root@stapp02 docker]# docker build -t httpd-test .
[+] Building 61.0s (2/2) FINISHED                                      docker:default
 => [internal] load build definition from Dockerfile                             0.0s
 => => transferring dockerfile: 543B                                             0.0s
 => ERROR [internal] load metadata for docker.io/library/httpd:2.4.43           60.9s
------
 > [internal] load metadata for docker.io/library/httpd:2.4.43:
------
Dockerfile:1
--------------------
   1 | >>> FROM httpd:2.4.43
   2 |     
   3 |     RUN sed -i "s/Listen 80/Listen 8080/g" /usr/local/apache2/conf/httpd.conf
--------------------
ERROR: failed to solve: DeadlineExceeded: DeadlineExceeded: DeadlineExceeded: httpd:2.4.43: failed to resolve source metadata for docker.io/library/httpd:2.4.43: failed to copy: httpReadSeeker: failed open: failed to do request: Get "https://docker-registry-mirror.kodekloud.com/v2/library/httpd/manifests/sha256:cd88fee4eab37f0d8cd04b06ef97285ca981c27b4d685f0321e65c5d4fd49357?ns=docker.io": dial tcp 10.0.0.6:443: i/o timeout

So I can see that it tried to pull from https://docker-registry-mirror.kodekloud.com/ dial and got tcp 10.0.0.6:443: i/o timeout

The registry network redirection config are in /etc/hosts file:
10.0.0.6 docker-registry-mirror.kodekloud.com

I can see this registry was set up in /etc/docker/daemon.json:

[root@stapp02 docker]# cat /etc/docker/daemon.json
{
  "insecure-registries" : ["http://stregi01.stratos.xfusioncorp.com:5000"],
  "storage-driver": "vfs",
  "exec-opts": [
    "native.cgroupdriver=cgroupfs"
  ],
  "bip":"172.12.0.1/24",
  "registry-mirrors": [
    "http://docker-registry-mirror.kodekloud.com"
  ]

}

Here the bridge ip is in a different range than the hosts file ip.

When pulling the image with docker pull httpd:2.4.43 it works:

[root@stapp02 docker]# docker pull httpd:2.4.43
2.4.43: Pulling from library/httpd
bf5952930446: Pull complete 
3d3fecf6569b: Pull complete 
b5fc3125d912: Pull complete 
3c61041685c0: Pull complete 
34b7e9053f76: Pull complete 
Digest: sha256:cd88fee4eab37f0d8cd04b06ef97285ca981c27b4d685f0321e65c5d4fd49357
Status: Downloaded newer image for httpd:2.4.43
docker.io/library/httpd:2.4.43

It works since it is pulled from docker.io directly as I understand.
.
Checked the registry for availability with curl and login:

[root@stapp02 docker]# curl -v http://docker-registry-mirror.kodekloud.com/v2/
*   Trying 10.0.0.6:80...
* Connected to docker-registry-mirror.kodekloud.com (10.0.0.6) port 80 (#0)
> GET /v2/ HTTP/1.1
> Host: docker-registry-mirror.kodekloud.com
> User-Agent: curl/7.76.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK

AND 

[root@stapp02 docker]# docker login http://docker-registry-mirror.kodekloud.com
Username: ^C

Tried pulling directly from the ‘docker-registry-mirror.kodekloud.com’ registry:

[root@stapp02 docker]# docker pull docker-registry-mirror.kodekloud.com/library/httpd:2.4.43
Error response from daemon: Get "https://docker-registry-mirror.kodekloud.com/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

So it looks like it is able to access it via network via name and IP but not to pull the image.
So not sure if this is my issue and I need to edit one of the files listed here or config docker somehow, or an issue with the network.

Pulling the image in different step will not result in passing the task since it’s delete all the images before running the build command.

Thank for reading so far (:

Hi,

Thanks for your detail feedback.

I’ve just checked it and it’s worked properly from my end. Could you please try agian and let me know if it persists?

Thank you @raymond.baoly, I checked the task again and looks like the issue is gone and I was able to pass the task. Thank again!

Also would like to share that I saw the same issue again on a different task in the level 4 docker - Docker Node App lab, tried to stop and create a new lab and this still had the same issue and error, not sure how to tag the site maintainers.

Hi @ilanap25,

Thanks for your feedback. I’ll look into this case, try to recreate the issue, and forward it to the team to fix.

Hey @raymond.baoly,
If I will see the same issue again how can I forward it to the team? used the feedback button or use other method?

Yes, you can use the Feedback button, which lets you take a screenshot and send it to the team.

1 Like

Hello,

I am having the same issue on the two first labs of docker level4. I can’t pull images to complete the task.

I wll let you know once it is fixed.

I have had the same problem also with level-2 task-5 “write a dockerfile”. (level-1 task-1 && task-2 as well)
I have used tcpdump and I have seen the problem is: the docker pull makes http request but docker buildx build makes https request which times out.

Hi @raymond.baoly, is there an issue with this task (Docker level 4 - Task 1)?

Hi Srikanth_Reddy,

The team are fixing the Docker level 4 | Task 1 and Task 2. I’ll keep you update.

Hi jakabk,

I just checked, and there is no issue with Level 2 Task 5. The Ubuntu image can be pulled successfully.

On my site the error exists yet:

Hi Jakabk,

Thanks for your detailed feedback. I’ve forwarded Docker Level 2 | Task 5: Write a Dockerfile as well. It will be reviewed and fixed.

1 Like

Hi @raymond.baoly,

Is there any update on docker level 4 tasks?

Hi @raymond.baoly,
I suppose the issue with Docker level 4 tasks has been resolved. I was able to finish those tasks.

Hi @Srikanth_Reddy,

Thanks for verifying and confirming. Let me know if there are any issues.

No issues in Docker tasks, but can you check this topic?
There is some issue with Azure level 3 - task 9, that I’ve detailed in that topic.

Noted it, I’ll check it.