How identify duplicate containers during execution


I would like to create an image and distribute to a bunch of customers. However, the customer should be able to run only one container by image to avoid run the service multiple times by free.

My intention is distribute the image by cloud and the customers could pull as well and by their docker client. Once the container is created, it should be able to identify if there is another container from same image running.

I found a solution by mounting /var/run/docker.sock and running docker client from host. This solution works, but is ugly.

Another thought is create some unique key by machine and the container check if there are more containers running over this key.

Is there someone with the same problem or with some idea how to provide this solution?