This repository has been archived on 2020-01-20. You can view files and clone it, but cannot push or open issues or pull requests.
node-spearhead/lib/do_profile/do_docker_setup.js
Trent Mick b66939751d joyent/node-triton#182 'triton profile create' and 'triton profile docker-setup' need a non-interactive option
Reviewed by: Todd Whiteman <todd.whiteman@joyent.com>
Approved by: Todd Whiteman <todd.whiteman@joyent.com>
2017-02-24 09:29:05 -08:00

67 lines
1.9 KiB
JavaScript

/*
* Copyright 2016 Joyent Inc.
*
* `triton profile docker-setup ...`
*/
var assert = require('assert-plus');
var errors = require('../errors');
var profilecommon = require('./profilecommon');
function do_docker_setup(subcmd, opts, args, cb) {
if (opts.help) {
this.do_help('help', {}, [subcmd], cb);
return;
} else if (args.length > 1) {
return cb(new errors.UsageError('too many arguments'));
}
var profileName = args[0] || this.top.tritonapi.profile.name;
profilecommon.profileDockerSetup({
cli: this.top,
name: profileName,
implicit: false,
yes: opts.yes
}, cb);
}
do_docker_setup.options = [
{
names: ['help', 'h'],
type: 'bool',
help: 'Show this help.'
},
{
names: ['yes', 'y'],
type: 'bool',
help: 'Answer yes to any confirmations.'
}
];
do_docker_setup.synopses = ['{{name}} {{cmd}} [PROFILE]'];
do_docker_setup.help = [
/* BEGIN JSSTYLED */
'Setup for using Docker with the current Triton CLI profile.',
'',
'{{usage}}',
'',
'{{options}}',
'A Triton datacenter can act as a virtual Docker Engine, where the entire',
'datacenter is available on for running containers. The datacenter provides',
'an endpoint against which you can run the regular `docker` client. This',
'requires a one time setup to (a) generate a client TLS certificate to enable',
'secure authentication with the Triton Docker Engine, and (b) to determine',
'the DOCKER_HOST and related environment variables.',
'',
'After running this, you can setup your shell environment for `docker` via:',
' eval "$(triton env --docker)"',
'or the equivalent. See `triton env --help` for details.'
/* END JSSTYLED */
].join('\n');
do_docker_setup.completionArgtypes = ['tritonprofile', 'none'];
module.exports = do_docker_setup;