v1

On this page

Run /

Override the Docker command

Your deployments, whether in a continuously-running service or an occasionally-run job, will be run using the command (CMD) defined either in your Dockerfile, or generated by the Buildpack used to build the image.

You can override this command from the CMD override page in your job or service by selecting edit commands, or select set CMD override from the deployment overview. Enter your 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 build 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 execute a shell (e.g. /bin/sh -c) if you want to execute a shell command.

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.

If your Dockerfile defines an ENTRYPOINT instruction, the ENTRYPOINT instruction and parameters will be processed first, then any CMD instruction and parameters.

© 2022 Northflank Ltd. All rights reserved.