nsc exec-scoped

Run a command with environment variables set based on selected services.

exec-scoped runs the specified command (e.g. a script) against an instance, after first setting the environment variables that the selected services expect — for example DOCKER_HOST for docker, or KUBECONFIG for kubernetes. This makes it possible to point an existing script or tool at a Namespace instance's Docker or Kubernetes endpoint without manually exporting those variables yourself.

Which services get wired up is controlled with --service. The corresponding environment variables are only set for the lifetime of the child process that exec-scoped starts; they aren't exported into your interactive shell.

Usage

nsc exec-scoped --service=docker|kubernetes <clusterid> <cmd...>

Example

$ nsc exec-scoped --service=docker,kubernetes 85a32emcg99ii ./deploy.sh

Options

--service strings

Which services to inject, any of: docker, kubernetes. Pass a comma-separated list to set up environment variables for more than one service at once — for example --service=docker,kubernetes sets both DOCKER_HOST and KUBECONFIG before running <cmd...>.