if (FALSE) {
# connect to the Docker registry 'myregistry.azurecr.io', authenticating as the current user
docker_registry("myregistry")
# same, but providing a full URL
docker_registry("https://myregistry.azurecr.io")
# authenticating via the admin account
docker_registry("myregistry", username="admin", password="password", app=NULL)
# authenticating with a service principal, method 1: recommended
docker_registry("myregistry", username="app_id", password="client_creds", app=NULL)
# authenticating with a service principal, method 2
docker_registry("myregistry", app="app_id", password="client_creds")
# authenticating from a managed service identity (MSI)
token <- AzureAuth::get_managed_token("https://management.azure.com/")
docker_registry("myregistry", token=token)
# you can also interact with a registry outside Azure
# note that some registry methods, and AAD authentication, may not work in this case
docker_registry("https://hub.docker.com", username="mydockerid", password="password", app=NULL)
}
Run the code above in your browser using DataLab