- Mastering Docker Enterprise
- Mark Panthofer
- 166字
- 2021-07-02 12:30:16
Using PowerShell with the Docker API to get the CLI bundle
If you would rather connect to your EE cluster with a standard Windows PowerShell, use the following commands. Again, be sure to replace the <username>, <password>, and <ucp-ip> with the IP or DNS of your Docker PoC IP:
PS> $AUTHTOKEN=((Invoke-WebRequest -Body '{"username":"<username>", "password":"<password>"}' -Uri https://<ucp-ip>/auth/login -Method POST).Content)|ConvertFrom-Json|select auth_token -ExpandProperty auth_token
PS> [io.file]::WriteAllBytes("ucp-bundle.zip", ((Invoke-WebRequest -Uri https://<ucp-ip>/api/clientbundle -Headers @{"Authorization"="Bearer $AUTHTOKEN"}).Content))
PS> Expand-Archive -Path ucp-bundle.zip -DestinationPath .
PS> Import-Module .\env.ps1
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\Users\Administrator\PoC CLI\env.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): R
PS> docker node ls
... listing of your Docker Enterprise nodes
Visit the Docker docs here for more information on the command-line bundle: https://docs.docker.com/ee/ucp/user-access/cli/.