Could not build Docker image WindowsServerCodre on Azure DevOps - azure

I'm trying to build some Windows docker images on Azure Devops. However, during the last step I get:
re-exec error: exit status 1: output: time="2018-10-29T14:26:32Z" level=error msg="hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\\?\C:\ProgramData\docker\windowsfilter\e5d6a8d03464d02106a603b183b1ea47ad9fdd910a7dc1fdf19f605ec343b9cb flavour=1 folder=C:\ProgramData\docker\tmp\hcs934975059"
2018-10-29T14:26:34.2133323Z hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\?\C:\ProgramData\docker\windowsfilter\e5d6a8d03464d02106a603b183b1ea47ad9fdd910a7dc1fdf19f605ec343b9cb flavour=1 folder=C:\ProgramData\docker\tmp\hcs934975059
The weird thing is that I have the exactly same branch on my personal account and it works! It only fails for conan-io organization!
What I could do to fix it?
It's possible to check all windowsservercore here. I can't use 1709 or 1803 because of my environment.
Logs are available here:
[success] https://dev.azure.com/uilianr/conan-devops/_build/results?buildId=92&view=logs
[failing] https://dev.azure.com/conanio/conan-docker-tools/_build/results?buildId=28&view=logs
Docker recipes are here (same file on both repositories):
[uilianries] https://github.com/uilianries/conan-docker-tools/blob/feature/docker-windows/msvc_14/Dockerfile
[conan-io] https://github.com/conan-io/conan-docker-tools/blob/feature/docker-windows/msvc_14/Dockerfile

Related

Can't deploy Docker container to Azure registry from VSCode

I'm trying to follow the steps in this tutorial: https://learn.microsoft.com/en-us/azure/container-apps/deploy-visual-studio-code
I've got the plugins setup in VSCode and the sample code cloned to my machine. However, when I right-click on the Dockerfile and select "Build Image in Azure", I'm unable to get it to complete. There's no error, the deployment just seemingly hangs, this is the only output I get:
The Docker extension will try to connect to 'unix:///var/run/docker.sock', via context 'default'.
Setting up temp file with 'sourceArchive89321.tar.gz'
Sending source code to temp file
Getting build source upload URL
Creating block blob
Uploaded source code to /var/folders/bn/t9ncw2gx1fxc_2c8h2wb22940000gn/T/sourceArchive89321.tar.gz
Set up run request
Scheduled run ca9
2022/11/02 02:34:13 Downloading source code...
2022/11/02 02:34:14 Finished downloading source code
2022/11/02 02:34:13 Downloading source code...
2022/11/02 02:34:14 Finished downloading source code
2:34:15 Setting up Docker configuration...
2022/11/02 02:34:15 Successfully set up Docker configuration
2022/11/02 02:34:15 Logging in to registry: inhearten.azurecr.io
2022/11/02 02:34:16 Successfully logged into inhearten.azurecr.io
2022/11/02 02:34:16 Executing step ID: build. Timeout(sec): 28800, Working directory: '', Network: ''
2022/11/02 02:34:16 Scanning for dependencies...
2022/11/02 02:34:17 Successfully scanned dependencies
2022/11/02 02:34:17 Launching container with name: build
Sending build context to Docker daemon 173.6kB
Step 1/10 : FROM node:lts-alpine
lts-alpine: Pulling from library/node
213ec9aee27d: Already exists
9653b84b6e0f: Pulling fs layer
78c6f799e789: Pulling fs layer
d64061ca841e: Pulling fs layer
d64061ca841e: Verifying Checksum
d64061ca841e: Download complete
78c6f799e789: Verifying Checksum
78c6f799e789: Download complete
9653b84b6e0f: Verifying Checksum
9653b84b6e0f: Download complete
9653b84b6e0f: Pull complete
And it just stays at that final step infinitely, and the image never shows up in the Azure docker registry I specified.
What I tried:
Deploying the docker image to azure
What I expected:
It to successfully deploy
What happened:
It's stuck on Step 1/10 with no error message or obvious way to proceed
I tried to reproduce the same issue in my environment and got the below results
I have VS code setup in my local and installed the docker setup
Cloning the sample URL Using this document
git clone https://github.com/Azure-Samples/containerapps-albumapi-javascript.git
Signed into the azure and followed the same steps which mention in the document
In the explorer window, open the docker file which we have cloned and right click on the Dockerfile and click on Build image
While creating the build give the registry name which we have to mention and click on enter it will create the build as shown in below
The docker image got success fully deployed
Now we can see the newly created images by using the below command
docker images
NOTE:
1). We are getting these type of errors because of source code not cloned properly for that delete the entire source code and re-clone it again
2). please check the versions try to install the latest versions

Deploying Docker Image from Azure Container Registry to Web App Container "failed to register layer: Error processing tar file(exit status 1)"

I've tried latest Ubuntu and Python - they successfully extract and mount. However, as soon as I install further dependencies and add my app and push the image to Azure ACR - this error happens.
What is happening on my local machine? I have the Ubuntu image running for example, I install pip3 for example, and "docker commit" the changes locally, then tag the image and push it to ACR. This image will then fail to load with the above error. I can see that the segments in the previous image are already in the registry and only the latest image segment is actually pushed. So the error appears to occur with the latest change to the image.
The full error message is:-
2020-06-25T03:14:43.517Z ERROR - failed to register layer: Error
processing tar file(exit status 1): Container ID 197609 cannot be
mapped to a host IDErr: 0, Message: failed to register layer: Error
processing tar file(exit status 1): Container ID 197609 cannot be
mapped to a host ID
2020-06-25T03:14:43.589Z INFO - Pull Image
failed, Time taken: 0 Minutes and 46 Seconds
2020-06-25T03:14:43.590Z ERROR - Pulling docker image *******.azurecr.io/seistech-1:v1.0.0.15
failed:
2020-06-25T03:14:43.590Z INFO - Pulling image from Docker
hub: .azurecr.io/seistech-1:v1.0.0.15 2020-06-25T03:14:43.987Z
ERROR - DockerApiException: Docker API responded with status
code=InternalServerError, response={"message":"Get
https://.azurecr.io/v2/*******-1/manifests/v1.0.0.15:
unauthorized: authentication required, visit
https://aka.ms/acr/authorization for more information."}
2020-06-25T03:14:44.020Z ERROR - Image pull failed: Verify docker
image configuration and credentials (if using private repository)
2020-06-25T03:14:46.491Z INFO - Stopping site *******-dev-container
because it failed during startup.
Note re' authentication message(s) - I have created system assigned identity in the web app and assigned image pull permissions in the ACR - so as far as I can tell, there should be no auth issue.
Suggestions appreciated - very little diagnostic info to work with.
Thanks
Andy, NZ
In my case, it was related to npm v9 and only when using Azure App Service.
may install modules into your node_modules directory with a high ID for the file owner/creator.
My Solution:
As a quick workaround, I reverted back to an older version of npm 8.x. That worked for me at the moment.
Found this article to be helpful
NPM-specific issues causing users remapping exceptions
The Managed identity cannot be authentication to deploy the Docker image from the ACR. You must set the environment such as:
DOCKER_REGISTRY_SERVER_USERNAME - The username for the ACR server.
DOCKER_REGISTRY_SERVER_URL - The full URL to the ACR server. (For example, https://my-server.azurecr.io.)
DOCKER_REGISTRY_SERVER_PASSWORD - The password for the ACR server.
This is the only way to pull the image from a private registry and so for ACR. The managed identity just works when the Web App running, but pulling the image is before it.
For some reason I took several days to find this documentation page
The key piece of info in the container error log is this:
...container id xxxxxx cannot be mapped...
And the shell script to find these items is this:
$ find / \( -uid 1000000 \) -ls 2>/dev/null
(where 1000000 is the high ID from the error message)
The solution then was simple, in the final step of my docker-compose Dockerfile I added:
&& chown -R root:root /home
which is where the find command show all the problematic files were - they were created by a tar -x operation. I haven't dug further into whether this caused the permissions problem.

Azure Function deployed using FTP, how to fix non-existence docker container issue

I am in development phrase, and I am trying out Azure Function, with the following settings:
Linux
Premium Plan,
NodeJS 12
Deploy using FTP
What I have done:
I have deployed a sample Durable Functions HTTP Starter as specified here: https://learn.microsoft.com/en-us/azure/azure-functions/durable/quickstart-js-vscode#client-function-http-starter
And deployed my code to the xxxxxxxxxxx.ftp.azurewebsites.windows.net under /site/wwwroot
And I received the following Error in LogFiles/2020_06_10_xxxx_docker.log:
2020-06-10T01:05:51.825Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2020-06-10T01:05:51.845Z INFO - Stopping site XXXXXXXXXX because it failed during startup.
2020-06-10T01:09:59.152Z INFO - Pulling image from Docker hub: mcr.microsoft.com/azure-functions/node:3.0-node8-appservice-stage6
2020-06-10T01:10:00.049Z ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"manifest for mcr.microsoft.com/azure-functions/node:3.0-node8-appservice-stage6 not found: manifest unknown: manifest tagged by \"3.0-node8-appservice-stage6\" is not found"}
Upon inspection, this mcr.microsoft.com/azure-functions/node:3.0-node8-appservice-stage6 docker image didn't exists, so it failed.
My question is, how to instruct Azure Function to use a valid docker image instead of a non-existing one? Or if any step above I done wrong so result in this issue? Thanks
Completely removing the Azure Function and creating a new one fix this issue.

Unable to use mcr.microsoft.com/windows/servercore:ltsc when building from azure cloudshell (powershell)

This works perfectly when I build locally, but to avoid having to move images to the azure container registry I am trying to build in the cloud.
Dockerfile contains:
FROM mcr.microsoft.com/windows/servercore:ltsc AS build-stage1
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
.
.
.
Step 5/37 : FROM mcr.microsoft.com/windows/servercore:ltsc AS build-stage1
manifest for mcr.microsoft.com/windows/servercore:ltsc not found: manifest unknown: manifest unknown
2019/10/01 14:32:28 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 1
Run ID: ch1k failed after 7s. Error: failed during run, err: exit status 1
And yet the same base image works fine when I build from a locally hosted powershell.
I'm not clear how do you build the image successfully. But I recommend you take a look at the image mcr.microsoft.com/windows/servercore in the docker hub. And it also gives out the available tags here. There is no tag as ltsc. You need to choose one in the available tags. For example, mcr.microsoft.com/windows/servercore:ltsc2019.
Update:
I can reproduce the same issue as you got, then I add the parameter --platform windows and it works perfectly. I recommend you take a try. Hope it helps.

VSTS - Build a Docker Image

I have a .NET Core repo in VSTS. I'm trying to create a Build pipeline that builds a Docker image and adds it to my Azure Container Registry. My Build pipeline has a Docker task. This task has the "Build an image" action selected. This action relies on my Dockerfile, which looks like this:
FROM microsoft/dotnet:2.1.2-runtime-nanoserver-1803
# Install .NET Core
ENV DOTNET_VERSION 2.1.2
When my Build pipeline runs, I get an error that says:
failed to register layer: re-exec error: exit status 1: output: ProcessUtilityVMImage \\?\C:\ProgramData\docker\windowsfilter\82aba535faccd8bf0e5ce3c122247672fa671214000a12c5481972212c5e2ca0\UtilityVM: The system cannot find the path specified.
##[error]C:\Program Files\Docker\docker.exe failed with return code: 1
Why am I getting this error? How do I fix it?
It should be the same issue with this one : https://github.com/Microsoft/vsts-tasks/issues/6510
Seems it still have some issues with nanoserver-1803
Just try to setup and host a custom agent on Azure VM, then check it again.
https://github.com/Microsoft/vsts-tasks/issues/6510#issuecomment-370152300
I found maybe an explication about this error: VSTS agents seem not
support nanoserver-1709 actually. Maybe this will change with the next
version 1803.
See details here: Microsoft/vsts-agent#1393
When I setup and host a custom agent on a machine on Azure, it's
working. So it's not a bug with this task. I close this issue. Thanks!

Resources