alwaysai
Version:
The alwaysAI command-line interface (CLI)
50 lines • 2.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkForDockerComponent = void 0;
const alwayscli_1 = require("@alwaysai/alwayscli");
const constants_1 = require("../../constants");
const util_1 = require("../../util");
async function checkForDockerComponent(props = {}) {
const spawner = props.targetHostname
? (0, util_1.SshSpawner)({ targetHostname: props.targetHostname })
: (0, util_1.JsSpawner)();
{
const spinner = (0, util_1.Spinner)('Check docker executable');
try {
await spawner.run({ exe: 'docker', args: ['--version'] });
spinner.succeed();
}
catch (ex) {
spinner.fail('Command "docker --version" failed');
(0, util_1.echo)(ex.message);
(0, util_1.echo)(`Please install docker${props.targetHostname ? ' on your target system' : ''}, or \nverify the existing installation if there is one.`);
(0, util_1.echo)();
(0, util_1.echo)('For installation instructions for your operating system, see:');
(0, util_1.echo)();
(0, util_1.echo)(' https://docs.docker.com/install/');
(0, util_1.echo)();
throw new alwayscli_1.CliTerseError('Failed to run "docker --version"');
}
}
{
const spinner = (0, util_1.Spinner)('Check docker permissions');
try {
await spawner.run({
exe: 'docker',
args: ['run', '--rm', constants_1.DOCKER_TEST_IMAGE_ID]
});
spinner.succeed();
}
catch (ex) {
spinner.fail(`Command "docker run ${constants_1.DOCKER_TEST_IMAGE_ID}" failed`);
(0, util_1.echo)((0, util_1.stringifyError)(ex));
(0, util_1.echo)('Please double-check that you\'ve complete the "Manage Docker as a non-root user" post-install steps described here:');
(0, util_1.echo)();
(0, util_1.echo)(' https://docs.docker.com/install/linux/linux-postinstall/');
(0, util_1.echo)();
throw new alwayscli_1.CliTerseError(`Failed to run "docker run ${constants_1.DOCKER_TEST_IMAGE_ID}"`);
}
}
}
exports.checkForDockerComponent = checkForDockerComponent;
//# sourceMappingURL=check-for-docker-component.js.map