nitrictech/nitric

Bug: Cannot build image on local docker engine using colima

Closed this issue ยท 6 comments

Bug Report

Issue

I just try to make backend api using NestJs application. With the simple api, then i try to run the nitric and it's work perfectly. However when i try to run the nitric locally with nitric run then it's fail while building the image. Then also i try the nitric up also had the same problems.

Anyway i don't use docker desktop on mac macbook air m1. I just use docker with minimal setup with colima. also i have installed another docker plugins like compose and buildx.

From the docs, i already install

  • GIt
  • Docker
  • Pulumi

Steps

Steps to reproduce the behavior:

  1. Create a new NestJs app, then integrate with nitric
  2. Create Nitric stack setup
  3. Run the nitric run
  4. See error

Expected

I just want to ensure that i can run the application locally on my machine. Solve this problem!.
Let me know what to improve and change to make the code and platfrom running.

Output of nitric info -o yaml:

{
"os": "darwin",
"arch": "arm64",
"goVersion": "go1.19.11",
"cliVersion": "1.27.0",
"fabricVersion": "0.32.0",
"containerRuntime": "docker",
"containerRuntimeVersion": "platform:\n name: ""\ncomponents: []\nversion: ""\napiversion: ""\nminapiversion: ""\ngitcommit: ""\ngoversion: ""\nos: ""\narch: ""\nkernelversion: ""\nexperimental: false\nbuildtime: ""\n",
"detectedErrors": []
}

Other info

Screen.Recording.2023-08-08.at.11.12.53.mov

Hey, could you try running with nitric run -v2? This will add verbose output to the build process so I can help you investigate the problem.

@HomelessDinosaur Thanks bro. I found some error on docker about credentials. Let me fix this first.

nitric run -v2

Now i get this error messages.

DEBUG   Using function from src/main.ts
  DEBUG   freeport: detected ephemeral port range of [49152, 65535]
  DEBUG   freeport: reducing max blocks from 30 to 26 to avoid the ephemeral port range
  DEBUG   running builds 8 at a time                                             
  DEBUG   running command: /opt/homebrew/bin/docker buildx build /Users/nyomansunima/Projects/nitric-meme -f main.nitric.dynamic.dockerfile -t nitric-meme-main --load --builder=nitric --platform linux/amd64 --build-arg HANDLER=src/main.ts
  DEBUG   #0 building with "nitric" instance using docker-container driver       
          
          #1 [internal] load build definition from main.nitric.dynamic.dockerfile
  DEBUG   #1 transferring dockerfile: 1.82kB done                                
          #1 DONE 0.0s
          
          #2 resolve image config for docker.io/docker/dockerfile:1
  DEBUG   #2 DONE 5.3s                                                           
          
          #3 docker-image://docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021
          #3 resolve docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021 0.0s done
          #3 CACHED
  DEBUG   main.nitric.dynamic.dockerfile:1                                       
          --------------------
             1 | >>> # syntax=docker/dockerfile:1
             2 |     FROM node:alpine as build
             3 |     
          --------------------
          ERROR: failed to solve: exit code: 1
  ERROR   exit status 1        

Thanks

Hey @nyomansunima, I've taken a look at your error and have attempted to replicate it locally but was unable to get the same. I've created an example repository for a Nest.js application here. The difference with this is that it uses a custom dockerfile that doesn't have the syntax=docker/dockerfile:1 header at the top as that is what I believe is causing your issue. Could you give that repository a try and see if that works for you? If it does work, using the custom dockerfile will be a fine workaround for you right now and I'll keep investigating your issue and hopefully get a bug fix in the main CLI for you. If you want to read more about the custom dockerfile support you can look at the docs page.

I think the problem is on the installation. Thanks

tjholm commented

@nyomansunima If have details on how you solved it might be helpful for future users with similar setups.