Going to run some commands inside of a container to demonstrate the issue here. I'm also going to use free -m instead of free -b because it's easier to see differences.
$ free -m
total used free shared buff/cache available
Mem: 7951 578 4292 333 3080 6919
Swap: 1024 0 1024
{print $2} should match total:
$ free -m | grep "Mem:" | awk '{print $2}'
7951
Looks good!
{print $7} should match used:
$ free -m | grep "Mem:" | awk '{print $7}'
6919
It matches available.