It works fine on AWS both on the host directly and also in an LXD container as long as you launch the right AWS image. I have multiple Discourse installs running in LXD on AWS.
Use this image on AWS: Ubuntu Server 18.04 LTS (HVM), SSD Volume Type - ami-0a313d6098716f372 (64-bit x86) / ami-01ac7d9c1179d7b74 (64-bit Arm)
I also recommend following the official Docker install guide: