How can we take pressure of ideal gas be equal to pressure of atmosphere if container is open I can better put my doubt in form of problem:
The temperature of a gas placed in an open container is raised from $27^o$ C to $227^o$ C. The percent of the original amount of the gas expelled from the container will be:
Now in the solution we apply ideal gas equation and say that pressure remains constant since the pressure is from atmosphere
But during derivation of pressure of ideal gas
This stack:
Why collisions with other molecules not taken in account here?
The gas is taken in a closed container and this makes the container symmetric and also easy to derive equation .
But in case of this question then how can we apply ideal gas law
Also in case of unsymetrical (example cylinder) container to still hold? Since we started with cubical container
 A: The answer is randomness and symmetry, as in the post you linked.
In a container without a lid, air acts much like a lid would have. When air molecules bounce off the walls of the container, molecules in the wall vibrates some, but they are held in place by atomic bonds.
At the open "lid", air molecules from the container bounce off air molecules from outside. These are not held in place, so they can be bounced around. Sometimes the inside and outside molecules both bounce back. Sometimes the inside molecule is traveling faster and both molecules wind up outside. Sometimes the outside molecule is faster and both wind up inside. It balances.

The shape of the container doesn't matter. The idea that the walls are like a smooth mirror and molecules bounce off them like like is an idealization. It is true on average. But on an atomic scale, walls are generally rough with small areas oriented in many directions. And they are made of molecules, not smooth mirror stuff. Air molecules bounce off in all different directions, but they always bounce back.
Bouncing back means there is an outward force perpendicular to the wall. Sometimes bouncing in a mirror like direction, sometimes steeper, sometimes flatter means on average there is no force parallel to the wall.
Microscopically the wall has many orientations, but on a larger scale the orientations average to the orientation you see. And the microscopic outward forces average to an outward force perpendicular to the orientation you see.

The whole point of statistical mechanics is that keeping track of all the details makes the problem too complicated to work with. So people found ways to work with average values and ignore the details. Sometimes all the things that get ignored are not obvious. Good job thinking about it.
