Understanding interaction between two quarks Two protons and two electrons repel each other as they have same charge. Protons and electrons attract each other since they are oppositely charged. 
A single proton is made up of two up and one down quark held together by gluons. 
So, do there exist forces of attraction or repulsion between quarks in the same proton?
 A: Yes, it is called quantum chromodynamics (QCD). The gluons that you mentioned are the carriers of this force and it is responsible for making quarks in a proton stick together.
A: Yes, what you are looking for is the strong force, mediated by gluons. Now one of the main differences between the EM force and the strong force is that in the case of the strong force, even the mediator, the gluon is charged, gluons too can have color charge.
This complicates the whole picture of the nucleons, inside the quarks, antiquarks, gluons create a sea and in this sea the innumerable quarks, antiquarks and gluons constantly interact with each other, get created, annihilate. The picture you see of nucleons having only in your case two up and one down quark is only the net of the interactions, and they are called valence quarks.

This should be a picture closer to reality, and this is how you could maybe imagine a proton.
Now you are asking whether the quarks can attract and repel each other, and the answer is yes but it is more subtle then that, because the color force is mediated by charged gluons, where gluons are able to interact with other gluons too, and contrary to the EM force, the color charge has three attributes (not just attract and repel like for the EM force), and these cause the strong force to act differently between quarks.
Only if you look at the whole picture of the proton, the sea of quarks, antiquarks and gluons will you see that the net effect is that the strong force holds the particles together.
So it is very hard to simply say that two quarks would attract or repel, because the strong interaction is not as simple as the EM. Only when you look at the whole proton in your case can you see that the effect we see in experiments is called confinement.
It is very important to understand the difference between confinement and simple attraction and repulsion. In the case of confinement it is more precise to say that the quarks are bound and if you try to separate them, you will realize how strong the color force is, creating extra pairs of quarks and antiquarks.

Because of this behavior of the gluon field, the strong force between the particles is constant regardless of their separation.[4][5]
  Therefore, as two color charges are separated, at some point it becomes energetically favorable for a new quark–antiquark pair to appear, rather than extending the tube further.

https://en.wikipedia.org/wiki/Color_confinement
I actually asked a question about this.
What keeps quarks separate (strong force pulls, but what repels to equal out)
Now there are special cases, when you can say that certain types of quarks do repel or attract.

Quarks of different color experience an attractive force between them; whereas quarks of a like color repel each other.

https://www.sciencedirect.com/topics/earth-and-planetary-sciences/quark
