Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hcsshim::CreateScratchLayer - failed failed in Win32: The system cannot find the path specified. (0x3) #375

Closed
Hithesh0899 opened this issue Jun 6, 2023 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@Hithesh0899
Copy link

Please fill out all the sections below for bug issues, otherwise it'll be closed as it won't be actionable for us to address.

Describe the bug
my base image FROM mcr.microsoft.com/windows/servercore:ltsc2019
Unable to build the image using the docker file with WORKDIR C:/app command

To Reproduce
Steps to reproduce the behavior:

Expected behavior
Image of sample application should be created without any bugs

Configuration:

  • Edition: Windows 10 Enterprise
  • Base Image being used: mcr.microsoft.com/windows/servercore:ltsc2019
  • Container engine:
  • Container Engine version 20.10.17

Additional context
Step 1/14 : FROM mcr.microsoft.com/windows/servercore:ltsc2019
---> 66a1a48cbc11
Step 2/14 : WORKDIR C:/dockers
hcsshim::CreateScratchLayer - failed failed in Win32: The system cannot find the path specified. (0x3)

dockerfile:

FROM mcr.microsoft.com/windows/servercore:ltsc2019

WORKDIR C:/app

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

docker-library/python#557

ENV PYTHONIOENCODING UTF-8

#PYTHON Dependency
ENV PYTHON_VERSION 3.11.3

RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION);
Write-Host ('Downloading {0} ...' -f $url);
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-WebRequest -Uri $url -OutFile 'python.exe';

Write-Host 'Installing ...'; \

https://docs.python.org/3/using/windows.html#installing-without-ui

$exitCode = (Start-Process python.exe -Wait -NoNewWindow -PassThru \
	-ArgumentList @( \
		'/quiet', \
		'InstallAllUsers=1', \
		'TargetDir=C:\Python', \
		'PrependPath=1', \
		'Shortcuts=0', \
		'Include_doc=0', \
		'Include_pip=0', \
		'Include_test=0' \
	) \
).ExitCode; \
if ($exitCode -ne 0) { \
	Write-Host ('Running python installer failed with exit code: {0}' -f $exitCode); \
	Get-ChildItem $env:TEMP | Sort-Object -Descending -Property LastWriteTime | Select-Object -First 1 | Get-Content; \
	exit $exitCode; \
} \
\

the installer updated PATH, so we should refresh our local value

$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
\
Write-Host 'Verifying install ...'; \
Write-Host '  python --version'; python --version; \
\
Write-Host 'Removing ...'; \
Remove-Item python.exe -Force; \
Remove-Item $env:TEMP/Python*.log -Force; \
\
Write-Host 'Complete.'


# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"

ENV PYTHON_PIP_VERSION 22.3.1

docker-library/python#365

ENV PYTHON_SETUPTOOLS_VERSION 65.5.1

https://github.com/pypa/get-pip

ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/0d8570dc44796f4369b652222cf176b3db6ac70e/public/get-pip.py
ENV PYTHON_GET_PIP_SHA256 96461deced5c2a487ddc65207ec5a9cffeca0d34e7af7ea1afc470ff0d746207

RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL);
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-WebRequest -Uri $env:PYTHON_GET_PIP_URL -OutFile 'get-pip.py';
Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_GET_PIP_SHA256);
if ((Get-FileHash 'get-pip.py' -Algorithm sha256).Hash -ne $env:PYTHON_GET_PIP_SHA256) {
Write-Host 'FAILED!';
exit 1;
};

$env:PYTHONDONTWRITEBYTECODE = '1';

Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION);
python get-pip.py
--disable-pip-version-check
--no-cache-dir
--no-compile
('pip=={0}' -f $env:PYTHON_PIP_VERSION)
('setuptools=={0}' -f $env:PYTHON_SETUPTOOLS_VERSION)
;
Remove-Item get-pip.py -Force;

Write-Host 'Verifying pip install ...';
pip --version;

Write-Host 'Complete.'

COPY . C:/app
COPY Execution_Logs.txt C:/

@Hithesh0899 Hithesh0899 added the bug Something isn't working label Jun 6, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New and needs attention label Jun 6, 2023
@Hithesh0899
Copy link
Author

Please need an immediate assistance on the above issue

@zylxjtu
Copy link

zylxjtu commented Jun 6, 2023

@Hithesh0899
Copy link
Author

Hithesh0899 commented Jun 7, 2023

Thanks, sure let me check and update

@Hithesh0899
Copy link
Author

Can you please try with workdir c:\app (escape the backslash) as specified here? https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile#considerations-for-using-workdir-with-windows

I tried this too, but it is giving the same error. Please help me.

@ntrappe-msft
Copy link
Contributor

ntrappe-msft commented Jun 7, 2023

Hi. I tried to reproduce your error but the build was successful for me. Could you provide us with some more info?

Task 1: Check which version of the Windows Server Core 2019 image you're using.

  • Get the image ID: docker images mcr.microsoft.com/windows/servercore:ltsc2019
  • Paste the output of docker inspect <image ID you just got>

Task 2: Give us more information on your Docker system.

  • Paste the output of docker version

Task 3: Check how much memory is available for Docker.

  • Make sure Docker Desktop is open in the background and that docker is running
  • In a PowerShell window, run docker info --format '{{.MemTotal}}'
  • Paste whatever number (e.g. 8588828672) you see
  • Or, depending on your version of Docker Desktop, tell us what you see under memory: Docker Desktop > Settings > Resources > Memory

@ntrappe-msft ntrappe-msft removed the triage New and needs attention label Jun 8, 2023
@Hithesh0899
Copy link
Author

ntrappe-msft

Thanks a lot for the steps you have shared, apology for the late reply.
Issue got resolved, after i have selected an option - set to factory defaults.

Root cause: I have unknowingly deleted some data in C:Programdata/docker/windowsfilter - caused this issue,
after setting to factory defaults, it removed all the junk and old files from C drive and able to create image.

Thanks a lot for reply @ntrappe-msft

image

@Hithesh0899
Copy link
Author

If anything i will reopen the issue.

@ntrappe-msft
Copy link
Contributor

Ok! Thanks for letting us know and I'm happy your issue was resolved. I'll make a note of the error and root cause you identified to help us in the future.

@Hithesh0899 Hithesh0899 reopened this Jun 21, 2023
@Hithesh0899
Copy link
Author

This is new issue which i need to address in the same thread. @ntrappe-msft
Docker for Windows: No permissions over folders inside C:\ProgramData\Docker
I dont have access inside this folder, even if I go into the folder again every file and folder needs to have admin access.
Please need your help how disable the admin access to above path C:\ProgramData\Docker
Kindly need an solution

@ntrappe-msft
Copy link
Contributor

Let's check what permissions you currently have for the files in the Docker folder. Can you give me the output of the following command?

(This is for Command Prompt but I can give you a Powershell equivalent too).

icacls "C:\Program Files\Docker\*"

You should get something like:

C:\Program Files\Docker\licenses.txt 
    NT AUTHORITY\SYSTEM:(I)(F)
    BUILTIN\Administrators:(I)(F)
    BUILTIN\Users:(I)(RX)
    APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(RX)
    APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(I)(RX)
C:\Program Files\Docker\metadata.json 
. . . 
etc. 

@ntrappe-msft ntrappe-msft self-assigned this Jun 21, 2023
@Hithesh0899
Copy link
Author

As of now i am in company - but my admin is trying to give permissions.
but we tried a lot it is not happening.
Please need to understand the root cause.
currently the following is the status of folder permission:

image

@ntrappe-msft
Copy link
Contributor

Can you:

  1. Open up File Explorer and navigate to the C:\ProgramData folder?
  2. Write-click on the Docker folder to open up folder properties.
  3. In the General tab make sure you have "Read-only" access checked.
  4. Go to the Security tab and click Advanced.
  5. Under Permissions click Continue.
  6. What access do you see? Full control?

@Hithesh0899
Copy link
Author

Sure, I will check this things and will update you on this - regarding monday. Apologies for delay.

@microsoft-github-policy-service
Copy link
Contributor

This issue has been open for 30 days with no updates.
@ntrappe-msft, please provide an update or close this issue.

1 similar comment
@microsoft-github-policy-service
Copy link
Contributor

This issue has been open for 30 days with no updates.
@ntrappe-msft, please provide an update or close this issue.

@fady-azmy-msft
Copy link
Contributor

Issue is going stale, closing this issue for now.

@ntrappe-msft
Copy link
Contributor

ntrappe-msft commented Oct 4, 2023

This may not solve the specific issue you had but it did resolve it when I encountered it.

For reference, I tried to start up a container from a Windows Server Core LTSC 2022 image.

> docker run -it mcr.microsoft.com/windows/servercore:ltsc2022 powershell

This failed and I received the error: Error response from daemon: hcsshim::CreateScratchLayer failed in Win32: The system cannot find the path specified. (0x3).

The image I was using was decently old; I'd pulled it 5 months ago and hadn't updated it or received any of the new security patches.

> docker images

REPOSITORY                            TAG       IMAGE ID      CREATED
mcr.microsoft.com/windows/servercore  ltsc2022  29e69ab16e91  5 months ago

I pulled the newest image, ran the command to start up a container again, and everything succeeded.

> docker pull mcr.microsoft.com/windows/servercore:ltsc2022
Status: Downloaded newer image for mcr.microsoft.com/windows/servercore:ltsc2022

> docker run -it mcr.microsoft.com/windows/servercore:ltsc2022 powershell

Hope this helps anyone else!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants