Yes, correct. A machine is a virtual machine, as would be run by VMWare or VirtualBox on your computer. CircleCI offers a limited number of parent images, and it is thus not as flexible as CircleCI’s Docker system, which can run any parent image you like.
So the first thing you need to do is to swap “docker” to “machine”. Then you need to choose an image (or, I think, leave it on the default Ubuntu image, by not specifying one). This is a generic VM, so you would need to install your other things manually: Ruby, browsers, Postgres, Elasticsearch. You would also need to start them manually, in a non-Docker context.
I think this is the route you should take.
For completeness, an alternative option is to install Docker Compose, and spin up each of these things (Ruby, browsers, Postgres, Elasticsearch) in Docker. However that requires some familiarity with Docker, which can be fiddly if you do not have prior experience with it.
(One thing you can do, whichever way you go, is to get a CI expert into your organisation for a day or two, either on-site or remotely, if budgets allow. It may seem an expensive option, but it can often be cheaper than spending weeks of your own time on it. Just a thought.)