Obviously there are tradeoffs involved in using containers. But aside from that, they also don't typically get you platform independence by themselves unless you also choose not to use any other cloud features (e.g. object storage, queues, IaaS, "serverless" features like DO Functions or Lambdas, key management services, IAM-type services, etc.).
In my experience, it's building for the cloud as a platform vs targeting a pre-cloud infra that ties you to a particular cloud. You can obviously DIY all of that in your own containers, but then you're making a choice to invest in infra instead of buying it.
Just fine? Fly.io has a fairly seamless automated migration at https://fly.io/launch/heroku ; my Heroku apps are quite portable.
https://www.digitalocean.com/community/conceptual_articles/h... shows a pretty similar approach to Lambda - they just invoke a function with a handler. You could run the same handler on AWS Lambda or Cloudfront's workers, probably without any changes.