Can I run a Docker container to use in another Google Cloud Build step?

  docker, google-cloud-build, mysql, rspec, ruby-on-rails

I’d like to run a fresh MySQL instance in a Docker Container as a Cloud Build, and then access that MySQL DB in a later step to run Unit Tests against. Is this possible? It appears as if I can run a Docker Container in a build step, but the step doesn’t complete until the Container exists. I’d like this MySQL container to remain running until after the final build step completes.

FWIW I’d like to use this on a Ruby on Rails project to run rspec tests. I currently use a CloudSQL instance to run tests against, but it’s pretty slow, even though the same tests run quickly locally. Changing the machine-type for the Cloud Builder to something powerful didn’t help, so I assume latency is my biggest killer, which is why I want to try a peer Container MySQL instance instead.

Source: Docker Questions