Suppose you have a private repository on the Docker Hub, then how do you get Marathon to pull from that repository? It's easy if you use Marathon's Artifact Store!
Here's how:
Log on to the machine where Marathon is running, and create a place to store the files:
mkdir /etc/marathon/store
Specify the path in the Marathon configuration:
echo "file:///etc/marathon/store" > /etc/marathon/conf/artifact_store
And restart Marathon:
/etc/init.d/marathon restart
Then, log in to the Docker Hub on your local console. You might want to create a special account on the Hub just for pulling images.
docker login
Your credentials will be stored in ~/.dockercfg. The next step is to get this file into the Artifact Store. You can either scp it or use curl:
curl -F "name=file" -F "filename=.dockercfg" -F "file=@.dockercfg" http://marathon-ip:8080/v2/artifacts
To check if it's really there:
curl http://marathon-ip:8080/v2/artifacts/.dockercfg
The last step is to specify the URI in the .json for the application you want to deploy:
"uris": [
"http://marathon-ip:8080/v2/artifacts/.dockercfg"
]
Then, if you post your json to Marathon, the Mesos slave will first fetch the .dockercfg and then pull the image from the repository.