Can't add machins from the same image

I create two servers with the same image in aliyun. When I register these two servers to the rancher server use the script as follows: sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://:2345/v1/scripts/::****

There is only one machine can be added to the rancher server, the other one can’t display.
If I run the script with the order A, B, the B can display, if the order is B, A, the A can display. How to resolve it?

Create the image before running the agent, or rm -rf /var/lib/rancher/state and docker volume rm rancher-agent-state. They contain a uuid that needs to be unique, if the image includes it then all machines made from it are “the same” host.

1 Like

With your solution, I can add the two servers now.
Thank you very much.