Python_user
Python_user

Reputation: 1573

Unable to build docker image for nodejs app on Mac

I am fairly new to docker. On a linux OS, like Ubuntu, everything works fine.

However, I recently started experimenting with Docker on MacOS Sonoma (which is provided to me by the company that I work for) for my own nodejs app. Docker Desktop is forbidden to use which, I gather, was costing money. Instead I am using colima to run my containers.

Using colima, I am able to use standard docker commands like docker images, docker info etc...

However, I am unable to run docker build . -t myapp. I am getting the below error:

Killed: 9
[+] Building 0.0s (0/0)                                                                                                              docker:default
ERROR: listing workers for Build: failed to list workers: Canceled: context canceled

and sometimes, I even get this error:

[+] Building 0.0s (0/1)                                                                                                                                                                          docker:colima
[+] Building 0.0s (2/2) FINISHED                                                                                                                                                                 docker:colima
 => [internal] load build definition from Dockerfile                                                                                                                                                      0.0s
 => => transferring dockerfile: 163B                                                                                                                                                                      0.0s
 => CANCELED [internal] load metadata for docker.io/library/node:16 

I tried various methods like tampering with the docker config file, restarting colima etc..., but to no avail.

Since I am beginner in this container world, this really feels like swinging my bat in the dark and would really appreciate help (with possibly a brief explanation as to how all this works)

Edit: Running docker-buildx works. However, I am still still unable to pull any image via docker pull hello-world

Upvotes: 0

Views: 63

Answers (1)

KevMcC
KevMcC

Reputation: 9

the issue you’re experiencing while building Docker images with Colima on your macOS is likely related to resource constraints or configuration issues with Colima it's default settings may not be optimized for Docker builds. Insufficient CPU, memory, or disk space allocation could lead to these issues.

You could try increasing the resource allocation for Colima and using Docker’s buildx, which is more efficient and reliable for building images, especially on systems like macOS.

docker buildx create --use

docker buildx build . -t myapp

Upvotes: -1

Related Questions