Importing Docker-compose Descriptors into Skopos™

If you have an application that was deployed with docker-compose or Docker Swarm stack, it can be used as-is with Skopos, instead of creating a native Skopos model description, provided that the docker-compose file uses only the supported subset of features described below. It is also possible to add Skopos- specific metadata to the file while keeping it compatible with docker-compose.

In addition, Docker Swarm's docker stack deploy command supports docker-compose format version 3 which is also supported by Skopos.

For the docker-compose file to work with Skopos, it should:

  • be a version 2, 2.1 or 3 docker-compose file
  • not have references to included files or substitution variables. If your compose file has those, use 'docker-compose config' to perform all the substitions and file imports and produce a single self-contained compose file.

Skopos reads only the 'components' part of the compose file and only the following component attributes will be read and understood by Skopos. If your file has others, they will be ignored and may cause the application to run not as intended:

  • image
  • volumes
  • target_num_containers (a Docker Cloud extension)
  • replicas (in a deployment section of a version 3 format file)
  • depends_on
  • ports
  • expose
  • labels (NOTE: labels beginning with the string com.datagridsys.skopos. are Skopos metadata; see next section).

Skopos Metadata

If the compose file contains specially recognized labels (all starting with com.datagridsys.skopos.), they are converted to component attributes in the native Skopos model that have no equivalent in the compose file format:

Label Skopos Model attribute(s)
com.datagridsys.skopos.visual.positiona string in the form "X,Y", converted to the equivalent Skopos model structure: "visual" : { "x" : X, "y" : Y }
com.datagridsys.skopos.replicasNumber of replicas
com.datagridsys.skopos.singletonWhether the component is a singleton (stateful, single instance). Useful to instruct Skopos that at most one instance can be running at any given time, e.g., due to use of host-mapped port or a writeable volume
com.datagridsys.skopos.lb.namethis, and the following items create an entry in the 'gateways' section of the Skopos model, which is connected to the component tagged with these labels.
com.datagridsys.skopos.lb.typeType of load balancer to use, should be `load_balancer`
com.datagridsys.skopos.lb.positiona string in the form "X,Y", converted to the equivalent Skopos model structure: "visual" : { "x" : X, "y" : Y }

Host Port Mapping

If any services in the docker-compose file have their port(s) mapped to host ports, Skopos will automatically create host_port gateways for them and position them to the left of the service's icon in the model.