Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker build failed #333

Open
ardahuseyinoglu opened this issue Jul 10, 2023 · 4 comments
Open

docker build failed #333

ardahuseyinoglu opened this issue Jul 10, 2023 · 4 comments

Comments

@ardahuseyinoglu
Copy link

I used the following command to create a docker image:
docker build -t x-tech-radar .

However I am getting the following error:

=> ERROR [ 4/10] RUN apt-get install -y nodejs                                                                                                                                           0.3s 
------
 > [ 4/10] RUN apt-get install -y nodejs:
0.322 Reading package lists...
0.329 Building dependency tree...
0.329 Reading state information...
0.331 E: Unable to locate package nodejs
------
Dockerfile:6
--------------------
   4 |
   5 |     RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
   6 | >>> RUN apt-get install -y nodejs
   7 |
   8 |     RUN                                                                       \
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get install -y nodejs" did not complete successfully: exit code: 100

Thank you in advance for your help!

@devansh-sharma-tw
Copy link
Contributor

Hi @ardahuseyinoglu , could you please share the entire output of the docker command as well ?

Thanks!

@ardahuseyinoglu
Copy link
Author

PS C:\Users\Hueseyinoglu\projects\tech-radar\xaas_tech_radar> docker build -t xaas-tech-radar .
[+] Building 5.3s (9/15)                                                                                                                                                                          docker:default 
 => [internal] load .dockerignore                                                                                                                                                                           0.1s 
 => => transferring context: 239B                                                                                                                                                                           0.1s 
 => [internal] load build definition from Dockerfile                                                                                                                                                        0.1s 
 => => transferring dockerfile: 779B                                                                                                                                                                        0.0s 
 => [internal] load metadata for docker.io/library/nginx:1.23.0                                                                                                                                             4.7s 
 => [auth] library/nginx:pull token for registry-1.docker.io                                                                                                                                                0.0s 
 => [ 1/10] FROM docker.io/library/nginx:1.23.0@sha256:db345982a2f2a4257c6f699a499feb1d79451a1305e8022f16456ddc3ad6b94c                                                                                     0.0s 
 => [internal] load build context                                                                                                                                                                           0.1s 
 => => transferring context: 10.53kB                                                                                                                                                                        0.1s 
 => CACHED [ 2/10] RUN apt-get update && apt-get upgrade -y                                                                                                                                                 0.0s 
 => CACHED [ 3/10] RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -                                                                                                                            0.0s 
 => ERROR [ 4/10] RUN apt-get install -y nodejs                                                                                                                                                             0.4s 
------
 > [ 4/10] RUN apt-get install -y nodejs:
0.353 Reading package lists...
0.361 Building dependency tree...
0.362 Reading state information...
0.364 E: Unable to locate package nodejs
------
Dockerfile:6
--------------------
   4 |     
   5 |     RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
   6 | >>> RUN apt-get install -y nodejs
   7 |     
   8 |     RUN                                                                       \
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get install -y nodejs" did not complete successfully: exit code: 100

@ardahuseyinoglu
Copy link
Author

ardahuseyinoglu commented Jul 12, 2023

Hi,
I don't know how much of an impact it had on the solution, but I wanted to mention it anyway. On the computer where I got the error above, I had installed WSL2 Ubuntu to install docker. On another computer, I installed Debian (I don't think there has been any other change). This time the image is built successfully -I think- as you can see below.

But when I try to run it, I started to get this strange error:

image

And also I tried to changed the Dockerfile as follows:

FROM wwwthoughtworks/build-your-own-radar:v1.1.2

WORKDIR /src/build-your-own-radar
COPY . ./

ENTRYPOINT []
CMD ["./build_and_start_nginx.sh"]

However, I keep getting the same error as above:
exec ./build_and_start_nginx.sh: no such file or directory

But "build_and_start_nginx.sh" exists under /src/build-your-own-radar:

image

Thank you in advance for your help!

@devansh-sharma-tw
Copy link
Contributor

Hi @ardahuseyinoglu , thanks for the details!

This does seem to be quite weird. I've tried creating the image again in my local using our usual Dockerfile and with the Dockerfile you have shared (using our BYOR image as base). In both cases, I'm not able to replicate your error (on a local colima setup).

Just to cover all cases, can you share what docker version you are using and make sure you have the latest code pulled in your local ?
Also, maybe can you try running an ls -l or a cat before the CMD just to make sure all the files are present at build time (your screenshot from Docker Desktop does confirm it, but just in case :)) ?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants