May be a lot of you, have seen this deprecation message while the migration to symfony 5.1.
So here the solution:
Symfony is really discouraging the injection of the global container. To fix the message, all you need to do is to explicitly define the ContainerInterface alias as the Symfony Profiler recommanded you:
# services.yml or yaml services: Symfony\Component\DependencyInjection\ContainerInterface: '@service_container'