It seems to me this line is representative of what the narrator of "The Fish" figuratively sees. This is an important fish, not just a fish or anyfish. This is a wonderful specimen of age and longevity and perseverence and character.
On the outside, though, the fish is not what anyone would call beautiful--
battered and venerable
and homely. Here and there
his brown skin hung in strips
like ancient wallpaper....
It is scarred and battered and lice-ridden and trailing bits of other fisherman's lures and lines. This fish is a testament to age and strength and character and perseverence. While there is an actual rainbow on the spilled oil around the engine on the bottom of the boat, the rainbow in this line is more about the figurative or symbolic nature of a rainbow. This ugly brown trout did not, all of a sudden, regain its coloring; instead, it is an image seen by the narrator of what this fish is on the inside. And the symbolism of promise and hope and beauty are all realized in that image of a rainbow. Then--"I let the fish go."
That line sums up what the entire poem is about, which is how beauty comes can come from destruction and sorrow. You can note how she describes the inside of the fish compared to the outside of it. The rainbow was made of oil which although it damaged the river out of that came beauty