We use pen fence like these. https://www.chewy.com/frisco-dog-exercise-pen-step-through/dp/125049
Obviously your dogs height, jumping ability and desire to get away and run will determine if they try to jump it. Our dogs are small terriers and really just want to be around us so it's more of a formality and safety barrier if a stray dog were too approach.
My wife is into dog sports and these fences are called ExPens, search your local craigslist for them.
1992 D250 Cummins 5psd
2005 Forest River T26 Toy Hauler