Docker Container Options¶
Introduced in 0.3.17
Pass container options to the
docker run command during Dokku's
docker-options:add <app> <phase(s)> OPTION # Add Docker option to app for phase (comma-separated phase list) docker-options:clear <app> [<phase(s)>...] # Clear a docker options from application docker-options:remove <app> <phase(s)> OPTION # Remove Docker option from app for phase (comma-separated phase list) docker-options:report [<app>] [<flag>] # Displays a docker options report for one or more apps
When specifying multiple phases, they must be comma-separated without spaces in between each phase, like so:
About Dokku phases¶
Dokku deploys your application in multiple "phases" and the
docker-options plugin allows you to pass arguments to their underlying docker container:
build: the container that executes the appropriate buildpack
deploy: the container that executes your running/deployed application
run: the container that executes any arbitrary command via
Manipulation of docker options will not restart running containers. This enables multiple options to be set/unset before final application. As such, changing an app's docker options must be followed by a
dokku ps:rebuild in order to take effect.
More information on supported Docker options can be found here: https://docs.docker.com/engine/reference/commandline/run/.
Container options configured via the
docker-options plugin are not used to modify the process a container runs. Container options are the
[OPTIONS] portion of the following, where
[ARG] are the process and the arguments passed to it that are launched in the created container:
docker run [OPTIONS] [CONTAINER_COMMAND] [ARG...]. Please see the documentation for customizing the run command or use a Procfile to modify the command used by a Dockerfile-based container.
Add Docker options¶
Add some options for the deployed/running app and when executing
# Mount a host volume in a Docker container: "-v /host/path:/container/path" dokku docker-options:add node-js-app deploy "-v /var/log/node-js-app:/app/logs" dokku docker-options:add node-js-app run "-v /var/log/node-js-app:/app/logs"
When mounting a host directory in a Dokku app you should first create that directory as user
dokku and then mount the directory under
/app in the container using
docker-options as above. Otherwise the app will lack write permission in the directory.
Remove a Docker option¶
Clear all Docker options for an app¶
Docker options can be removed for a specific app using the
One or more valid phases can also be specified. Phases are comma delimited, and specifying an invalid phase will result in an error.
Displaying docker-options reports for an app¶
Introduced in 0.8.1
You can get a report about the app's docker-options status using the
=====> node-js-app docker options information Docker options build: Docker options deploy: -v /var/log/node-js-app:/app/logs Docker options run: -v /var/log/node-js-app:/app/logs =====> python-sample docker options information Docker options build: Docker options deploy: Docker options run: =====> ruby-sample docker options information Docker options build: Docker options deploy: Docker options run:
You can run the command for a specific app also.
You can pass flags which will output only the value of the specific information you want. For example: