I have a scenario where I'm using a primary SMTP server from cPanel, however I'm running a Dockerized web app on a second server that is having trouble delivering to the main smtp server due to a bug in a Ruby library that's being used.
Would there be any problems caused by setting up Postfix or Exim as a local SMPT server on the Docker app server for the system to use to deliver emails when there's already an existing primary STMP server for the domain? Are there some additional steps that are necessary in order to eliminate any problems in such a configuration?
It is common to have multiple servers in a domain. Normally very few servers, usually designated as an MX, send mail directly to the internet. Only server(s) designated as an MX should be receiving mail from the internet (not likely an issue in your case). Other servers in the network will forward their mail to a relay server, often an MX server, which will route their mail to the internet.
In your case you can install Exim or Postfix in you container, and configure it to use a smarthost. This can be the host if, it accepts mail the network. If not, it should be the relay server for your network.
Their are lighter weight relay servers such as SSMTP which are designed for your situation. This is likely a better fit for your situation.
EDIT: If you need a running sever, then something like Simple Mail Forwarder might be a good fit.
Many libraries will allow you to set the server address for SMTP, which usually defaults to "localhost". They may also allow calling the mail process directly using "sendmail" command line format.