There are many ways to check whether your system is running in a virtualized platform or as a container. On systems with systemd as their service manager you always can run the two following commands to get that information:
Detect whether we are in a VM:
/usr/bin/systemd-detect-virt
Detect whether we are in a container:
/usr/bin/systemd-detect-virt -c
Alternatively, you can always run this command to check the DMI table decoder to find information about your system's hardware components and also to confirm if you are running in a virtualized environment: (QEMU stands for Quick EMUlator and is a very common virtualized technology on Linux systems)
dmidecode | egrep -i 'manufacturer|product'
Manufacturer: OpenStack Foundation
Product Name: OpenStack Nova
Manufacturer: QEMU
Manufacturer: QEMU
Manufacturer: QEMU
Manufacturer: QEMU
And finally, on cPanel servers, you are always able to check the content of /var/cpanel/envtype to see if your server is a physical instance or a virtualized instance:
cat /var/cpanel/envtype && echo -e "\n"
kvm