- Mastering Docker Enterprise
- Mark Panthofer
- 151字
- 2025-04-04 14:48:22
Using Bash with Docker API to get the CLI bundle
Refer to the following steps:
- Before you start the process of downloading the command-line bundle through the API, make sure that you have the curl, jq (a lightweight formatter for JSON payloads), and unzip utilities installed:
sudo apt-get update && sudo apt-get install curl jq unzip
- Now, get the bearer token and call the API to retrieve the CLI files. Be sure to replace <ucp-ip> with the IP or DNS of your Docker PoC IP:
# Stash your Bearer token in an environment variable AUTHTOKEN=$(curl -sk -d '{"username":"<username>","password":"<password>"}' https://<ucp-ip>/auth/login | jq -r .auth_token) # Download the client certificate bundle curl -k -H "Authorization: Bearer $AUTHTOKEN" https://<ucp-ip>/api/clientbundle -o bundle.zip # Unzip the bundle. unzip bundle.zip # Run the utility script. eval "$(<env.sh)"
# You are connected to the cluster - test it.
docker node ls
... listing of your Docker Enterprise nodes