Can't deploy a multi-container app

Hello everyone!
I’m trying to deploy a multi-container app using fly deploy for the first time and stuck immediately.

I’m using the Container Demo as an example for translating the Telegram Bot API + nginx app to a Fly multi-container app. So far I’m encountering this error:

Error: failed to fetch an image or build from source: app does not have a Dockerfile or buildpacks configured. See https ://fly.io/docs/reference/configuration/#the-build-section

Here are my project files:
fly.toml:

app = 'my-app'
primary_region = 'mad'
swap_size_mb = 1024

[[mounts]]
  source = 'telegram_bot_api_data'
  destination = '/var/lib/telegram-bot-api'
  initial_size = '1gb'

[[services]]
  protocol = 'tcp'
  internal_port = 8081
  auto_stop_machines = 'off'
  auto_start_machines = true

  [[services.ports]]
    port = 8081

  [[services.tcp_checks]]
    interval = '10s'
    timeout = '2s'

[[restart]]
  policy = 'always'
  processes = ['app']

[[vm]]
  size = 'shared-cpu-1x'
  memory = '256mb'

compose.yml:

version: "3.8"

services:
  api:
    image: aiogram/telegram-bot-api:latest
    restart: always
    environment:
      TELEGRAM_API_ID: ${TELEGRAM_API_ID}
      TELEGRAM_API_HASH: ${TELEGRAM_API_HASH}
      TELEGRAM_LOCAL: ${TELEGRAM_LOCAL}
    volumes:
      - telegram-bot-api-data:/var/lib/telegram-bot-api
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:8081"]

  nginx:
    image: nginx:1.27.3-alpine
    restart: always
    depends_on:
      api:
        condition: service_healthy
    volumes:
      - telegram-bot-api-data:/var/lib/telegram-bot-api
      - ./nginx:/etc/nginx/conf.d/
    ports:
      - "80:80"

volumes:
  telegram-bot-api-data:

The project’s directory tree:
:file_folder: project/
├─ :file_folder: nginx/
│ └─ :gear: default.conf
├─ :spouting_whale: compose.yml
└─ :balloon: fly.toml

I’m using these commands:
fly launch --no-deploy --ha=false
fly ips allocate-v6 --private
fly secrets import < .env
fly deploy

I guess I should create a Dockerfile. But what contents should I put there?

I’ve tried a Dockerfile with a single line:
FROM aiogram/telegram-bot-api
And renamed compose.yml to docker-compose.yml and added this to fly.toml as well:
[build]
compose.file = "docker-compose.yml"

But when deploying I get these warnings:
Warning: Could not read volume file telegram-bot-api-data: open telegram-bot-api-data: no such file or directory
Warning: Could not read volume file nginx: read nginx: is a directory

And the following output:

WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:

  • 0.0.0.0:8081
    Found these processes inside the machine with open listening sockets:
    PROCESS | ADDRESSES
    -------------------*----------------------------------------
    /.pilot/hallpass | [fdaa:11:82d1:a7b:53e:fb77:274a:2]:22

WARN failed to release lease for machine 32873039b04485 [app]: lease not found


:multiply: Failed: timeout reached waiting for health checks to pass for machine 32873039b04485: failed to get VM 32873039b04485: Get "https ://ap…

Error: timeout reached waiting for health checks to pass for machine 32873039b04485: failed to get VM 32873039b04485: Get “https ://api.machines.dev/v1/apps/my-app/machines/32873039b04485”: net/http: request canceled

Since all of your containers have images, you shouldn’t need a Dockerfile. I’ll take a look at this and report back.

1 Like