A simple and flexible method has been developed to fabricate reversibly switchable nanocontainers (by layer by layer assembly) using zinc phosphate (ZP) nanoparticles as a core material and subsequent deposition of oppositely charged species of polyelectrolyte (polyaniline and polyacrylic acid) and organic corrosion inhibitor (immidazole). Immidazole was entrapped between polyaniline (PANI) and polyacrylic acid (PAA). The PAA nanovalve can control the access of immidazole molecules to and from the nanocontainers. The average particle size of the synthesized nanocontainer was found to be in the range of 250–500 nm. X-ray diffraction (XRD), particle size analysis (PSA), zeta potential, and fourier transform infrared spectroscopy (FTIR) analysis confirms the successful formation of the layered structure of nanocontainers. UV-vis spectroscopy was used to analyze the release rate of immidazole in media of different pH as a function of time. This core-shell nanostructure can have potential applications in corrosion inhibition paint formulation.