Jenkins -> Access Remote Docker Daemon


I have a Linux server running Jenkins. In Jenkins virtual machines are registered as agents.

The goal is that I start a job from Jenkins and it runs on the local Docker instance on the VM.

My question would be what is the best approach to do this? Would Docker Swarm be an option for this? If so, would I be better off registering the containers on the VM as nodes in Jenkins? I am currently a bit confused.

I know that by default it tries to access the Docker instance on the host system. But it is supposed to access the instance on the VM as I said.

Thanks in advance