We know that you are a kind and loving owner to your scared Pug, from our previous correspondence with you. Please know that this problem is not your fault and that it is very fixable.
While some Pugs are super outgoing and the 'life of the party' it is not uncommon for others to have more clingy behavior
and feel unsecured unless at home, with the owner. They'll want to stay safe in that 'little world' and need to be coaxed out in a healthy way.
You dog is still very young, at 5 months. We must remember that the world is a very scary place in the eyes of a puppy. A dog must be socialized in order to learn what the world is all about, what is not scary and what is dangerous.
Your Pug appears to be happy at home, she feels safe and secure there. As soon as you open that door, to her it is as if you are opening a door to a terrifying place. A place filled with strange noises and large objects whizzing by. She then goes from being a confident, playful little thing to a scared Pug, afraid of so many elements.
The way to fix this is through a process called Desensitization. This method works, however do know that in order for it to work, you will need to be patient and have a strong commitment to helping your dog.
Once this method is complete, your Pug will have much more confidence and you will be able to enjoy happy walks together and be able to go just about anywhere with her.
It must begin this way: With the door. The door is the catalyst to her fears. Planning ahead, have a small bag of healthy treats about 1 to 2 feet right outside the door. Do not let her see you put them there. Then, because a dog will react to the tone of your voice, in a calm and happy voice say "Let's go outside". Lead her out of the door and say, "Look, treats!" or something to that affect.
Sit next to her while she snacks. Pat her and tell her what a good dog she is. When she is done eating, sit for about 5 or 10 more minutes in the same area. Pat her and talk to her in a calm voice and keep telling her she is good. Then, go back inside your home.
The secret to this working? Every day, you must place the bag of dog treats a bit further away from the door. Each day, you and Pug will walk a bit further away from the door for her to find her happy treat. If dog treats do not work well, you may also do this with dog toys (but this will of course be more expensive to keep buying new and interesting toys!).
After about 2 weeks, you should be at the point of having the dog treats outside your apartment building. Now she will not be afraid of the door, the corridor or leaving the apartment.