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
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 need to copy my customized keycloak themes into keycloak container to use it like mention here:
https://medium.com/#auscunningham/change-login-theme-in-keycloak-docker-image-55b5fa5ceec4
After identifying my container id: docker container ls and making a list of files like this: docker exec 7e3a420017a8 ls ./keycloak/themes
It returns the list of themes correctly, but using this to copy my files from local to container:
docker cp ./mycustomthem 7e3a420017a8:/keycloak/themes/
or
docker cp ./mycustomthem 7e3a420017a8:./keycloak/themes/
I get the following error:
Error: No such container:path: 7e3a420017a8:/keycloak
I cannot imagine where the error is, since I can list the files into the folder and container, could you help me?
Thank you in advance.
Works on my computer.
docker cp mycustomthem e67f76e8740b:/opt/jboss/keycloak/themes/raincatcher-theme
You have added the wrong path in command add full path /opt/jboss/keycloak/themes/raincatcher-theme.
This seems like a weird way to approach this problem. Why not just have a Dockerfile that uses the Keycloak container as the base image and then copies the theme into the container at build time? Then just run the image you build? This will also be a more stable pattern in the long term if you ever decide to add any plugins or customizations and it provides an easy upgrade path to new versions by just changing the base image in your Dockerfile.
Update according to your new question update:
Try the following:
docker cp ./mycustomthem 7e3a420017a8:/opt/jboss/keycloak/themes/
The correct path in Keycloak is actually /opt/jboss/keycloak/themes/
I would like to launch two services using docker-compose using the same image passing to the same image two different parameters, with eth and btc values. The jar expects an argument with one of those two values.
The services are demo-quartz-btc and demo-quartz-eth.
When I launch docker-compose, I can see in the log the following messages:
demo-quartz-btc_1 | Error: Unable to access jarfile /opt/app/demo-quartz.jar $CRYPT_TYPE
demo-quartz-eth_1 | Error: Unable to access jarfile /opt/app/demo-quartz.jar $CRYPT_TYPE
This is the link that shows the docker-compose.yml.
This is the link that shows the Dockerfile.
I followed the solution of this link, , but it doesn't work for me. Also I followed the official help, but it does not work.
Docker engine version is 18.09.2, compose version is 1.23.2.
Can someone help me? What do am I doing wrong?
EDIT
I can see in logs that no argument is being applied using docker-compose up. Is there any recommended way to run two services that need another services to run, like zookeeper, kafka, Eureka or others?
EDIT 1
Ok, now I know that I can run a container with the service using a entry-point.sh script file passing the argument to the container. Now, ¿how can I do the same using docker-compose up command?. I need all services/containers running in the same process.
EDIT 2
Do i have to put in script file the necessary docker run -it commands to have everything up and running?
// 31 July 2019 new Dockerfile. I can run this container in isolated mode,
//without kafka,zookeeper and Eureka server.
// I can pass arguments to Dockerfile running the next commands:
// mvn clean package -DskipTests
// docker build -t aironman/demo-quartz .
// docker run -it aironman/demo-quartz:latest eth
// where eth is the argument.
~/D/demo-quartz> cat Dockerfile
FROM adoptopenjdk/openjdk12:latest
ARG JAR_FILE
ARG CRYPT_TYPE
RUN mkdir /opt/app
COPY target/demo-quartz-0.0.2-SNAPSHOT.jar /opt/app/demo-quartz.jar
COPY entry-point.sh /
RUN chmod +x entry-point.sh
ENTRYPOINT ["/entry-point.sh"]
The solution is to have two Dockerfile files, each with an entry-point.sh file, each with the parameters you need. I realize that I have to adapt to the way Docker/Kubernetes wants you to work and not the other way around.
I want to copy the my.cnf file present in the host server to child docker image wherever I run docker file that uses a custom base image having below command.
ONBUILD ADD locate -i my.cnf|grep -ioh 'my.cnf'|head -1 /
but above line is breaking docker file. Please share correct syntax or alternatives to achieve the same.
Unfortunately, you can't declare host commands inside your Dockerfile. See Execute command on host during docker build
.
Your best bet is probably to tweak your deployment scripts to locate my.cnf on the host before running docker build.
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.