Files
myos/skills/myos/references/commands.md
T
Yann Autissier 3e55cdcd14 chain commands, and let a project refine a catalogue stack
myos build up logs host/fabio runs the three in order and stops at the first
failure, the way make build up logs STACK=host/fabio did. Leading words that
name commands are commands; the first word that is not one starts the stacks.

A stack found in several directories of the stack path is now merged rather
than shadowed, least specific first, so a project drops
stack/postgres/postgres.local.yml next to the catalogue's postgres.yml and
refines it. Settings hooks follow the same order, so a project can redefine a
default the catalogue ships. Neither engine did this before: the project
directory simply hid the catalogue one.

An unknown command now says so and suggests the command to type, instead of
printing the whole usage.
2026-09-03 21:17:17 +02:00

3.0 KiB

Commands

myos [options] <command> [stack...] [VAR=value...] [-- args...]
option effect
-C DIR work in DIR instead of the current directory
-e ENV environment: picks .env.<env> and the <stack>.<env>.yml overlays
-n, --dry-run print the commands instead of running them
-v, --verbose say what myos is doing
-d, --debug print every command
command effect
up create and start; creates the external networks first
down remove the containers
start / stop / restart on the existing containers
ps what is running
logs follow the logs
config the resolved compose file
exec run a command in a running service
run run it in a new container, removed afterwards
scale myos scale <stack> SERVICE=<name> NUM=<n>
build / pull images
ls [--groups] the stacks and groups myos can see
env [VAR...] resolved variables
env-update fill the .env from the .env.dist templates
doctor check the installation
version the myos version

Several commands at once

Commands chain, the way make targets did. Leading words that name commands are commands; the first word that is not one starts the list of stacks.

myos build up logs host/fabio        # like: make build up logs STACK=host/fabio
myos up ps host

They run in order and stop at the first failure. A stack whose name is also a command name has to be given as STACK=<name>, otherwise it is read as a command.

Anything after -- goes to docker compose:

myos logs host/fabio -- --tail 20
myos up postgres -- --force-recreate

exec and run take the service from the stack name, since most stacks name their main service after themselves. SERVICE= picks another one:

myos exec host/consul -- consul members        # service consul, command "consul members"
myos exec host/fabio SERVICE=fabio -- sh
myos run postgres -- psql -l

Exit codes

code meaning
0 fine
1 the command failed
2 bad invocation, or an unknown command
3 stack not found (the message prints the search path)
4 missing requirement, run myos doctor

The make engine exited 0 on an unknown target, printing only a warning. The CLI does not: a typo is an error.

Coming from the make targets

make myos
make up STACK=host myos up host
make print-COMPOSE_FILE myos env COMPOSE_FILE
make host myos up host (a bare stack name is not a command)
make build up logs STACK=host/fabio myos build up logs host/fabio
make stack-host-config myos config host
make up@master myos -e master up
make exec SERVICE=php ARGS='ls' myos exec <stack> -- php ls
make DRYRUN=true up myos -n up

print-VAR, stack-<stack>-<command> and <command>@<env> still work. A project Makefile that includes make/include.mk keeps working too.