I think I know what’s wrong.
docker service create
does not seem to create a custom network by default (docker stack deployments do). Custom networks provide a buildin dns server, which is used by containers to lookup other containers by their servicename or alias. Your problem is that /etc/hosts did not contain the container’s random hostname, nor was the container able to resolve the name via (the custom networks) dns.
This works for me:
docker network create --driver overlay cassandra_net # this only needs to be created once
docker service create --name cassandra_build2 --network=cassandra_net -p target=9042 -d cassandra:3.11.6