Docker Community Forums

Share and learn in the Docker community.

Run tests on a specific node

(Paulskinnerac) #1

Hey guys,

I can’t see a way to run my tests on specific nodes. Something like the tags system would be great. I just want to make sure my builds are not happening on production nodes.

It seems my tests might not even be running on my nodes. The test results seem to be running on servers that docker cloud says are overseas.

(Allan Sun) #2

I guess this really depends on how you run your tests…

Since you are posting here I assume you ‘Deploy’ your docker image on DockerCloud ‘nodes’. By using ‘NodeCluster’ you define ‘tags’ when creating the cluster, each ‘node’ under such cluster will inherit those tags on creation.

When deploying you ‘stack’, each ‘service’ would allow to have ‘tags’ to match your nodes. Let’s save you create a NodeCluster with tags ‘test’ and ‘app’, and have a Docker service with tag ‘test’, it can be run on any node with ‘test’ tag on it.

The screenshot below is how we use such mechanism. We have Jenkins server to build the Docker image, pushed to, and then control DockerCloud to deploy on the servers with matching tags. Do not be confused with DockerCloud’s tags with Docker image’s tag. They are different thing.

FYI, please read:

(Paulskinnerac) #3

@allansun I am a bit confused. We have setup tags for in our stack files and on the nodes.

I am trying to build a docker container that is used on production and staging. But I only want it to build on the staging box. I only want the tests to run on the staging box.

I ideally want to give my staging box an additional tag called “build_box” and the specify that only nodes with that tag are used to do builds.

(Lizter) #4

If you tag a node with builder Docker Cloud will automatically redirect all the builds to this node given that you have “build on own infrastructure” enabled.

(Paulskinnerac) #5

Great! Will try that out.