v1

Run /

Override command or entrypoint

Your deployments will specify either a command (CMD) or an entrypoint (ENTRYPOINT) instruction to identify the executable to run in your built image. Commands or entrypoints will be defined either in your Dockerfile, generated by the buildpack, or defined by a Procfile (for buildpack builds).

You can override the default command or entrypoint at runtime from the CMD override page in a combined or deployment service, or a job, or set the override when creating a service or job.

If your Dockerfile defines an ENTRYPOINT instruction, the entrypoint instruction and parameters will be processed first, then any CMD instruction and parameters. The executed command in this case is a concatenation of the entrypoint and command instructions: [...(entrypoint ?? []), ...(cmd ?? [])].

Override command

You can override the default command from the CMD override page in your job or service by selecting edit CMD, or select set CMD override from the deployment overview.

Enter the new command, check use override is enabled, and save to restart your containers with the new command.

To use the default command, open the command override editor dialog again, uncheck use override, and save and restart.

Overriding the command in an individual service or job allows you to run a built image without updating the Dockerfile or re-building it, or affecting any other deployments of the image.

CMD override format

The Docker CMD instruction is run in exec form on Northflank, where the executable and parameters are given as elements in an array:

CMD ["executable", "parameter1", "parameter2"]

To enter your command, type it into the CMD Override field and it will be automatically formatted. You must include an executable as the first argument in the command. You can check how your command has been parsed before continuing.

As Northflank uses the exec form by default, you must explicitly invoke a shell (e.g. /bin/sh -c) if you want to execute a shell command for a Docker image.

CommandParsed commandEffect
/bin/sh -c /start.shCMD ["/bin/sh", "-c", "/start.sh"]Executes a shell to run start.sh
node server/index.js mode=testCMD ["node", "server/index.js", "mode=test"]Runs server/index.js in Node with the parameter mode=test.

Override entrypoint

You can override the default entrypoint from the CMD override page in your job or service by expanding the entrypoint section and selecting edit entrypoint.

Enter the new entrypoint, check use override is enabled, and save to restart your containers with the new entrypoint.

To use the default entrypoint, open the entrypoint override editor dialog again, uncheck use override, and save and restart.

Overriding the entrypoint in an individual service or job allows you to run a built image without updating the Dockerfile or re-building it, or affecting any other deployments of the image.

Buildpack processes

The buildpack builder will attempt to identify all processes and their associated commands in your repository, and will define them in the built image, with the web process as default. You can check a default process has been set in the build logs.

You can also manually define processes and their commands in a Procfile .

If you want to run a non-default process you can specify this process using the entrypoint override.

If your built image does not define a default process then the entrypoint of the generated image will be /cnb/lifecycle/launcher. In this case you must set a command override to one of the non-default processes, otherwise the container will not start properly. The launcher will attempt to run any command with a bash shell. To execute a command without a shell, prefix the command with -- (e.g. -- /cnb/process/non-default).

Learn more about buildpack processes .

© 2022 Northflank Ltd. All rights reserved.