Containers are in beta. Contact support to enable them for your server.
If you already describe your application in a docker-compose.yml file, you can import it when creating a container site. Cito reads the file, fills in the images, ports, environment variables, volumes and services, and shows you what it changed. Import is a one-off step in the Create Site wizard. Nothing is created until you review the form and click Create Site, and Cito doesn’t keep a copy of the file.

Importing a file

In the Create Site wizard, select the Docker Container profile, then expand Import from docker-compose. Click Choose compose file to upload a .yml or .yaml file, or paste its contents into the box. The file is checked as you type:
  • Problems that prevent the import are listed under Fix these in the file before importing.
  • Changes Cito made to fit the file onto a container site are listed under Imported with these changes.
When there are no errors, click Apply to form. The primary service’s settings and the Services list are replaced with the imported values. Review them, enter any registry credentials and fill in any environment variables that were left blank, then create the site.

Choosing the public service

Only one service receives web traffic from your domain. Cito picks it as follows:
  1. If exactly one service has ports:, that service is used.
  2. If several services have ports:, Cito prefers the one listening on 80, then 443, 3000, 8080, 8000, 5000, 4000 and 9000, in that order.
  3. If no service has ports:, a single service with expose: is used, or the only service in the file.
The chosen service is renamed web. If other services refer to it by its old name, for example in an environment variable such as APP_URL=http://app:3000, you’ll be warned to change those references to web. Published ports on other services are dropped, because secondary services can only be reached from inside the site. If no service publishes a port, the import stops with “No service publishes a port”.

How keys are mapped

Service names are lower-cased and underscores are replaced with hyphens, so my_worker becomes my-worker.
A named volume starts empty. Compose copies the image’s files into a new named volume. Cito doesn’t, so if your image ships files at that path that it expects to find, use a bind mount to a folder you populate yourself.

Unsupported keys

The following keys stop the import, because container sites don’t allow them: privileged, cap_add, devices, network_mode, pid, ipc, sysctls, security_opt, volumes_from, cgroup_parent, userns_mode The following keys are ignored with a warning: Unrecognised keys are ignored with a warning. Extension keys starting with x- are ignored silently.

Absolute paths

Volumes must live inside your site’s home directory. Absolute host paths such as /srv/data or ~/data, paths containing .., and mounting the whole home directory (.) are rejected. Use a relative folder such as ./data instead.

Example

This file defines an application, a Postgres database and a Redis cache:
docker-compose.yml
On import:
  • app publishes a port, so it becomes the primary service and is renamed web. It listens on port 3000 and starts after db and cache.
  • db and cache become secondary services, reachable from web as db:5432 and cache:6379.
  • The pgdata named volume becomes data/pgdata in your site’s home directory.
  • ${DB_PASSWORD} has no value, so it’s replaced with an empty string and you’re warned about it. The simplest fix is to put the password in the file, or use ${DB_PASSWORD:-yourpassword}, before importing it.
  • cache has no expose:, but Cito recognises the redis image and uses port 6379. It also warns that Redis keeps its data in /data and suggests adding a volume for it.