cURL command is executing without arguments inside docker container - docker

curl: try 'curl --help' or 'curl --manual' for more information
getting the above error in docker build.
Dockerfile:
FROM curlimages/curl:7.86.0
want to setup cURL inside docker container.

How to you run docker build?
# from the directory containing Dockerfile
docker build -t mycurl .
Sending build context to Docker daemon 2.048kB
Step 1/1 : FROM curlimages/curl:7.86.0
7.86.0: Pulling from curlimages/curl
213ec9aee27d: Already exists
e9574dad2c34: Pull complete
a2377c20b9b6: Pull complete
d5ee1ea5a035: Pull complete
674a88369049: Pull complete
a5f4f3bb1686: Pull complete
d097d2aac947: Pull complete
4a3b312c75a7: Pull complete
3dc9c808db58: Pull complete
baca2edfad05: Pull complete
e3359ad5ca0a: Pull complete
Digest: sha256:cfdeba7f88bb85f6c87f2ec9135115b523a1c24943976a61fbf59c4f2eafd78e
Status: Downloaded newer image for curlimages/curl:7.86.0
---> ab35d809acc4
Successfully built ab35d809acc4
Successfully tagged mycurl:latest
Then, you can use it just as you would with curl binary:
docker run -ti mycurl https://www.stackoverflow.com

Related

Docker : "error pulling image configuration: unknown blob"

OS: Linux Ubuntu
Version: 19.10
Docker Version: 19.03.6, build 369ce74a3c
I created a simple docker file like below:
FROM busybox:latest
CMD echo Hello World
After that, I run the following command to build the docker file:
docker build
-t rshtishi/hello-world-dockerfile
-f HelloWorld.df
.
Then I published in my account on DockerHub:
docker push rshtishi/hello-world-dockerfile
All the steps above completed successfully. After delete the rshtishi/hello-world-dockerfile images locally I couldn't pull the image from dockerhub.
When I run the pull command I got the error below:
Using default tag: latest
latest: Pulling from rshtishi/hello-world-dockerfile
61c5ed1cbdf8: Already exists
error pulling image configuration: unknown blob

Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running? in docker push via Gitlab CI

In Gitlab CI, when I want to push my image, I get:
Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?
Here is the code:
docker-push:
stage: publish
image: docker:stable
services:
- docker:dind
before_script:
- *inject-gopath
- docker login -u gitlab-ci-token -p $GITLAB_PERSONAL_ACCESS_TOKEN $REGISTRY_URL
# $CI_BUILD_TOKEN
script:
- docker build --build-arg GITLAB_TOKEN=${GITLAB_PERSONAL_ACCESS_TOKEN} --target=prod -t $REGISTRY_PACKAGE_API_NAME:$CI_BUILD_ID .
- docker build --build-arg GITLAB_TOKEN=${GITLAB_PERSONAL_ACCESS_TOKEN} --target=prod -t $REGISTRY_PACKAGE_API_NAME:latest .
- docker push $REGISTRY_PACKAGE_API_NAME:$CI_BUILD_ID
- docker push $REGISTRY_PACKAGE_API_NAME:latest
Here is the output:
Pulling docker image docker:stable ...
Using docker image sha256:23fb2c9b38b59433ea1913eafa12d2e15651ca0d08819dc7067d27d8f92e0428 for docker:stable ...
Running on runner-wmKFtEwx-project-7124308-concurrent-0 via ubuntu...
Fetching changes...
Removing release/
HEAD is now at 9c4894a Merge branch '5-supprimer-les-threads' into 'master'
Checking out 9c4894af as master...
Skipping Git submodules setup
Downloading artifacts for build (324707453)...
Downloading artifacts from coordinator... ok id=324707453 responseStatus=200 OK token=SVLY__Jy
$ mkdir -p $(dirname ${PACKAGE_PATH}) && ln -s ${CI_PROJECT_DIR} ${PACKAGE_PATH} && cd ${PACKAGE_PATH}
$ docker login -u gitlab-ci-token -p $GITLAB_PERSONAL_ACCESS_TOKEN $REGISTRY_URL
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
$ docker build --build-arg GITLAB_TOKEN=${GITLAB_PERSONAL_ACCESS_TOKEN} --target=prod -t $REGISTRY_PACKAGE_API_NAME:$CI_BUILD_ID .
Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?
ERROR: Job failed: exit code 1
Weird thing is that I am in the image docker-stable, so I should have docker available, and previous step docker login is working well...
Is it a bug from Gitlab, or something I am doing wrong ?
PD: I am using Gitlab.com
PD2: I can push the image manually without any issue
As per comment it is just a GitLab problem.
There is no guarantee, with a free runner, that it will always work. In this case the docker deamon is not available so your build will keep failing until the runner is restarted when GitLab detects the error.
Notice this is my assumption given that often the error comes and then after a few hours it is gone. As you can see also my Gitlab Forums Thread received no reply from anyone so I am afraid I dont think you will be able to fix this. If mission critical then run your own runner so you can restart it on failure

What is the difference between docker run and docker pull

I am new to Docker. Can anyone help me in understanding the difference between
docker run img_name & docker pull img_name?
Do they work the same?
docker pull pulls an image or a repository from a registry.
docker run runs a command in a new container.
They don't work the same, however, if you use docker run with an image that you haven't pulled yet, docker run will call docker pull:
$ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world#sha256:6f744a2005b12a704d2608d8070a494ad1145636eeb74a570c56b94d94ccdbfc
Deleted: sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e
Deleted: sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:6f744a2005b12a704d2608d8070a494ad1145636eeb74a570c56b94d94ccdbfc
Status: Downloaded newer image for hello-world:latest
…
Please see docker help pull and docker help run for more information.

Image is successfully built, but not shown in "docker images" results

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.

Pull access denied in docker run command

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.

Resources