Set admin password at docker run

Is it possible to set the initial admin password via an env variable perhaps when Rancher 2.0 is started via the docker run command?

If not, is hitting https://<IP>/v3/users?action=changepassword the proper endpoint to target to set it up?

1 Like

No, that leaves the password lying around in the container definition forever.

changepassword changes the authenticated user’s pw and requires knowing the current one. There’s also a setpassword on individual users which an admin can call to set the pw for any user to something new (without knowing the old one).

Since on setup admin is going to be the only user, either will work.

You probably want something like this: https://gist.githubusercontent.com/superseb/c363247c879e96c982495daea1125276/raw/98d9c0590992f2b7e209ae4e0a7da7da1db5aee0/rancher2customnodecmd.sh