docker-compose up -d vs ./scripts/compose up -d

Hi guys,

So starting openBalena seems to give me troubles depending on the method I start openBalena.

If I use docker-compose up -d, then the apps I’ve defined and the devices are present.

If I then run docker-compose down followed by ./scripts/compose up -d, then all the services start, but the devices and defined apps are gone.

If I then run ./scripts/compose down followed by docker-compose up -d, then my apps and devices are back again.

As such, I figure there’s some kind of difference between the definitions of the docker-compose file generated by the scripts/compose and what gets run via the script.

Has anyone come across this before?

1 Like

Had a chat to the guys here - we think we’ve figured out what the problem is…

From the quickstart guide:

$ git clone https://github.com/balena-io/open-balena.git
$ cd open-balena/

This means when using docker-compose up, named volumes would be created as:

local               open-balena_cert-provider
local               open-balena_certs
local               open-balena_db
local               open-balena_redis
local               open-balena_registry
local               open-balena_s3

The scripts/compose script sets the project-name to ‘openbalena’:

source "${VERSIONS_FILE}"; docker-compose \
  --project-name 'openbalena' \
  -f "${BASE_DIR}/compose/services.yml" \
  ${INCLUDE_MDNS} \
  -f "${CONFIG_DIR}/docker-compose.yml" \
  "$@"

This will create the docker volumes:

local               openbalena_cert-provider
local               openbalena_certs
local               openbalena_db
local               openbalena_redis
local               openbalena_registry
local               openbalena_s3

You can see these via docker volume list.

I suggest the real fix should be to change scripts/compose to set the project name to open-balena to match the directory name that the git clone creates.

Hello Steve

Thanks for your suggestion. As you describe, the behavior you are seeing is related to the compose script setting up the docker-compose project to openbalena.

Openbalena is meant to be used with the compose script and not with docker-compose, because apart from starting and stopping the application, it prepares the environment for it to run properly. This also allows us to easily update and maintain the environment since we have everything under our control. So modifying the script to match the directory name really gives no benefit at all because you have to use the script anyway.

Regards,
Tomas