Getting started with packages in DC/OS

All articles
By Yuri Gubin
Chief Innovation Officer, DataArt
Getting started with packages in DC/OS

Why would one create a package?

Once you get familiar with DC/OS, the open source project that was created by Mesosphere you get access to packages certified by Mesosphere. There are several ways to deploy your service into DC/OS: (1) use dcos marathon command in CLI; (2) use Marathon REST API directly; (3) deploy your service as a package. Using package approach makes your solution consistent with the environment and gives other benefits.

Seel also: On-demand Interactive Data Science with DC/OS.

Please refer to documentation regarding developing your custom services and packages

The aim of this post is to show how to create your own simple package and start using it in your DC/OS managed cluster.


You need to have DC/OS cluster up and running and DC/OS CLI installed. You can find instructions how to do this here

Redis as a Package

As an example here I will create a package for vanilla Redis. It is a standalone instance that can be used by your solution. Note that there is Redis framework already in the list of DC/OS packages. While being extremely powerful this framework is not required for every solution. Sometimes all we need is a simple and lightweight service running as container.

The service you want to create a package for should have a Docker image already. For this example there is an image called redis:3.0.7.

Download this image and get it’s id

docker pull redis:3.0.7
docker images redis

Getting started

First thing to do is to take a look at the universe repo and create a fork. Create a branch in your fork and name it topic/single-redis.

Find repo/packages/R folder and create redis folder inside. Create 0 folder in that repo/packages/R/redis folder. Create empty config.json, marathon.json.mustache, package.json and resource.json files.

You should have the following tree:

tree repo/packages/R/
├── redis
│   └── 0
│       ├── config.json
│       ├── marathon.json.mustache
│       ├── package.json
│       └── resource.json
└── riak
    └── 0
        ├── command.json
        ├── config.json
        ├── marathon.json.mustache
        ├── package.json
        └── resource.json

Define your package.

Now it is time to actually define your package. Here are these four files we created before: config.json
  "type" :  "object" 
  "id" :  "redis" ,
  "instances" :  1 ,
  "cpus" :  0.1 ,
  "mem" :  300 ,
  "container" : {
    "type" :  "DOCKER" ,
    "docker" : {
      "image" :  "{{resource.assets.container.docker.8d81cd6f6c5e}}" ,
      "network" :  "BRIDGE" ,
      "portMappings" : [
        "containerPort" :  6379 ,
        "servicePort"  :  0 ,
        "hostPort" :  0 ,
        "protocol" :  "tcp" 
  "healthChecks" : [
    "protocol" :  "TCP" ,
    "gracePeriodSeconds" :  60 ,
    "intervalSeconds" :  5 ,
    "portIndex" :  0 ,
    "timeoutSeconds" :  5 ,
    "maxConsecutiveFailures" :  3 
  "packagingVersion" :  "2.0" ,
  "name" :  "redis" ,
  "version" :  "0.0.1" ,
  "scm" :  "" ,
  "maintainer" :  "" ,
  "description" :  "Just Redis" ,
  "framework" :  false ,
  "tags" : [ "mesosphere" ,  "service" ,  "redis" ],
  "licenses" : [
      "name" :  "BSD" ,
      "url" :  "" 
  "website" :  "" ,
  "postInstallNotes" :  "Redis installed!" ,
  "preInstallNotes" :  "Read this message before installing please" ,
  "postUninstallNotes" :  "Thank you for using Redis" 
  "images" : {
    "icon-small" :  "" ,
    "icon-medium" :  "" ,
    "icon-large" :  "" ,
    "screenshots" : [
  "assets" : {
    "container" : {
      "docker" : {
        "8d81cd6f6c5e" :  "redis:3.0.7" 
Before committing files make sure you enabled pre commit hooks as described here

When it is done please try to commit your package. This will lead to changes in repo/meta/index.json so you need to add it and commit your package with this json file. Push your changes to the remote.

Start using your package

Having your package published you need to add it to your DC/OS.

Use this command:

dcos package repo add Redis-Development<username>/universe/archive/topic/

Make sure you can download this zip archive (basically the content of branch from your fork).

Now you can just run dcos package install redis. It will ask confirmation and print messages that we configured. After that your redis instance will appear in Marathon and be ready to work.


As you’ve seen in this post DC/OS makes work with containers easier and you can start running your service at scale in minutes.

Sign Up for Updates!

Subscribe now to receive industry-related articles and updates

Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
Sign Up for Updates!
Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
We are glad you found us
Please explore our services and find out how we can support your business goals.
Get in Touch
Download the white paper Glancing Forward into 2021: An Industry by Industry Outlook

Explore digital trends and unanticipated benefits engendered by the pandemic, which are likely to last in 2021.