While using ssh-copy-id command sometimes you should be getting an error
/usr/bin/ssh-copy-id: ERROR: No identities found
This is because either you the id_rsa.pub didnt got created in the path /home/USERID/.ssh/ or incorrect permission. Delete the .ssh directory and try recreating it again.
But if everything looks good and still you are seeing this error. Then the best way to find that out is
Issue command, in my case the script is residing in /usr/bin/ssh-copy-id
which ssh-copy-id more /usr/bin/ssh-copy-id
Find out what the variable ID_FILE is referring to. It will be sometimes referred as identity.pub instead of id_rsa.pub. Then please change your script to call identity.pub. The other option is before issuing ssh-copy-id command, Copy identity.pub to id_rsa.pub then run ssh-copy-id. This should fix the issue.
cp -p identity.pub id_rsa.pub ssh-copy-id <SOMEID>@<TARGET_SERVER>
This is one of the best working solution you can find on the internet.