I’m a bit puzzled by the messages I can see in your logs, honestly.
The message clearly states that there’s an i/o timeout trying to connect to the external resources, but whenever you run the commands manually, they work.
The internal http method of the Mattermost server seems to have some fixed timeouts set for DNS resolution and content reception after the connection has been established, maybe your DNS resolution is slow inside the container or something like this and therefore you exceed the configured timeouts?