docker_registry {AzureContainers}R Documentation

Create a new Docker registry object

Description

Create a new Docker registry object

Usage

docker_registry(server, tenant = "common", username = NULL,
  password = NULL, app = .az_cli_app_id, ..., domain = "azurecr.io",
  token = NULL, login = TRUE)

Arguments

server

The registry server. This can be a URL ("https://myregistry.azurecr.io") or a domain name label ("myregistry"); if the latter, the value of the domain argument is appended to obtain the full hostname.

tenant, username, password, app, ...

Authentication arguments to AzureAuth::get_azure_token. See 'Details' below.

domain

The default domain for the registry server.

token

An OAuth token, of class AzureAuth::AzureToken. If supplied, the authentication details for the registry will be inferred from this.

login

Whether to perform a local login (requires that you have Docker installed). This is necessary if you want to push or pull images.

Details

There are two ways to authenticate with an Azure Docker registry: via Azure Active Directory (AAD), or with a username and password. The latter is simpler, while the former is more complex but also more flexible and secure.

The default method of authenticating is via AAD. Without any arguments, docker_registry will authenticate using the AAD credentials of the currently logged-in user. You can change this by supplying the appropriate arguments to docker_registry, which will be passed to AzureAuth::get_azure_token; alternatively, you can provide an existing token object.

To authenticate via the admin user account, set app=NULL and supply the admin username and password in the corresponding arguments. Note that for this to work, the registry must have been created with the admin account enabled.

Authenticating with a service principal can be done either indirectly via AAD, or via a username and password. See the examples below. The latter method is recommended, as it is both faster and allows easier interoperability with AKS and ACI.

Value

An R6 object of class DockerRegistry.

See Also

DockerRegistry for methods available for interacting with the registry, call_docker

kubernetes_cluster for the corresponding function to create a Kubernetes cluster object

Examples

## Not run: 

# 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)


## End(Not run)

[Package AzureContainers version 1.3.2 Index]