There are 2 ways to link the image with the gallery post:
1) upload the new image:
You need to upload the images from your computer (In other words, the images of gallery post must be uploaded to this post). For gallery post, you need not insert the images to post content.
2) use the images existed in media library:
You could Attach/Detach the image with post in Media/Library :
Tip: one image can attach only one post