Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to upload Docker images to AWS [WIP] #244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

davidjurado
Copy link
Contributor

@davidjurado davidjurado commented Jun 1, 2022

New command for MLCube has been added:

mlcube upload

The idea of this command is to allow users to upload the docker image specified inside the mlcube.yaml file to different registries, at the moment, this PR contains the logic to upload images to ECR (service from AWS).

This command expects to have the following AWS credentials as environment variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION

Another way to provide the credentials is providing an aws_credentials.json file containing the credentials with the following structure:

{
        "access_key_id": "XXXXXXXXXX",
        "secret_access_key": "XXXXXXXXXX",
        "region": "XXXXXXXXXX"
}

Note: this file must be located in the same folder of the mlcube.yaml

How to test this feature?

Install the latest version of the Docker runner:

virtualenv -p python3 env && source ./env/bin/activate

git clone https://github.com/mlcommons/mlcube && cd ./mlcube

git fetch origin pull/244/head:feature/upload_image_to_aws

git checkout feature/upload_image_to_aws

pip install semver spython && pip install ./mlcube

pip install --no-deps --force-reinstall ./runners/mlcube_docker

Then configure the AWS credentials, after that run:

mlcube upload

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2022

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@dfeddema
Copy link
Contributor

You can do this with an open source tool called skopeo. e.g.
aws ecr create-repository --repository-name '{{ NEW REPO NAME }} ' && skopeo copy --format=v2s2 containers-storage:localhost/{{ my-podman-created-image}}:{{ image-tag}} docker://{{ AWS ACCOUNT }}.dkr.ecr.{{ AWS REGION }}.amazonaws.com/{{ NEW REPO NAME }} --dest-creds AWS:$(aws ecr get-login-password --output text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants