Once again, linking from the Wiki:
In the upper right of this screen is "Cages & Chains", which shows the total number of combined cages plus restraints designated for justice out of the total currently available. It's important to note that although it says "chains", it's counting both ropes and chains as well as cages - and ropes are not as desirable as chains when used as restraints for this purpose. If you have adequate chains and cages (at least 1 cage, rope or chain for every 10 dwarves) the number will be blue, or red if you don't have enough.
As you can see, the problem is not how many of those are free, but that you don't have enough when compared to the number of dwarves in your fortress.