We report layering transitions within a charged silica colloidal dispersion confined by two opposite like-charged dielectric walls. The ensemble- averaged concentration profiles of the colloids (radius 60 +/- 2 nm) along the confinement direction have been determined using synchrotron X-ray diffraction from microfluidic arrays of channels of different widths. For small channel widths up to a critical value of 300 nm, the channel can accommodate just one layer of colloids which is stabilized against buckling by the confining charged walls. For channel widths larger than this critical value, a buckling of the single layer is observed. These phenomena are explained using a theoretical analysis of buckling instabilities due to Chou and Nelson, and a value for the charge density on the stabilizing charged walls is derived. At still larger channel widths a sequence of complex layering transitions is observed which involve the splitting and merging of individual layers. Copyright (C) EPLA, 2009