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.
Choosing the public service
Only one service receives web traffic from your domain. Cito picks it as follows:- If exactly one service has
ports:, that service is used. - If several services have
ports:, Cito prefers the one listening on 80, then 443, 3000, 8080, 8000, 5000, 4000 and 9000, in that order. - If no service has
ports:, a single service withexpose:is used, or the only service in the file.
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
apppublishes a port, so it becomes the primary service and is renamedweb. It listens on port 3000 and starts afterdbandcache.dbandcachebecome secondary services, reachable fromwebasdb:5432andcache:6379.- The
pgdatanamed volume becomesdata/pgdatain 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.cachehas noexpose:, but Cito recognises theredisimage and uses port 6379. It also warns that Redis keeps its data in/dataand suggests adding a volume for it.
