I have the below code to build an image
docker build -t provisioner-builder:latest -f images/provisioner/Dockerfile.builder .
Right after this build command I have this line
docker run provisioner-builder:latest /bin/true
The docker run command always throws this error in jenkins
06:23:44 Successfully tagged provisioner-builder:latest
06:23:44 docker run provisioner-builder:latest /bin/true
06:23:45 docker: Error response from daemon: Error response from daemon: pull access denied for provisioner-builder, repository does not exist or may require 'docker login'.
06:23:45 See 'docker run --help'.
SO out of 15 runs in jenkins, the above step fails at-least 10-11 times. I get lucky very rarely. I am not trying to pull image as the image is already present in local [I tested by doing a docker images right after the build command and the image was locally present].
I dont understand why this command fails most of the times.
Related
I am having trouble creating a lambda .zip file in docker. I have followed a few tutorials but to no avail. I keep getting this error when running my .sh file
Unable to find image 'google_analytics_layer:latest' locally
docker: Error response from daemon: pull access denied for google_analytics_layer, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
no such directory
Error: No such container: lambda_run
Error: No such container:path: lambda_run:/python.zip
Error response from daemon: No such container: lambda_run
Error: No such container: lambda_run
docker: invalid reference format.
See 'docker run --help'.
no such directory
Error: No such container: lambda_run
Error: No such container:path: lambda_run:/python.zip
Error response from daemon: No such container: lambda_run
Error: No such container: lambda_run
Here is the code that I'm running
container_name=lambda_run
docker_image=google_analytics_layer
docker run -td --name $container_name $docker_image
docker cp ./requirements.txt $container_name:/
docker exec -i $container_name /bin/bash < ./docker_install.sh
docker cp $container_name:/python.zip python.zip
docker stop $container_name
docker rm $container_name
and this is the tutorial that I followed: https://www.youtube.com/watch?v=jXjMrWCpaI8
As with any list of steps, when one step depends on another you need to stop if there's an error. Your error is in the first step. You need to locate the image google_analytics_layer that you are looking for.
The script you are trying to run is clearly labelled runner.sh in the tutorial. It's to help you run the docker image. You need to create it before you can run it.
To create it:
docker build . -t google_analytics_layer
I have been working through the docker book and I am now learning about CI. I tried to run this script within the execute shell of my build:
# Build the image to be used for this job.
IMAGE=$(sudo docker build . | tail -1 | awk '{ print $NF }')
# Build the directory to be mounted into Docker.
MNT="$WORKSPACE/.."
# Execute the build inside Docker.
CONTAINER=$(sudo docker run -d -v $MNT:/opt/project/ $IMAGE /bin/ bash -c 'cd /opt/project/workspace; rake spec')
# Attach to the container so that we can see the output.
sudo docker attach $CONTAINER
# Get its exit code as soon as the container stops.
RC=$(sudo docker wait $CONTAINER)
# Delete the container we've just used.
sudo docker rm $CONTAINER
# Exit with the same value as that with which the process exited.
exit $RC
Running this script ends in the build failing. It shows these two errors:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
and
sudo docker run -d -v /private/var/jenkins_home/jobs/${Docker_test_job}/workspace/..:/opt/project/ /bin/ bash -c cd /opt/project/workspace; rake spec
docker: invalid reference format.
See 'docker run --help'.
+ CONTAINER=
Build step 'Execute shell' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE
I don't understand how to fix it as I've been following the instructions in the book. I tried using $PWD to try and fix my issue but that didn't work either.
Actaully the jenkins user does not have the permission to run docker command. To do this, add your jenkins user to the docker group:
sudo usermod -aG docker jenkins
Then restart your jenkins server to refresh the group.
Please be informed that ther is a warning "The docker group grants privileges equivalent to the root user. For details on how this impacts security in your system."
I am trying to build a new docker image.
docker build . -t tg
.....
.....
Removing intermediate container ba85d1deadeb
---> 353fcb84af6b
Successfully built 353fcb84af6b
Successfully tagged tg:latest
But for some reason, after it is successfully built I could neither run it nor find it.
docker images
<none> <none> c18e928477c3 11 days ago 1.01GB
...... a long list of unrelated images that are intermediate steps of the built process .....
docker image ls , docker images -a aren't helping either.
sudo docker run -i -t 353fcb84af6b
Unable to find image '353fcb84af6b:latest' locally
docker: Error response from daemon: pull access denied for 353fcb84af6b, repository does not exist or may require 'docker login'.
See 'docker run --help'.
when running docker run -i -t tg:latest result is the same.
The issue seems to be specific to THIS particular image... Other successfully built images DO show up after running docker images.
Dockerfile
Any pointers are much appreciated.
On linux
try:
docker buildx build --progress=plain --load .
1- In order to run docker commands, use sudo user.
WHY -> The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo.
Get your images build with sudo docker build -t tag_name --no-cache .
To see the images - sudo docker images
Also, you cannot use tag with image ID - Unable to find image '353fcb84af6b:latest' locally
In order to run your image, you can either use JUST image ID or image_name:tag.
Docker run centos6 command fails with error :-
docker run docker.io/treasureboat/centos6
"docker: Error response from daemon: No command specified"
As mentioned in the comments, this image doesn't set a CMD, so you need to specify something for docker to execute:
docker run docker.io/treasureboat/centos6 /bin/bash
Trying to follow the tutorial "Using TensorFlow Serving via Docker": https://tensorflow.github.io/serving/docker
I'm getting the error below:
$ docker build --pull -t $USER/tensorflow-serving-devel -f Dockerfile.devel .
ERRO[1791] Can't add file /Users/bone/.docker/machine/machines/testD/disk.vmdk to tar: archive/tar: write too long
Sending build context to Docker daemon 194.3 GB
Error response from daemon: Untar re-exec error: exit status 1: output: write /.docker/machine/machines/default/disk.vmdk: no space left on device
The mistake was running this command on the command line outside the docker machine. Once this command was run inside the docker machine, it worked fine.