Yes it's okay to hug your dog as long as the dog likes you hugging them.
I have a dog that loves hugs and he will come jump in my lap and put his front legs around my neck initiating the hug himself and then I embrace him in a hug as well.
If the dog doesn't like hugs then don't force them on him/her but if the dog likes hugs it's okay to hug them.