PowerShell / PowerShell/PowerShell-Docker

nanoserver powershell image unable to use install-modules by default

オープン
#492 コメント 1 件 リアクション 1 件 担当者 1 名 GitHub で見る

@TravisEz13 がすでに取り組んでいます。

2020年9月11日 から。

Issue-Bug
主要言語
Dockerfile
スター
449
フォーク
158
平均マージ
3日 10時間
マージ済み PR(30日)
1

説明

Steps to reproduce

  1. Pull the latest mcr.microsoft.com/powershell:lts-nanoserver-1809 image
  2. Run a container in interactive mode using the image
  3. Check the PSModulePath environment variable
  4. Attempt to install a PSGallery module using Install-Module with -Verbose (module used in this case is powershell-yaml)
  5. Notice the verbose output shows the install path a C:\Users\ContainerUser\Documents\Powershell\Modules
  6. This path is not in the PSModulePath env variable

** Note attempting to run Install-Module with -Scope AllUsers fails due to permissions

docker pull mcr.microsoft.com/powershell:lts-nanoserver-1809

docker run -it --name=testModule mcr.microsoft.com/powershell:lts-nanoserver-1809

Install-Module powershell-yaml -SkipPublisherCheck -Scope CurrentUser -Verbose

Get-Module -ListAvailable

Expected behavior

The ContainerUser powershell module path should be in the PSModulePath env variable so that the installed module is available in both interactive container runs or for building images with modules packaged.

Actual behavior

The module installs but is not usable unless the PSModulePath env var is manipulated every session or as part of the image entrypoint, e.g. a script that first sets up the PSModulePath by hand then continues on to do whatever the image's intended work is. (We are currently doing this.)

Environment data

Client:
 Debug Mode: false

Server:
 Containers: 4
  Running: 1
  Paused: 0
  Stopped: 3
 Images: 18
 Server Version: 19.03.8
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 18362 (18362.1.amd64fre.19h1_release.190318-1202)
 Operating System: Windows 10 Pro Version 1903 (OS Build 18362.1082)
 OSType: windows
 Architecture: x86_64
 CPUs: 6
 Total Memory: 15.81GiB
 Name: IdentifiDOPaw
 ID: ZSX7:XQ5Y:XTMR:YNOD:3H47:GO5C:JCEO:YCLL:NPIR:OJHN:XZ7E:V7UB
 Docker Root Dir: C:\ProgramData\Docker
 Debug Mode: true
  File Descriptors: -1
  Goroutines: 45
  System Time: 2020-09-11T15:00:37.0752912-04:00
  EventsListeners: 1
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      0      3

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。