Docker#

To pull from private Docker registries, use the docker secret:

mcli create secret docker

To create this secret, you’ll need the server address, your username, and your registry access token. The default server is DockerHub (https://index.docker.io/v1/), but we support custom docker registries.

Use API access tokens instead of passwords

We strongly recommend using API tokens to authenticate. For DockerHub, create an access token here.

Instead of using the interactive prompt above, all the settings can also be provided as flags in one command:

mcli create secret docker --username my-user --password my-registry-key --server https://custom-registry.com

Testing your Credentials#

To test your docker credentials, place the private image name into the following run configuration:

name: hello-world
compute:
  gpus: 0
image: <my-private-image>
command: |
  sleep 2
  echo Hello World!
mcli run -f hello-world.yaml

If all goes well, you should see:

> mcli run -f hello-world.yaml

i  Run hello-world-po9z submitted. Waiting for it to start...
i  You can press Ctrl+C to quit and follow your run manually.
✔  Run hello-world started
i  Following run logs. Press Ctrl+C to quit.

Hello World!

If, however, your secret has not been set up properly you’ll see:

> mcli run -f hello-world.yaml

------------------------------------------------------
Let's run this run
------------------------------------------------------

i  Run hello-world-61lx submitted. Waiting for it to start...
i  You can press Ctrl+C to quit and follow your run manually.
✗  Run hello-world-61lx failed to start and will be deleted because it could still be consuming resources.
    Could not find Docker image "<my-private-image>". If this is a private image, check `mcli get secret --type docker_registry` to ensure that you have the Docker secret created. If not, create one using `mcli create secret docker`. Otherwise, double-check your image name.

When starting runs, the image can also be overridden at the command line:

mcli run -f hello-world.yaml --image <new-image>