I am just getting started with Prometheus and I may be doing something wrong, but I am getting the following error when trying to build the blackbox_exporter (https://github.com/prometheus/blackbox_exporter) image with:
docker build -t blackbox_exporter .
Error being:
Step 3 : COPY blackbox_exporter /bin/blackbox_exporter
lstat blackbox_exporter: no such file or directory
When I edit the Dockerfile and update it to:
COPY . /bin/blackbox_exporter
Then it builds properly. Any ideas?
Thanks in advance.
David
Looking at the Makefile for that project, the docker image build happens after the application is built by promu. The container is designed to be a minimal environment of busybox and the application binary that you first create outside of docker.
Related
I ran normally from the docker hub to running the image.
But I'm having trouble executing 'build' command.
There appears to be a path problem, but any path given in the current working directory cannot be resolved. Can you give me any advice here?
(I am in wsl2 - ubuntu 20.04)
You don't need to pass the file name to build command, if the file name is Dockerfile just pass the context. use this instead:
docker build -t python-test .
I am using Windows 10 machine and new to docker technology.
I prepared the Dockerfile.txt file and kept inside the DockerFiles folder in local system.
and executed the below command.
docker build -t my-r-image .
But it is not able to read.
Can anyone please help?
The name is also correct.
Any suggestion will be highly appreciated.
Make sure your dockerfile has the same name as the one shown in your terminal, example:
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount320670870/Dockerfile: no such file or directory
The dockerfile needs no extension, in Windows, you can create it with notepad++ and save it as "all types (.)"
You can try typing the full path of your dockerfile:
docker build -t X:X O:\Users\yyy\XX
I'm new to Docker and I'm trying to run a dockerfile locally on my machine to make sure everything is working correctly before uploading it to GitHub and trying it out on another server. Is there a way to do that? I've installed the Docker for Windows 10 and I'm able to navigate to the folder in which the dockerfile exist. When I try to execute the '''docker build -t file_name -f file_name''' I get an error.
I've already downloaded Docker and able to access things correctly. I've tried
'''docker build''' but that doesn't seem to work.
I'm expecting for the dockerfile to run and build successfully. Instead it just errors out during build.
The error has already told you all things:
invalid argument "Dockerfile" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
You could change command to next to have a try:
docker build -t abc -f Dockerfile .
Above, abc is the repo name you tagged for your new image, it should be lowercase as said from the error, meanwhile, the last . need to be added as it will specify the build context.
Example reference to this.
I am trying to build a custom nginx docker image, where I want to overwrite the default.conf file at /etc/nginx/conf.d/default.conf.
Following is the code of Dockerfile:
FROM nginx
COPY default.conf /etc/nginx/conf.d/default.conf
But while building the image, I am getting following error:
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM nginx
# Executing 1 build trigger
COPY failed: stat /var/lib/docker/tmp/docker-builder221277665/public: no such file or directory
As per the logs, it is failing on the first instruction. And it is pointing to the public folder.
Please help me understanding the problem as why it could be pointing to the public folder? Any pointers would be highly appreciated.
Thank you!
As David hinted in the comments, this command looks like it came from an ONBUILD instruction from the base image. Since nginx doesn't ship with that command, this points to another image on the host that was tagged as nginx. Pulling a fresh copy of nginx from upstream can fix that:
docker pull nginx
Do you have a .dockerignore file which ignores the public folder?
The docs are not very clear to me. I run docker build -f . in the Dockerfile directory, it seems to build successfully, great. I am not sure what to do next, I take a look at the docs https://docs.docker.com/engine/reference/builder/ it tells me When you’re done with your build, you’re ready to look into Pushing a repository to its registry.
Which takes me here https://docs.docker.com/engine/userguide/containers/dockerrepos/#contributing-to-docker-hub I have no interest in publishing it or creating an account.
My other option is to name the build I guess, right? If I run docker build -t <nodebb> . then I get file exists: .. If I run docker build -f <nodebb> . then I get no such file or directory: nodebb.
So I am kind of lost, I wish I could understand the Docs better but I don't and would appreciate the guidance. Thanks!
Your issue with tagging: You cannot use <> in tags
The error that you saw was because '<' and '>' are interpreted by bash. docker build -t <nodebb> . tries to do the following:
It reads the file nodebb and pipes it into docker build -t.
It takes the output of docker build -t < nodebb and writes it to the file .
This fails for several reasons:
-t expects an argument, the tag name
the file . already exists (that's the error you saw)
Generally, you can avoid this by escaping the argument:
docker build -t "<nodebb>" .
However, this will result in another error:
Error parsing reference: "<nodebb>" is not a valid repository/tag
For good reasons, <> are not allowed in tag names. Instead, use a valid tag:
docker build -t nodebb .
Running an image without a tag
You can also run a built image without a tag; if you build an image, the last line will always be something like this:
Successfully built 028edf7c13d1
You can run that image with docker run 028edf7c13d1.