BatchAI icon indicating copy to clipboard operation
BatchAI copied to clipboard

Custom Container Registry using Fluent Java SDK

Open ChristianSauer opened this issue 6 years ago • 5 comments

Hello, I need to use a custom container image from a Registry with UserName / Password. Can I use that Image somehow? I did see .WithContainerImage(""), but that has no applicable overload.

Furthermore, I am running a fully self contained image, with does not need anything (except a GPU and the necessary nvida libs), is there a way to run that?

Thanks!

ChristianSauer avatar Jun 29 '18 09:06 ChristianSauer

Hi, you should be able to use any registry as Batch AI provide API to take registry url, image name and login credentials. In java you should be able to call .withImageSourceRegistry(ImageSourceRegistry imageSourceRegistry)

You can find examples to use nvidia-dgx-container-registry and azure-container-registry for your reference.

llidev avatar Jun 29 '18 22:06 llidev

@lliimsft THanks! I am using C# and for the life of me, I cannot find where I would have to call this method.

ChristianSauer avatar Jun 30 '18 04:06 ChristianSauer

@ChristianSauer Please find ContainerSetting in .Net https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.batchai.models.containersettings?view=azure-dotnet

I don't have a fluent example on my hand, but for non-fluent C# library, you can do the following to specify private registry info:

var jobCreateParams = new JobCreateParameters()
{
    ....
    Cluster = new ResourceId(cluster.Id),
    NodeCount = 1,
    ContainerSettings = new ContainerSettings()
    {
        ImageSourceRegistry = new ImageSourceRegistry()
        {
            Image = "",
            ServerUrl = "",
            Credentials = new PrivateRegistryCredentials()
            {
                Username = "",
                Password = ""
            }
        }
    },
    ...
};

client.Jobs.Create(rgName, workspaceName, expName, jobName, jobCreateParams);

Regarding to your second question on self contained image, I am sorry that currently Batch AI doesn't support to run bare container command and user has to specify a toolkit, python script and command line args for jobs.

llidev avatar Jun 30 '18 05:06 llidev

@lliimsft, I believe the question is about Azure/azure-libraries-for-net ("fluent" sdk). from a quick glance it seems "fluent" doesn't expose functionality for specifying repository settings (cannot verify without c#). java fluent provides this functionality.

AlexanderYukhanov avatar Jul 04 '18 21:07 AlexanderYukhanov

@AlexanderYukhanov You are correct, the Fluent SDK does not support this.

ChristianSauer avatar Jul 12 '18 13:07 ChristianSauer