I'm sharing my answer to help anyone who might face a similar issue.
In my case, I was testing a deployment with Jenkins in a DigitalOcean Kubernetes cluster. However, I didn’t know that starting from version 1.31 of DigitalOcean Kubernetes, the cluster nodes no longer include the Docker daemon.
The Docker daemon has been deprecated since Kubernetes 1.20, but DigitalOcean kept it available on nodes until version 1.30. You can find more details in the changelog: DigitalOcean Kubernetes Changelog - https://docs.digitalocean.com/products/kubernetes/details/changelog/.
One solution is to use Kaniko. It doesn't require a Docker daemon to build and push Docker images. Here's a helpful guide: How to Use Kaniko to Build Docker Images on Jenkins - https://senertugrul.medium.com/how-to-use-kaniko-to-build-docker-images-on-jenkins-216a68caf7b8.