10 gallon is perfect for a hatchling. The time it takes your snake to outgrow the tank would depend on how often you feed (a snake fed appropriate prey every 7 days will grow slower than a snake fed appropriate prey every 5 days, for example) and on the snake itself. Usually they'll tend to grow very quickly when they're younger, but you'll have some time.
You'll know it's time to bring up the tank size when you start to see that the snake is taking up a lot of space or it gets tight for the snake to get all of its body onto the warm side.