Prevent Docker from passing proxy to container

According to the official Docker documentation, proxy related envionment variables of the host are readily available as build arguments. My situation is the following:

  • Host machine has no environment proxy variables, but has a proxy configuration in ~/.docker/config.json
  • Dockerfile for the images makes no use of the proxy build arguments nor envionment variables
  • Containers have proxy environment variables setted with the values configured in the ~/.docker/config.json

I don’t want the proxy variables in the container, why are they being configured? How can I prevent this from happening?

I’m using as a base image php:7.3-apache-buster. It’s Dockerfile doesen’t seem to have any use of the proxy env variables. Could the problem be with their image?

I get this problem running containers with docker run and docker-compose up, but the variables are not in the containers if I use docker stack deploy.