[Fixed] curl: (6) getaddrinfo() thread failed to start for PHP upgrade to 8.2.x in WordPress application – Php

by
Ali Hasan
alpine-linux boot2docker composer-php kubernetes-networking wordpress

Quick Fix: Update Docker to a more recent version. This can be done using the following command:

sudo apt install docker-ce

The Problem:

I recently upgraded the PHP image from 8.1.19 to 8.2.7 in my WordPress application running on a CentOS Linux on-prem server using Docker. After the upgrade, I am unable to update plugins. When I tried to check the issue by running curl -I google.com inside the container, it throws the error: curl: (6) getaddrinfo() thread failed to start.

I checked the listening ports on the server and found that it is using IPv6 for ports 80 and 443 for docker-proxy, while on other servers and my local, it is using IPv4. I suspect this might be causing the issue. How can I force docker to use IPv4 for ports 80 and 443? It’s worth noting that this issue did not occur with PHP 8.1.19 and lower, only with 8.2.x.

The Solutions:

Solution 1: Update Docker to a newer version

The issue was resolved by updating Docker to a newer version. The previous version being used (18.09.7) was outdated and caused compatibility issues with PHP 8.2.x. By updating Docker to a more recent version (24.0.4), the issue with IPv6 binding was resolved, allowing the WordPress application to successfully update plugins and perform other network-related tasks.

Q&A

What Docker version was causing the IPv6 issue?

18.09.7

What Docker version solved the IPv6 issue?

24.0.4

Video Explanation:

The following video, titled "How to fix Error Error downloading packages || curl error (6) couldn't ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

This video how to fix The downloaded packages were saved in cache until the next successful transaction, You can remove cached packages by ...