docker container giving azure authentication error - azure

I am trying to run a docker container for an app that I am working on. The container is on a company machine and at times it simply ceases to work and gives the error below. Can anyone explain to me why azure would be involved or what is happening here?
docker: Error response from daemon: Head https://{docker container url}/{tag}: unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.
If I try to build the image to run it locally, I get the following error on build:
=> ERROR [internal] load metadata for {company URL}/alpine-3.12-base:0.2.0 0.8s
[internal] load metadata for {company URL}/alpine-3.12-base:0.2.0:
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch anonymous token: unexpected status: 401 Unauthorized

Related

error [connectors/v2/FabricGateway] Failed to perform query transaction [ReadAsset] using arguments

Can someone please help me with this problem.
error [connectors/v2/FabricGateway] Failed to perform query transaction [ReadAsset] using arguments [2_4], with error: Error: error in simulation: failed to execute transaction 9ca49b08603ab086104fec8777546bbbc24d826a3900136b4a0e66aadf4bb6e4: could not launch chaincode basic_1:9820659c595e662a849033ca23b4424e87a126e8f40b5f81ace59820b81fe8e7: chaincode registration failed: error starting container: error starting container: API error (404): network _test not found
The report has been generated but all the transactions has failed.
It looks like the chaincode's Docker container failed to start for some reason. You will need to use the docker logs command to inspect the logs for the failure reason. Use the docker ps -a command to see what containers are available, including stopped / failed containers. Both the chaincode container (if it exists) and peer container logs may hold useful information.

failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code

The following are the files that are associated with the query and the commands I ran which led to these errors:
Dockerfile
# syntax=docker/dockerfile:1
FROM node:lts-alpine
WORKDIR /server
COPY package.json package-lock.json ./
FROM base as test
RUN npm ci --silent
COPY . .
EXPOSE 8080
CMD [ "npm", "run", "test" ]
FROM base as prod
RUN npm ci --production --silent
COPY . .
EXPOSE 8080
CMD [ "node", "start" ]
docker-compose.yml
version: "3.8"
services:
customer_api:
build:
context: .
ports:
- 8080:8080
volumes:
- ./:/server
command: npm start
Command run:
docker build -t customer --target prod .
Error stack trace [with buildkit]
[+] Building 7.6s (9/9) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 38B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 5.3s
=> [auth] docker/dockerfile:pull token for registry-1.docker.io 0.0s
=> CACHED docker-image://docker.io/docker/dockerfile:1#sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 0.0s
=> [internal] load .dockerignore 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> ERROR [internal] load metadata for docker.io/library/base:latest 2.0s
=> [auth] library/base:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/library/base:latest:
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Error stack trace [without buildkit]
Sending build context to Docker daemon 785.9kB
Step 1/13 : FROM node:lts-alpine
---> 5dcd1f6157bd
Step 2/13 : WORKDIR /server
---> Using cache
---> 838d1ca2775c
Step 3/13 : COPY package.json package-lock.json ./
---> 20c41a2cf967
Step 4/13 : FROM base as test
pull access denied for base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Command run:
docker-compose -f docker-compose.dev.yml run customer_api npm run test
Error stack trace
WARNING: Found orphan containers (node_customer-api_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating node_customer_api_run ... done
> node#1.0.0 test
> mocha ./**/*.test.js --exit
Customer CRUD
Create customer
1) should create customer asynchronously
1) Customer CRUD
Create customer
should create customer asynchronously:
Error: connect ECONNREFUSED 127.0.0.1:8080
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)
None of the following solutions worked in my case hence the question:
docker-compose up error: "failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0" - Stack Overflow
docker-compose up error: "failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0"
go - ERROR: dockerfile parse error invalid field ' ' - Stack Overflow
ERROR: dockerfile parse error invalid field ' '
docker-compose up failed with the following error failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: - Stack Overflow
docker-compose up failed with the following error failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0:
node.js - Error: connect ECONNREFUSED 127.0.0.1:5432 - Stack Overflow
Error: connect ECONNREFUSED 127.0.0.1:5432
docker - An error, "failed to solve with frontend dockerfile.v0" - Stack Overflow
An error, "failed to solve with frontend dockerfile.v0"
dockerfile - denied: requested access to the resource is denied: docker - Stack Overflow
denied: requested access to the resource is denied: docker
node.js - Getting Error: connect ECONNREFUSED 127.0.0.1:6379 in docker-compose while connecting redis - Stack Overflow
Getting Error: connect ECONNREFUSED 127.0.0.1:6379 in docker-compose while connecting redis
node.js - Docker Compose getting error ECONNREFUSED 127.0.0.1:3306 with MySQL and NodeJS - Stack Overflow
Docker Compose getting error ECONNREFUSED 127.0.0.1:3306 with MySQL and NodeJS

Rancher - Failed to create pod sandbox: rpc error: code = Unknown desc

Does any one know how to resolve this error message?
The same Rancher container's were working just fine until about 2 weeks.
Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "e85e08bf70bfbb8cafe4b61b79f47008b4e829310600e5defb29f0a6600d25e3" network for pod "ykgwagg-845b559fbf-clrp8": networkPlugin cni failed to set up pod "ykgwagg-845b559fbf-clrp8_agg" network: error getting ClusterInformation: connection is unauthorized: Unauthorized, failed to clean up sandbox container "e85e08bf70bfbb8cafe4b61b79f47008b4e829310600e5defb29f0a6600d25e3" network for pod "ykgwagg-845b559fbf-clrp8": networkPlugin cni failed to teardown pod "ykgwagg-845b559fbf-clrp8_agg" network: error getting ClusterInformation: connection is unauthorized: Unauthorized]
enter image description here

Unable to run nvidia-docker. docker: Error response from daemon: OCI runtime create failed:

I was trying to re-implement this code from Github and it requires me to install nvidia-docker and run it. The installation of nvidia-docker seemed successful. However, when I run the command nvidia-docker run -it --ipc=host deep-colorization, it throws the following error::
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request\\\\n\\\"\"": unknown.
ERRO[0002] error waiting for container: context canceled
I am not sure what the error means as I don't have any previous experience with the docker ecosystem. Any kind of assistance is appreciated. I am running Ubuntu 18 by the way.
Thanking you in advance.

Anchore Engine - Jenkins CI plugin

We are trying to scan our docker images using Anchore Engine Jenkins plugin.
Currently we create our application docker images, push it in our own private local registry and then deploy it in our test environments.
Now, we want to setup docker image scanning in our CI/CD process to check for any vulnerabilities.
We have installed Anchore Engine using the recommended Docker-Compose yaml method given in the Documentation link:
https://anchore.freshdesk.com/support/solutions/articles/36000020729-install-on-docker-swarm
Post installation, we installed the
Anchore Container Image Scanner Plugin in Jenkins.
We configured the plugin as mentioned in the document link:
https://wiki.jenkins.io/display/JENKINS/Anchore+Container+Image+Scanner+Plugin
However, the scanning fails. Error Message as follows:
2018-10-11T07:01:44.647 INFO AnchoreWorker Analysis request accepted, received image digest sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8
2018-10-11T07:01:44.647 INFO AnchoreWorker Waiting for analysis of 10.180.25.2:5000/hello-world:latest, polling status periodically
2018-10-11T07:01:44.647 DEBUG AnchoreWorker anchore-engine get policy evaluation URL: http://10.180.25.2:8228/v1/images/sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8/check?tag=10.180.25.2:5000/hello-world:latest&detail=true
2018-10-11T07:01:44.648 DEBUG AnchoreWorker Attempting anchore-engine get policy evaluation (1/300)
2018-10-11T07:01:44.675 DEBUG AnchoreWorker anchore-engine get policy evaluation failed. URL: http://10.180.25.2:8228/v1/images/sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8/check?tag=10.180.25.2:5000/hello-world:latest&detail=true, status: HTTP/1.1 404 NOT FOUND, error: {
"detail": {},
"httpcode": 404,
"message": "image is not analyzed - analysis_status: not_analyzed"
}
NOTE:
In Image TAG 10.180.25.2:5000/hello-world:latest, 10.180.25.2:5000 is our local private registry and hello-world:latest is latest hello-world image available in docker hub which we pulled and pushed in our registry to try out image scanning using Anchore-Engine.
Unfortunately we are not able to find much resource online to try and resolve the above mentioned issue.
Anyone who might have worked on Anchore-Engine, please may I request to have a look and help us resolve this issue.
Also, any suggestions or alternatives to anchore-engine or detailed steps in case we might have missed anything would be really appreciated.
End of the output is as follows:
2018-10-15T00:48:43.880 WARN AnchoreWorker anchore-engine get policy evaluation failed. HTTP method: GET, URL: http://10.180.25.2:8228/v1/images/sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8/check?tag=10.180.25.2:5000/hello-world:latest&detail=true, status: 404, error: {
"detail": {},
"httpcode": 404,
"message": "image is not analyzed - analysis_status: not_analyzed"
}
2018-10-15T00:48:43.880 WARN AnchoreWorker Exhausted all attempts polling anchore-engine. Analysis is incomplete for sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8
2018-10-15T00:48:43.880 ERROR AnchorePlugin Failing Anchore Container Image Scanner Plugin step due to errors in plugin execution
hudson.AbortException: Timed out waiting for anchore-engine analysis to complete (increasing engineRetries might help). Check above logs for errors from anchore-engine
at com.anchore.jenkins.plugins.anchore.BuildWorker.runGatesEngine(BuildWorker.java:480)
at com.anchore.jenkins.plugins.anchore.BuildWorker.runGates(BuildWorker.java:343)
at com.anchore.jenkins.plugins.anchore.AnchoreBuilder.perform(AnchoreBuilder.java:338)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1724)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
I also checked status and found below:
docker run anchore/engine-cli:latest anchore-cli --u admin --p admin123 --url http://172.18.0.1:8228/v1 system status
Service analyzer (dockerhostid-anchore-engine, http://anchore-engine:8084): up
Service catalog (dockerhostid-anchore-engine, http://anchore-engine:8082): up
Service policy_engine (dockerhostid-anchore-engine, http://anchore-engine:8087): down (unavailable)
Service simplequeue (dockerhostid-anchore-engine, http://anchore-engine:8083): up
Service apiext (dockerhostid-anchore-engine, http://anchore-engine:8228): up
Service kubernetes_webhook (dockerhostid-anchore-engine, http://anchore-engine:8338): up
Engine DB Version: 0.0.7
Engine Code Version: 0.2.4
It seems service policy engine is down
Service policy_engine (dockerhostid-anchore-engine, http://anchore-engine:8087): down (unavailable)
I also checked the docker logs . I found below error:
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [DEBUG] service (policy_engine) starting in: 4
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [INFO] Registration complete.
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [INFO] Checking feeds client credentials
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [DEBUG] Initializing a feeds client
[service:policy_engine] 2018-10-15 09:37:47+0000 [-] [bootstrap] [DEBUG] init values: [None, None, None, (), None, None]
[service:policy_engine] 2018-10-15 09:37:47+0000 [-] [bootstrap] [DEBUG] using values: ['https://ancho.re/v1/service/feeds', 'https://ancho.re/oauth/token', 'https://ancho.re/v1/account/users', 'anon#ancho.re', 3, 60]
[service:policy_engine] 2018-10-15 09:37:47+0000 [-] [urllib3.connectionpool] [DEBUG] Starting new HTTPS connection (1): ancho.re
[service:policy_engine] 2018-10-15 09:37:50+0000 [-] [bootstrap] [ERROR] Preflight checks failed with error: HTTPSConnectionPool(host='ancho.re', port=443): Max retries exceeded with url: /v1/account/users/anon#ancho.re (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ffa905f0b90>: Failed to establish a new connection: [Errno 113] No route to host',)). Aborting service startup
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/anchore_manager/cli/service.py", line 158, in startup_service
raise Exception("process exited: " + str(rc))
Exception: process exited: 1
[anchore-policy-engine] [anchore_manager.cli.service/startup_service()] [INFO] service process exited at (Mon Oct 15 09:37:50 2018): process exited: 1
[anchore-policy-engine] [anchore_manager.cli.service/startup_service()] [INFO] exiting service thread
Thanks and Regards,
Rohan Shetty
When images are added to anchore-engine, they are queued for analysis which moves them through a simple state machine that starts with ‘not_analyzed’, goes to ‘analyzing’ and finally ends in either ‘analyzed’ or ‘analysis_failed’. Only when an image has reached ‘analyzed’ will a policy evaluation be possible.
The anchore Jenkins plugin will add an image, then poll the engine for image status/evaluation for the configured number of tries (default 300). Once the image goes to ‘analyzed’ (where policy evaluation is possible), the plugin will then receive a policy evaluation result from the engine.
The plugin will fail the build (by default) if the max retries has been performed and the image has not reached ‘analyzed’, if the image does reach ‘analyzed’ but the policy evaluation is producing a ‘fail’ result (meaning the image didn’t pass your configured policy checks). Note that all build failure behavior can be controlled in the plugin (I.e. there are options to allow the plugin to succeed even if the analysis or image eval fails).
You’ll need to look at the end of the output from your build run (instead of just the beginning from your post), and combined with the information above, it should be clear which scenario is causing the plugin to fail the build.
We have resolved the issue.
Root Cause:
We were not able to establish a successful https connection to URL : https://ancho.re from within the anchore-engine docker container.
As a result the service:policy_engine was not able to start.
https://ancho.re is required to download policy feeds and sync-up periodically. Without these policy anchore-engine won't be able to analyse the docker images.
Solution:
1) We passed a HTTPS_PROXY URL as an environment variable in the docker-compose.yaml of anchore-engine.
We used this proxy URL to bypass restrictions in our environment and establish a connection with https://ancho.re url.
2) Restarted the docker containers.
Finally we got all services up and running including Anchore policy-engine.
FYI:
It takes a while to download all the required Feeds depending on your internet speed.
Lastly, Thanks to the Anchore community for quick responses and support over slack.
Hope this helps.
Warm Regards,
Rohan Shetty

Resources