Gluons mediate the strong interaction. This interaction only acts between quarks and it is responsible to keep the quarks together in the hadrons - it is not possible to observe a free quark!
If one tries to "pull out" a quark from a hadron will the strong interaction will function similarly to an elastic band. If one pulls so hard that the "rubber band breaks", then a new quark-antiquark pair will be created. Together with the initial quarks, these newly created quarks rapidly form new hadrons. This process is so fast that one does not have the time to observe any free quarks. This means that the effect of the gluons is only notable inside the baryons and mesons.
The strong interaction is in addition responsible for keeping the baryons in the atomic nucleus together. This interaction can also be explained by assuming that -mesons plays the roll of exchange particles. This model is valid on the borderline between the size of hadrons or slightly bigger, that is on distances larger than 10-15 m.
The strong interaction wins over the very powerful electrical repulsion between the positively charged protons inside the nucleus.