Migrate from docker-compose

I have a docker compose-app that I wished to deploy on fly.io. After reading some other posts on community.fly.io, I realized that docker-compose isn’t supported as of now, and I need to ‘convert’ my app to use the fly.toml instead.

My current docker-compose looks something like:

    image: username/myapp
      - ./data/foo:/data
      - /var/run/docker.sock:/var/run/docker.sock
      - ENV_1=<var1>
      - ENV_2=<var2>

The docker-compose file is a relatively simple one. The only place where I found issues was in

      - ./data/foo:/data
      - /var/run/docker.sock:/var/run/docker.sock

What comes to my mind so far is
fly volumes create my_data --size 1 --app my_app

However, I don’t know how to link the volume: section.

I’m aware that fly has a config option like this:

  destination = "/data"
  source = "my_data"

However, this doesn’t help in linking ./data/foo to /data, Instead, it just mounts the my_data volume to /data

What is in ./data/foo? If you want to copy some static data at build time, use a COPY command in the Dockerfile. Otherwise, your [[mounts]] section looks right to me, and you can initialize your data via an ENTRYPOINT shell script, via fly ssh console, or have your app code do it.

It doesn’t contain any static data. Yeah, upon a second glance, the [[mounts]] seems fine. Any idea about /var/run/docker.sock:/var/run/docker.sock ?

What is your app doing with the docker daemon socket? There is most likely some way of doing what it needs on Fly, but it’s not possible to mount that since we don’t run Docker on our hosts.

The app launches another docker container for temporary actions. Its similar to act runner. I think this would be impossible to run in such a scenario, and would need an actual Bare Metal or a VM with docker in docker configured.
Thanks for your time anyways. Have a nice day :slight_smile:

Gotcha. You can either run Docker in your machine (as an example, our remote builders do this), or use the machines API to create/destroy VMs on demand. Hope this helps!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.