Buckling of peapods, nanotubes and fullerenes