There are two types of electrostatic forces: interatomic or intermolecular.
In this case the type of force that prevents ice cubes from adopting the shape of their container is intermolecular.
Within a molecule, the atoms are held together by interatomic forces. These forces are what determine the chemical properties of substances because it is these forces that must be overcome for a chemical change to occur.
In summary, intermolecular forces are characterized by holding more than one molecule together.
On the other side, intermolecular forces act on different molecules or ions and cause them to attract or repel each other, causing different physical states in chemical compounds.
Therefore, the intermolecular forces are responsible for the existence of the liquid and solid state (between the molecules of a gas do not exist intermolecular forces.).
Then ice cubes do not ocuppy the shape of thir container because it is in solid state, existing intermolecular force between molecules to maintain said physical state.
In summary, the type of force that prevents ice cubes from adopting the shape of their container is intermolecular.
Learn more about intermolecular forces: