fly machine API entrypoint config

Is it possible to pass the docker entrypoint configuration string with the fly machines API?

I attempted to include it under either config or config.init and get a 400 Bad Request response. (Using the equivalent entrypoint config worked for me when using the CLI’s --entrypoint parameter)

curl -i -X POST \
-H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \
"http://${FLY_API_HOSTNAME}/v1/apps/APP/machines" \
-d '{
  "name": "TEST_NAME",
  "region": "ewr",
  "config": {
    "image": "",
    # Tried:
    "entrypoint": " SOME PARAMS",
    # Also tried:
    "init": {"entrypoint": " SOME PARAMS"}

Per fly machine docs (which may be incorrect), you cannot override entrypoint and cmd via config (at deploy-time). You’d have to define those in your dockerfile (at build-time).

config : An object defining the machine configuration.


  • image : The Docker image to run
  • guest : An object with the following options:
  • cpus : Number of vCPUs (default 1)
  • memory_mb : Memory in megabytes as multiples of 256 (default 256)
  • env : An object filled with key/value pairs to be set as environment variables
  • services : An array of objects that define a single network service. Check the machines networking section for more information.
  • protocol : tcp or udp.
  • internal_port : Port the machine VM listens on
  • ports : An array of objects defining the service’s ports and associated handlers. Options:
    • port : Public-facing port number
    • handlers : Array of connection handlers for TCP-based services.

Thanks, I did notice it was not in the docs but figured I’d ask just in case it was unintentionally missing or planned since (1) the POST /machines API’s 200 machine creation response includes an init section with an empty entrypoint property and (2) the CLI supports the entrypoint approach nicely well. I’d just use the CLI but there’s a separate issue in the context I’m trying to make this work from (essentially an API running a read-only bash context - works for starting the proxy but not running machine commands)

Purpose-wise, I’m attempting to use entrypoint/CLI arguments in place of env vars for configuration of the running binary - I could instead adapt the Dockerfile to make those bits configurable with env vars instead, just adds a bit of a delta between running on machines and our existing provider so raises the bar to continue experimenting with it with our existing workflow a bit.


Currently I’m trying to setup a provider for Coder with Terraform and Fly Machines, and ideally I would allow users to run custom Docker images from Docker Hub. However, I wish to run some custom code (such as installing an agent, code-server, or similar). It would be great if Fly supported entrypoints or some other way of customization, but is there a way around this?

The Terraform provider doesn’t support this yet, but you can customize entrypoints and the command via the init property in the Machines API. We’ll look at getting support into the provider. @DAlperin


Ooh interesting - to clarify, does this mean the config.init.entrypoint override now works via the API?

Yes, both cmd and entrypoint should work.


@kot this feature is now part of the latest terraform provider update Announcement: big terraform provider update v0.0.12