ramakumar
(Ramakumar)
September 22, 2015, 9:50am
1
HI,
I am trying to execute the Docker build command in my Docker VM. Below is the command I have executed for Docker,
Docker build -t Dockerfile.txt .
I am noticing this error when I execute the above command in VM console.
"Uanle to prepare the context: Cannot locate Dockerfile: "absDockerfile : “/home/docker/sample/Dockerfile”
Let me know how to resolve this issue.
Regards,
Ramakumar
ranjandas
(Ranjandas)
September 22, 2015, 9:55am
2
Hi,
Just rename Dockerfile.txt to Dockerfile and rerun the build command.
Regards
ramakumar
(Ramakumar)
September 22, 2015, 10:10am
3
Thanks for quick response Ranjan.
As you suggested, I have changed the filename and rerun the build command.
Now I am getting different error in build command. Below are the details when I execute the build command.
Error is: repository name component must match "[a-z0-9] + (?: [ . _-][ a-z0-9] + ) * "
Regards,
Ramakumar
ameyrk
(Ameyrk)
September 22, 2015, 10:25am
4
Could you please share your docker file ?
ramakumar
(Ramakumar)
September 22, 2015, 10:35am
5
Hi,
Below is the content of the Dockerfile
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:webupd8team/java -y
RUN apt-get update
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
RUN apt-get install oracle-java8-installer -y
RUN apt-get install oracle-java8-set-default
Regards
duminda
(Duminda)
September 22, 2015, 11:46am
6
Hi
move Dockerfile and related files to new location and build the image again from new location
ramakumar
(Ramakumar)
September 22, 2015, 12:06pm
7
Hi
I have only Dockerfile to run the build command. I do not have any other files with me.
Please suggest.
ranjandas
(Ranjandas)
September 22, 2015, 12:11pm
8
Ah , Forgot to mention. There is one more error in your command. You havent given the tag name.
Just try the blow command. Replace myimagename
with the name for your image you are planning to give.
docker build -t myimagename .
Also make it a practice to go through the commands help to get details about each option that is being passed to the command like shown below.
docker build --help
Regards
ramakumar
(Ramakumar)
September 22, 2015, 12:20pm
9
Ranjan
I have modified the command and its working fine now.
Thank you for your guidance.
Regards
duminda
(Duminda)
September 22, 2015, 2:39pm
10
This command also should work
docker build -t Dockerfile.txt .
here image name is Dockerfile.txt
can you post the modified command ?
ameyrk
(Ameyrk)
September 22, 2015, 2:45pm
11
Yes the command will work. Please use a precise name for your image. For eamples apache, ubuntu etc.
Please follow the below guidelines
docker build -t ${IMAGE_NAME} .
the . (dot) specifies your Dockerfile is in the current directory.
${IMAGE_NAME} image name can be like apache:0.1 where 0.1 is the version number.
-t refers the current user is the owner of the image
Thanks,
Amey
ranjandas
(Ranjandas)
September 22, 2015, 10:58pm
12
Hi,
Docker build wont accept image name with uppercase letters. Thats the error he faced here Issue in Docker build command
$docker build -t Dockerfile.txt .
repository name component must match "[a-z0-9]+(?:[._-][a-z0-9]+)*"
Regards
ramakumar
(Ramakumar)
September 23, 2015, 11:05am
13
Hi Duminda,
Below is the modified command to build the image
docker build -t myjavaimage .
Regards
ramakumar
(Ramakumar)
September 23, 2015, 11:30am
14
Thanks for your inputs Amey.
Regards