Here’s an example of how the clove hitch is used to tie a fender to a boat’s rail. A clove hitch can also be used to tie a dock line around a post.
Remember that this is a temporary knot. For a secure knot that will hold in all circumstances, make a loop instead with a bowline.
Check out other basic sailing knots.