[英]How to provide parameter to docker run with “oc new-app” in OpenShift?
When I run some docker containers, I need to provide parameters on the command line ( docker run image some-parameters
). 当我运行一些docker容器时,我需要在命令行上提供参数( docker run image some-parameters
)。 How can I provide the same parameters when using oc new-app
in OpenShift Origin? 在OpenShift Origin中使用oc new-app
时如何提供相同的参数?
The oc new-app
example includes: oc new-app
示例包括:
# Create an application based on a template file, explicitly setting a parameter value
$ oc new-app --file=./example/myapp/template.json --param=MYSQL_USER=admin
The --param
option can be useful here. --param
选项在这里很有用。
Note: The oc run
example include: 注意: oc run
示例包括:
# Start a single instance of nginx, but overload the spec of the replication
# controller with a partial set of values parsed from JSON.
$ oc run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
That json can include a parameter section, as does this one used by sti_incremental.go#L39
. 也就是说JSON可以包括参数部分,象这样一个由用于sti_incremental.go#L39
。
Based on Openshift Client help 基于Openshift Client帮助
oc run -h
oc run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...] [options]
For me worked this: 对我来说,这是:
oc run my_command --image='alpine' --command -- telnet some_server 22
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.