It sounds like he isn’t doing it to “go potty”, he’s doing it to mark his territory.
We adopted a black lab about 18 months ago. Before we brought him home, our “adoption counselor” told us to put a short lease on him before we let him enter the house, and if we saw him start to lift his leg, give a quick tug on the leash & tell him “NO!” very firmly.
She said if there has been any other pets in the household, he can probably smell them & is trying to mark his territory. And he’s probably a little scared & confused too….