Welcome to the Linux Foundation Forum!

Lab3.1: failing in trying to pull docker.io/library/python:3--no such host

Here there,
is there any registry needed on my VM before pulling image to docker.io? I am failing building docker image for lab3.1.

  1. Below is the command:
    vagrant@cp:~/app1$ sudo podman build -t simpleapp .

  2. Error message from the command:
    STEP 1/4: FROM python:3
    ✔ docker.io/library/python:3
    Trying to pull docker.io/library/python:3...
    Error: error creating build container: initializing source docker://python:3: pinging container registry registry-1.docker.io: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io: no such host

  3. nslookup to verify that registry-1.docker.io is accessible:
    vagrant@cp:~/app1$ nslookup registry-1.docker.io
    Server: 127.0.0.53
    Address: 127.0.0.53#53

Non-authoritative answer:
Name: registry-1.docker.io
Address: 54.83.42.45
Name: registry-1.docker.io
Address: 54.242.59.189
Name: registry-1.docker.io
Address: 3.215.51.67
** server can't find registry-1.docker.io: NXDOMAIN

vagrant@cp:~/app1$

where else should I check? Thanks

Shao

Best Answer

Answers

  • Hi @caishaoping,

    It seems that your custom Ubuntu distribution behaves differently than the official and the cloud distros. Name resolution is not working as expected, so I would recommend editing /etc/resolv.conf on both nodes to add a popular nameserver to fix the DNS issues.

    Regards,
    -Chris

  • Just wanted to follow up with update of my way of resolution to fix the issue, "netplan" was new to me. Here is what I did:

    1. before change:

    vagrant@cp:~/app1$ cat /etc/netplan/50-vagrant.yaml

    network:
    version: 2
    renderer: networkd
    ethernets:
    eth1:
    addresses:
    - 172.16.0.100/24

    1. Vim to chagne:
      vagrant@cp:~/app1$ sudo vim /etc/netplan/50-vagrant.yaml

    2. After the change:

    vagrant@cp:~/app1$ sudo cat /etc/netplan/50-vagrant.yaml

    network:
    version: 2
    renderer: networkd
    ethernets:
    eth1:
    addresses:
    - 172.16.0.100/24
    nameservers:
    addresses: [1.1.1.1,1.0.0.1,8.8.8.8,8.8.4.4]

    1. vagrant@cp:~/app1$ sudo netplan try
      Do you want to keep these settings?
      Press ENTER before the timeout to accept the new configuration
      Changes will revert in 115 seconds

    2. vagrant@cp:~/app1$ sudo netplan apply

    3. vagrant@cp:~/app1$ sudo podman build -t simpleapp .

    STEP 1/4: FROM python:3
    ✔ docker.io/library/python:3
    Trying to pull docker.io/library/python:3...
    Getting image source signatures
    Copying blob d8092d56ded5 done
    Copying blob 3e94d13e55e7 done
    Copying blob 1671565cc8df done
    Copying blob 53ad072f9cd1 done
    Copying blob fa9c7528c685 done
    Copying blob d6b983117533 done
    Copying blob 102b77c1d556 done
    Copying blob c65fe89c654d done
    Copying blob 18db97afaa16 done
    Copying config 4f9baf941f done
    Writing manifest to image destination
    Storing signatures
    STEP 2/4: ADD simple.py /
    .
    .
    .

  • Hi @chrispokorni,

    Yes, my VM is using Chef's 'bento/ubuntu-20.04' version '202206.03.0', will this flavor of Ubuntu give me any difference in CKAD certification testing?

    As to /etc/resolv.conf, I did not have to add new nameservers, instead, I used netplan to apply changes of nameservers, will look further which resolv file is updated by netplan tool.

    Thanks
    Shao

Categories

Upcoming Training