gradle bootBuildImage task failing - docker

build is success in local but the bootbuildimage task is failing with below error.
Task :bootBuildImage
Building image 'docker.io/library/ttk-api:1.1'
Pulling builder image 'docker.io/paketobuildpacks/builder:base' ..................................................
Task :bootBuildImage FAILED
Execution failed for task ':bootBuildImage'.
Connection to the Docker daemon at 'localhost' failed with error "\.\pipe\docker_engine"; ensure the Docker daemon is running and accessible

Related

Error: docker build failed: docker build is disabled

i am running one command on ubuntu terminal i.e:
kubectl hlf chaincode install --path=./chaincode --config=networkConfig.yaml --language=golang --label=supply --user=admin --peer=org1-peer1.fabric
But i am getting error
Error: Transaction processing for endorser [128.199.29.209:30906]: Chaincode status Code: (500) UNKNOWN. Description: failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker build is disabled
how should i enable docker build?

I am learning DevOps basic steps and my task was create CICD Pipeline using jenkins and Docker on Maven Project From Repository

Error
It shows me error that docker daemon might not be running
[INFO] ------------------------------------------------------------------------
[CICD-Maven-Jenkins-Docker-Integration] $ docker build -t imdhruv28/cicd-docker-jenkins-integration --pull=true /var/lib/jenkins/workspace/CICD-Maven-Jenkins-Docker-Integration
time="2020-03-24T14:27:15+05:30" level=error msg="failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial unix /var/run/docker.sock: connect: permission denied"
error during connect: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&pull=1&rm=1&session=3maudqn4r7n8md6azfdxz34vb&shmsize=0&t=imdhruv28%2Fcicd-docker-jenkins-integration&target=&ulimits=null&version=1: context canceled
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE
Dockerfile
FROM openjdk:8
EXPOSE 8081
ADD target/CICD-Docker-Jenkins-Integration.jar CICD-Docker-Jenkins-Integration.jar
ENTRYPOINT ["java", "-jar", "/CICD-Docker-Jenkins-Integration.jar"]
can any one will help me to solve this?
There are 2 possible options here:
Docker daemon is indeed not running
The user executing your pipeline is not added to docker group
Algorithm to debug would be to first check manually if Docker is actually running, second verify which user is used by Jenkins to execute the pipeline (add whoami to the pipeline to print), finally make sure that that user is added to docker group.

The parameter URL was not updated after changing config.toml in gitlab-runner container

I'm trying to configure and execute GitLab CI jobs, that is why I have two Docker containers:
gitlab/gitlab-runner:latest
-gitlab/gitlab-ce:latest
Now every gitlab CI build fails with the error:
Running with gitlab-runner 12.3.0 (a8a019e0) on sonar-runner rRZ6XQ2Y
Using Docker executor with image alpine:latest ...
Pulling docker image alpine:latest ...
Using docker image sha256:cc0abc535e36a7e for alpine:latest ...
Running on runner-rRZ6XQ2Y-project-2-concurrent-0 via pc-user...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/root/sonar-gitlab-kotlin/.git/
fatal: unable to access 'http://gitlab-ci-token:[MASKED]#localhost/root/sonar-gitlab-kotlin.git/': Failed to connect to localhost port 80: Connection refused Reinitialized existing Git repository in /builds/root/sonar-gitlab-kotlin/.git/
In order to fix the problem
I've changed parameter URL in /etc/gitlab-runner/config.toml
Inside of gitlab-cunner container: root#pc-user:/# gitlab-runner restart
$ docker restart gitlab-runner
so now I have:
root#pc-user:/# gitlab-runner list
Runtime platform arch=amd64 os=linux pid=45 revision=a8a019e0 version=12.3.0
Listing configured runners ConfigFile=/etc/gitlab-runner/config.toml
sonar-runner Executor=docker Token=rRZ6XQ2YWXxxxxxxx URL=http://192.168.74.12/
However, I'm still getting the error:
fatal: unable to access 'http://gitlab-ci-token:[MASKED]#**localhost**/root/sonar-gitlab-kotlin.git/': Failed to connect to localhost port 80: Connection refused
But I expected to have
http://gitlab-ci-token:[MASKED]#**192.168.74.12**/root/sonar-gitlab-kotlin.git/
Could you please clarify: I'm wrong with my expectation or the parameter should changed.

Jenkins stage Docker OCI runtime failure

I am using a Jenkinsfile to build an application and deploy via Ansible while using a Docker image for its build agent within the Jenkinsfile. Upon a safe restart of Jenkins, I am now seeing my Jenkins jobs failing for the following error that previously never appeared. Nothing has changed in the Jenkinsfile or in the configuration and there is no config.json in the project I am building so I am unsure where this is arising from.
Running shell script
OCI runtime exec failed: exec failed: container_linux.go:348: starting
container process caused "chdir to cwd (\"/opt/software/jenkins/workspace/Engineering-develop#3\") set in config.json failed: no such file or directory": unknown
process apparently never started in /opt/software/jenkins/workspace/Engineering-develop#3/durable-38313533

Failure - Authentication is required to pull public docker images from Dockerhub registry

I am using Jenkins Custom Build Environment Plugin (1.6.5) to build images from a Dockerfile inside the slave container checked in along with the source code.
Slaves running on Docker version 1.9.1, build ab77bde/1.9.1
My Dockerfile is as below which is able to pull from official ubuntu image but fails to pull from official node.js image -
FROM node:boron
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
On Jenkins job execution I get below failure -
$ docker build --file /data/name-jenkins/workspace/TestJobs/BuildFromSCM/Dockerfile /data/name-jenkins/workspace/TestJobs/BuildFromSCM
Sending build context to Docker daemon 149.5 kB
Sending build context to Docker daemon 149.5 kB
Step 1 : FROM node:boron
Trying to pull repository registry.access.redhat.com/node ... failed
Trying to pull repository docker.io/library/node ... failed
Authentication is required.
FATAL: Failed to build docker image from project Dockerfile
java.lang.RuntimeException: Failed to build docker image from project Dockerfile
at com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:134)
at com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:46)
at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:169)
at hudson.model.Build$BuildExecution.doRun(Build.java:156)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
I am able to build the Docker image on my local machine though. I confirmed that the Jenkins slave user has sudo permissions.
I found an issue in .docker/config.json on my slave machine where I accidentally set my dockerhub credentials which caused in failure in pulling public images with a generic user I was using to build Jenkins job.
{
"ServerURL": "https://index.docker.io/v1",
"Username": "myusername",
"Secret": "passw0rd1"
}
You may need a certificate of the docker-hub, which is a ca.crt file put in:
/etc/docker/certs.d/

Resources