Docker Community Forums

Share and learn in the Docker community.

Error while executing build command


(Ramakumar) #1

Hi

I am trying to execute the build command to create an Image. Below is the command I ma trying to execute

docker build -t sampleimage:0.1 .

But when I execute this command I am getting below error message,

repository name component name must match "[a-z0-9]+(?:[._-][a-z0-9]+) *

Below are the contents of my dockerfile.

FROM Ubuntu:14.04
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update
RUN apt-get install oracle-java7-installer

Let me know what is the issue in contents of dockerfile or build commands to resolve this issue?


(Jeff Anderson) #2

Hello,

Your Dockerfile has a capitol U in ubuntu. Image names are all lower case, and having a capitol letter makes the image name fail the regex check.

Change:

FROM Ubuntu:14.04

to:

FROM ubuntu:14.04

and you should be good.

/Jeff


(Ramakumar) #3

Jeff,

Thanks for your response.

Dockerfile content seems to be fine. No issues. I have verified the dockerfile contents. ubuntu is in lower case only. ‘U’ is not in uppercase.

What would be the other possible reason for this issue?

Ramakumar


(Fauzan Ariffin) #4

Hi @ramakumar,

You should omit the :0.1 from your command.
The correct build command is docker build -t sampleimage .


(Ramakumar) #5

Hi @fauzanariffin

I have tried like that as well. Same problem persists. Same error message was displayed.

Not sure what would be the root cause for this issue.

Thanks,
Ramakumar


(Ranjandas) #6

Hi,

Just to understand how the tag sampleimage:0.1 is wrong? I am able to successfully build an image with this tag.

Regards


(Ramakumar) #7

Hi Ranjan,

I am not saying tag sampleimage:0.1 is wrong. But as suggested by fauza I have tried removing the version number(0.1) from the command but still it is giving the same error. So having version number as suffix in the image name is not an issue. Issue was some where else which I could not figure it out.

Do you think issue is with content of the dockerfile?

Thanks,
Ramakumar


(Ranjandas) #8

Hi,

To make things clear can you copy and paste the exact contents of the Dockerfile and the build command here or at http://paste.ubuntu.com/ and share us the link. So that we can finalise where the exact issue is. I believe @programmerq is write, because your build command seems to be fine.

Regards


(Ramakumar) #9

Hi Ranjan,

Below is the content of the docker file.

FROM ubuntu:14.04
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update
RUN apt-get install oracle-java7-installer

Below is the command I am using to build the image

docker build -t sampleimage:0.1 .

Thanks,
Ramakumar


(Ranjandas) #10

Hi,

I ran docker build based on your Dockerfile and build command and I am getting a different error which can be easily fixed.

docker build -t sampleimage:0.1 .
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM ubuntu:14.04
 ---> 91e54dfb1179
Step 1 : RUN add-apt-repository ppa:webupd8team/java
 ---> Running in b247f6f2746a
/bin/sh: 1: add-apt-repository: not found
The command '/bin/sh -c add-apt-repository ppa:webupd8team/java' returned a non-zero code: 127

I dont find any reason for you to get the error you mentioned in the first post. The only other reason for error I can imagine is , as you are working on Windows may be there are some non-printable characters in your Dockerfile. This is a wild guess, I am not sure. To rule out that can you create a fresh Dockerfile and test it.

Regards


(Ramakumar) #11

Ok Ranjan. Thanks for update. I will try with new dockerfile and test it again. Let you know the status.

Thanks,
Ramakumar


(Ramakumar) #12

Hi Ranjan,

I have tried with new dockerfile with same content. Now I am noticing different error which is similar to the error you posted in your response above. Your guess is correct.

With new Dockerfile below is the error observed in my docker environment

docker build -t sampleimage:0.1 .

Sending build context to Docker daemon 2.048 kB
Step 0 : FROM ubuntu:14.04
—> 91e54dfb1179
Step 1 : RUN add-apt-repository ppa:webupd8team/java
—> Running in e1c2c8a41069
/bin/sh: 1: add-apt-repository: not found
The command ‘/bin/sh -c add-apt-repository ppa:webupd8team/java’ returned a non-zero code: 127

Thanks,
Ramakumar


(Ranjandas) #13

Wow, great news. Glad to know that it fixed your issue. The present issue you can fix by installing software-properties-common using apt-get before using add-apt-respository.

apt-get install software-properties-common

Can you please mark the answer as solution if possible.

Regards.


(Jeff Anderson) #14

Hello,

Your original message had the U uppercase. If I take the following Dockerfile:

FROM Ubuntu:14.04

on my system, and build it with:

docker build -t sampleimage:0.1 .

I get the exact error message you mentioned in your original post:

unable to process Dockerfile: unable to parse repository info: repository name component must match "[a-z0-9]+(?:[._-][a-z0-9]+)*"

If I change FROM Ubuntu:14.04 to FROM ubuntu:14.04, the message goes away:

FROM ubuntu:14.04

$ docker build -t sampleimage:0.1 .
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM ubuntu:14.04
 ---> 91e54dfb1179
Successfully built 91e54dfb1179

If I try to build your revised docker image, I get past the FROM step, but I get another error message for another reason:

FROM ubuntu:14.04
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update
RUN apt-get install oracle-java7-installer

$ docker build -t sampleimage:0.1 .
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM ubuntu:14.04
 ---> 91e54dfb1179
Step 1 : RUN add-apt-repository ppa:webupd8team/java
 ---> Running in 54b5d30ab9c9
/bin/sh: 1: add-apt-repository: not found
The command '/bin/sh -c add-apt-repository ppa:webupd8team/java' returned a non-zero code: 127

This failure is happening because the package that provides the add-apt-repository command isn’t in the ubuntu:14.04 image by default.

/Jeff


(Ranjandas) #15

Hi Jeff,

It looks like his Dockerfile had some erroneous invisible characters :-). Same Dockerfile steps in a fresh file fixed his issue .

Regards


(Ramakumar) #16

Hi Ranjan,

Thanks for the info shared.

I have tried this option ( apt-get install software-properties-common) and executed the build command with latest include. I have noticed some other error with stacktrace details in VM console. But I could not get all the error details due to window size. Can you tell me whether these stacktrace will be directed to any of the Docker log files in C drive? If yes, where can we find the stacktrace details?

I have tried to find out the Docker log files in this folder location
( C:\Users\xyz.docker\machine\machines\default\default\Logs) . But no luck. Could not find error details. Probably this is not the correct log file to verify the docker logs.

Would you please suggest me where can I find the correct log files to verify the build command output?

Thanks,
Ramakumar


(Ranjandas) #17

Hi,

Possibly you are describing about a boot2docker vm kernel crash :open_mouth:. Do you have any screenshot to share? Also can you reboot the VM and try your build command again.

Regards


(Ramakumar) #18

Thanks for your support Ranjan.
Yes, I am referring boot2docker vm kernel.

I have rebooted the VM and executed the build command again. Still the same problem persists.
I could not take the screen shot of the window.
Would you provide me the log file details to see the build error details?

Thanks,
Ramakumar