An external HTTP proxy need not know Docker's api service name. For http://api:8080/, the proxy opens the onward connection, so a successful lookup inside the app container does not establish the proxy's DNS view.

For intended direct access, merge the exception into that container's environment:

environment:
  http_proxy: http://proxy.example:8080
  https_proxy: http://proxy.example:8080
  no_proxy: api

Direct requests to api use the container's route and embedded resolver. The two containers still need the shared user-defined network and the service must listen on 8080. Eligible external requests retain the proxy. If those public destinations may use a public intermediary, the HTTP proxy list supplies candidates for the no-account proxy URLs; keep api in the direct exceptions.

If recreated containers keep unexpected variables, inspect the Docker client's config.json proxies section, which can inject environment values. Change the intended entry and recreate affected containers through the normal flow, preserving unrelated configuration.

Artihkkalat mat laktásit