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 (: