I am invoking "Foo" instance
Actually, you are creating an instance of class Foo.
Specifically, you are allocating a block of memory off the heap via new(). This block of memory is large enough to contain Foo::container and whatever other overhead class Foo requires.
(In this example, there is none. With other classes, there might be additional attributes or perhaps a virtual-pointer table.)
Naturally, new() invokes the (perhaps default?) Foo::Foo() constructor, which in turn initializes Foo::container through the std::vector constructor.
What will be the scope of variable "container"?
container is an attribute [component] of the instance foo. It exists as long as the instance foo exists.
Scope-wise, we can speak of Foo::container. But you cannot access Foo::constainer without an instance of class Foo. (E.g. The object foo.) Foo::constainer doesn't exist without an instance of class Foo.
(There are class-variables that work somewhat differently, where one value is shared across all instances. But that is not the case here.)
This scoping is IRRELEVANT to your public/protected/private/friend member-access-control.
E.g., in some Foo::myPublicMethod() you could refer to Foo::container. Though you could also forgo the explicit scoping in this situation and just refer to it as container.
Mind you, being private, you can't access Foo::container outside of class Foo's methods.
Will that variable exist until I delete the instance foo?
Yes.
Do I need to make the "container" as a pointer to vector?
No. You can, but you certainly don't have to.
Generally speaking, I recommend against class instance members being pointers coupled with new in the constructor and delete in the destructor. It's inefficient and troublesome. (The default copy constructor can copy the pointer value, the destructor can then delete the same pointer value twice.)
Depending on your needs, you might consider:
int main(int argc, char* argv[])
{
Foo foo;
// other method calls to which foo is passed
return 0;
}
foo would go out of scope after return 0;, and be automatically deleted. Moreover, foo would be allocated off the stack rather than the heap.
You might find a used copy of The Annotated C++ Reference Manual useful. It's old, but it has a high signal-to-noise ratio.