Use database docker containers with machine build

I have a build that uses Localstack, and given the issues of running a Docker container inside of a Docker build, I’d like to switch to a machine configuration instead. However, the database Docker images are nice and easy to configure, so I’d like to keep using the provided database image alongside a machine build. Is this allowed?