Using a statistically representative sample of 911 central galaxies (CENs) from the Sloan Digital Sky Survey (SDSS) Data Release 4 group catalogue, we study how the structure (shape and size) of the first rank (by stellar mass) group and cluster members depends on (1) galaxy stellar mass (M(star)), (2) the global environment defined by the dark matter halo mass (M(halo)) of the host group and (3) the local environment defined by their special halocentric position. We quantify the structure of SDSS galaxies with a GALFIT-based pipeline that fits two-dimensional Sersic models to the r-band image data. Through tests with simulated and real galaxy images, we demonstrate that our pipeline can recover Sersic parameters without significant bias. We find that the fitting results are most sensitive to the background sky level determination, and we strongly recommend using the SDSS global value. We also find that uncertainties in the background sky level translate into a strong covariance between the total magnitude, the half-light radius (r(50)) and the Sersic index (n), especially for bright/massive galaxies. Applying our pipeline to the CEN sample, we find that n of CENs depends strongly on M(star), but only weakly or not at all on M(halo). The n -M(star) relation holds for CENs over the full range of halo masses that we consider. Less massive CENs tend to be disc like and high-mass systems are typically spheroids, with a considerable scatter in n at all galaxy masses. Similarly, CEN sizes depend on galaxy stellar mass and luminosity, with early-and late-type galaxies exhibiting different slopes for the size-luminosity (r(50)-L) and the size-stellar mass (r50 -M(star)) scaling relations. Moreover, to test the impact of local environment on CENs, we compare the structure of CENs with that satellite galaxies (SATs) of comparable M(star). We find that low-mass (<10(10.75) h(-2) M(circle dot)) SATs have somewhat larger median Sersic indices than CENs of a similar M(star). Furthermore, low-mass, late-type SATs are moderately smaller in size than late-type CENs of the same stellar mass. However, we find no size differences between early-type CENs and SATs and no structural differences between CENs and SATs when they are matched in both optical colour and stellar mass. The similarity in the structure of massive SATs and CENs demonstrates that the halocentric distinction has no significant impact on the structure of spheroids. We conclude that M(star) is the most fundamental property determining the basic structural shape and size of a galaxy. In contrast, the lack of a significant n-M(halo) relation rules out a clear distinct group mass for producing spheroids. The existence of spheroid CENs in low- and high-mass groups suggests that the morphological transformation processes that produce spheroids must occur at the centres of groups spanning a wide range of masses.