There is a pressing need to better understand how microbial populations respond to antimicrobial drugs, and to find mechanisms to possibly eradicate antimicrobial-resistant cells. The inactivation of antimicrobials by resistant microbes can often be viewed as a cooperative behaviour leading to the coexistence of resistant and sensitive cells in large populations and static environments. This picture is, however, greatly altered by the fluctuations arising in volatile environments, in which microbial communities commonly evolve. Here, we study the eco-evolutionary dynamics of a population consisting of an antimicrobial-resistant strain and microbes sensitive to antimicrobial drugs in a time-fluctuating environment, modelled by a carrying capacity randomly switching between states of abundance and scarcity. We assume that antimicrobial resistance (AMR) is a shared public good when the number of resistant cells exceeds a certain threshold. Eco-evolutionary dynamics is thus characterised by demographic noise (birth and death events) coupled to environmental fluctuations which can cause population bottlenecks. By combining analytical and computational means, we determine the environmental conditions for the long-lived coexistence and fixation of both strains, and characterise a fluctuation-driven AMR eradication mechanism, where resistant microbes experience bottlenecks leading to extinction. We also discuss the possible applications of our findings to laboratory-controlled experiments.