diff --git a/apps/generator-cli/src/app/services/pass-through.service.ts b/apps/generator-cli/src/app/services/pass-through.service.ts index 920d629ac..2e45281cb 100644 --- a/apps/generator-cli/src/app/services/pass-through.service.ts +++ b/apps/generator-cli/src/app/services/pass-through.service.ts @@ -2,6 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import chalk from 'chalk'; import { exec, spawn } from 'child_process'; import { Command } from 'commander'; +import * as os from 'os'; import { COMMANDER_PROGRAM, LOGGER } from '../constants'; import { GeneratorService } from './generator.service'; import { VersionManagerService } from './version-manager.service'; @@ -130,8 +131,14 @@ export class PassThroughService { private cmd() { if (this.configService.useDocker) { + const userInfo = os.userInfo(); + const userArg = + userInfo.uid !== -1 ? `--user ${userInfo.uid}:${userInfo.gid}` : ''; + return [ - `docker run --rm -v "${this.configService.cwd}:/local"`, + `docker run --rm`, + userArg, + `-v "${this.configService.cwd}:/local"`, this.versionManager.getDockerImageName(), ].join(' '); }