Chocolatey在本地安装,但未在docker构建中安装(但上周安装了)-为什么?

时间:2020-02-26 12:59:17

标签: windows docker chocolatey

我正在尝试使用Chocolatey将软件包安装到Windows容器中。我实际上只是想更改其中一个软件包,然后重新构建并推送,现在突然不起作用了。当我在主机上测试它(运行与容器相同的命令)时,它工作正常。自上次构建以来,该容器安装存在某种问题。我只能怀疑基础映像已更改。但是,也许不是

在主机上:

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
    if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
        importImageView.image = image
        importImage = image
    }
    self.dismiss(animated: true, completion: nil)
}

同一主机,但这次在Dockerfile中

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
                           Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.15.
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\Users\ADMINI~1\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\ADMINI~1\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder

1 个答案:

答案 0 :(得分:0)

TLS changesmicrosoft base images的更改,出现了一些问题,这使我在过去3周内遇到了7zip和choco的一些问题。通过添加以下内容,我的基本图像现在可以工作了:

RUN $text = '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13 -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls'; \
    $text | Set-Content 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1';

RUN powershell -Command Set-ExecutionPolicy Bypass -Scope Process -Force; \
    iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); \
    powershell -Command refreshenv; \
    cinst -y --allow-empty-checksums 7zip.install make nuget.commandline --no-progress;

但是,在其他图像中,我仍然遇到一些错误,报告为错误:“ 7-Zip发出未知错误(代码-1073741511)”,但是毫无疑问,它们归结为同一件事。同样,如果我执行了正在运行的容器,则可以手动运行choco并安装7zip,甚至可以访问“ 7z”命令。进行更改后,我尝试提交容器,但是仍然遇到此问题。