We consider a one-dimensional model allowing analytical derivation of the effective interactions between two charged colloids. We evaluate exactly the partition function for an electroneutral salt-free suspension with dielectric jumps at the colloids’ position. We derive a contact relation with the pressure that shows there is like-charge attraction, whether or not the counterions are confined between the colloids. In contrast to the homogeneous dielectric case, there is the possibility for the colloids to attract despite the number of counter-ions (N) being even. The results are shown to recover the mean-field prediction in the limit N→∞.