Where in your leg?
Likely down to saddle height or simply being stuck in one position. Do you stop, get out of the saddle, move your position at all? How long does your “10 miles” take you?
Forget the trainer until winter and get on the roads
Stop riding until you’ve figured out the issue?
What bike?
Are you new to riding?
Do you stretch?
Do you do any other sport, exercise?