Can you describe in more detail what you want to accomplish in this situation?
Even if linking as you described is possible it is highly risky solution. Keep in mind that docker’s orchestration can restart tasks at almost any time rendering your link inoperable. Without knowing more details I can only suggest creating two services and attaching them to their dedicated overlay network:
docker network create -d overlay my_overlay
docker service create --name appdomain --network my_overlay --publish 8001:8001 jboss
docker servise create --name newservice --network my_overlay --publish 8080:8080
In this example both services will be able to communicate with each other by the service name (equivalent of --link) no matter where docker decides to run their underlying tasks.
Also if port 8001 on appdomain is only needed to communicate with the other container I would skip publishing it - within overlay network all ports are available to other containers and no publishing is needed.