Source:
<code>public Instance startService(String namespace, String workspaceId, String envName, String machineName, boolean isDev, String networkName, CheServiceImpl service, LineConsumer machineLogger) throws ServerException { service = new CheServiceImpl(service); ProgressLineFormatterImpl progressLineFormatter = new ProgressLineFormatterImpl(); ProgressMonitor progressMonitor = currentProgressStatus -> { try { machineLogger.writeLine(progressLineFormatter.format(currentProgressStatus)); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); } }; String container = null; try { String image = prepareImage(machineName, service, progressMonitor); container = createContainer(workspaceId, machineName, isDev, image, networkName, service); connectContainerToAdditionalNetworks(container, service); docker.startContainer(StartContainerParams.create(container)); <START> if (System.getenv("CHE_USER_ID") != null) { <END> changeWorkingDirOwner(container, machineLogger); } readContainerLogsInSeparateThread(container, workspaceId, service.getId(), machineLogger); DockerNode node = dockerMachineFactory.createNode(workspaceId, container); dockerInstanceStopDetector.startDetection(container, service.getId(), workspaceId); MachineImpl machine = new MachineImpl(MachineConfigImpl.builder() .setDev(isDev) .setName(machineName) .setType("docker") .setLimits(new MachineLimitsImpl((int)Size .parseSizeToMegabytes( service.getMemLimit() + "b"))) .setSource(new MachineSourceImpl(service.getBuild() != null ? "context" : "image") .setLocation(service.getBuild() != null ? service.getBuild().getContext() : service.getImage())) .build(), service.getId(), workspaceId, envName, namespace, MachineStatus.RUNNING, null); return dockerMachineFactory.createInstance(machine, container, image, node, machineLogger); } catch (SourceNotFoundException e) { throw e; } catch (RuntimeException | ServerException | NotFoundException | IOException e) { cleanUpContainer(container); throw new ServerException(e.getLocalizedMessage(), e); } }</code><technical_language>PLease injection check env variables</technical_language>

Target:
public Instance startService(String namespace, String workspaceId, String envName, String machineName, boolean isDev, String networkName, CheServiceImpl service, LineConsumer machineLogger) throws ServerException { service = new CheServiceImpl(service); ProgressLineFormatterImpl progressLineFormatter = new ProgressLineFormatterImpl(); ProgressMonitor progressMonitor = currentProgressStatus -> { try { machineLogger.writeLine(progressLineFormatter.format(currentProgressStatus)); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); } }; String container = null; try { String image = prepareImage(machineName, service, progressMonitor); container = createContainer(workspaceId, machineName, isDev, image, networkName, service); connectContainerToAdditionalNetworks(container, service); docker.startContainer(StartContainerParams.create(container)); if (!Strings.isNullOrEmpty(cheDockerUserId)) { changeWorkingDirOwner(container, machineLogger); } readContainerLogsInSeparateThread(container, workspaceId, service.getId(), machineLogger); DockerNode node = dockerMachineFactory.createNode(workspaceId, container); dockerInstanceStopDetector.startDetection(container, service.getId(), workspaceId); final String userId = EnvironmentContext.getCurrent().getSubject().getUserId(); MachineImpl machine = new MachineImpl(MachineConfigImpl.builder() .setDev(isDev) .setName(machineName) .setType("docker") .setLimits(new MachineLimitsImpl((int)Size .parseSizeToMegabytes( service.getMemLimit() + "b"))) .setSource(new MachineSourceImpl(service.getBuild() != null ? "context" : "image") .setLocation(service.getBuild() != null ? service.getBuild().getContext() : service.getImage())) .build(), service.getId(), workspaceId, envName, userId, MachineStatus.RUNNING, null); return dockerMachineFactory.createInstance(machine, container, image, node, machineLogger); } catch (SourceNotFoundException e) { throw e; } catch (RuntimeException | ServerException | NotFoundException | IOException e) { cleanUpContainer(container); throw new ServerException(e.getLocalizedMessage(), e); } }