Do you see any logs? (docker logs containername)
Have you tried to run the command in the container manually? (âdocker run --rm -it imagename bashâ and run the command defined in the Dockerfile)
Note that the process inside the container has to run in the foreground to keep the container alive.
Instead of separating commands using && in one CMD definition, you should create a custom entrypoint or command script and run the final command with exec. I have some examples why you should use exec:
And I am able to keep the container running for sure as long I am bash in it.
Any idea what the issue with -d to have detached and running on docker run automatically without the bash? or if there is something missing from the Dockerfile to have that fixed?
Based on what youâve described, there might be an issue with the CentOS image or the Postfix or SendGrid configurations. Have you tried running the container without the --cap-add=NET_BIND_SERVICE option to see if that makes a difference?
Also, have you checked the logs for any error messages that might provide more insight into the issue? Itâs also worth noting that CentOS 7 Extended Lifecycle Support is available starting in 2024, so you could consider sticking with CentOS for now and trying to troubleshoot the issue further or perhaps exploring other options for running Postfix with SendGrid.