Monte Carlo simulations are used to study the translocation of a polymer into and out of an ellipsoidal cavity through a narrow pore. We measure the polymer free energy F as a function of a translocation coordinate, s, defined to be the number of bonds that have entered the cavity. To study polymer insertion, we consider the case of a driving force acting on monomers inside the pore, as well as monomer attraction to the cavity wall. We examine the changes to F(s) upon variation in the shape anisometry and volume of the cavity, the polymer length, and the strength of the interactions driving the insertion. For athermal systems, the free energy functions are analyzed using a scaling approach, where we treat the confined portion of the polymer to be in the semi-dilute regime. The free energy functions are used with the Fokker-Planck (FP) equation to calculate mean translocation times, as well as translocation time distributions. We find that both polymer ejection and insertion are faster for ellipsoidal cavities than for spherical cavities. The results are in qualitative agreement with those of a Langevin dynamics study in the case of ejection but not for insertion. The discrepancy is likely due to out-of-equilibrium conformational behaviour that is not accounted for in the FP approach.