microsoftarchive / BatchAI

Repo for publishing code Samples and CLI samples for BatchAI service
MIT License
125 stars 62 forks source link

Custom Container Registry using Fluent Java SDK #50

Open ChristianSauer opened 6 years ago

ChristianSauer commented 6 years ago

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!

llidev commented 6 years ago

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.

ChristianSauer commented 6 years ago

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

llidev commented 6 years ago

@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.

AlexanderYukhanov commented 6 years ago

@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.

ChristianSauer commented 6 years ago

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