A recent change in the way the config location of modules is decided in the upstream PHP images can result in the error message in the title.
The config location is decided by the environment variable "PHP_INI_DIR", which is set as part of the image's environment.
If using sudo to enable config, the necessary environment variable is stripped before the command is run, resulting in the config going to the wrong place.
To get things to work as they did before, you can add the -E flag to the sudo command to have it preserve the environment.
sudo docker-php-ext-install mcrypt
sudo -E docker-php-ext-install mcrypt