It works fine for me using the lxd snap on an 18.04 host with an 18.04 container:
$ lxc launch ubuntu:18.04 c1 Creating c1 Starting c1
$ lxc exec c1 /bin/bash
root@c1:~# sudo snap install ufw ufw 0.36rc from Canonical✓ installed
root@c1:~# sudo ufw enable Firewall is active and enabled on system startup
It works fine for me using the lxd snap on an 18.04 host with an 18.04 container:
$ lxc launch ubuntu:18.04 c1
Creating c1
Starting c1
$ lxc exec c1 /bin/bash
root@c1:~# sudo snap install ufw
ufw 0.36rc from Canonical✓ installed
root@c1:~# sudo ufw enable
Firewall is active and enabled on system startup