ko icon indicating copy to clipboard operation
ko copied to clipboard

Unable to use a custom base image

Open FNSdev opened this issue 1 year ago • 5 comments

Hello,

I am struggling to understand what causes ko build to fail when using a custom base image.

  • ko version = v0.15.1
  • OS = Linux, Ubuntu

A simple custom base image

FROM alpine:3.19

docker build -t ko.local/custom-base:0.0.3 .

Error when using ko:

-> % ko build --local
2024/01/25 13:47:16 Using base ko.local/custom-base:0.0.3@sha256:c19cfdee9ec320fa294fd9cc7e528648d9aed7f95966bd4a135e387d0892dc64 for dummy-app
2024/01/25 13:47:16 Using build config #0 for dummy-app
2024/01/25 13:47:16 Building dummy-app for linux/amd64
2024/01/25 13:47:16 Loading ko.local/dummy-app-72ccebfa6515bd599e9b93a5feb43507:f482cc01ae5fc0f3eb8df91b6cc2e94e5381531a8c71df53a94e1c15517fbde9
2024/01/25 13:47:16 daemon.Write response:  
Error: failed to publish images: error publishing ko://dummy-app: error loading image: error during connect: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.43/images/load?quiet=0": unable to calculate manifest: blob sha256:f1ce466261fc493d77470b0d63abbed27450e892b9afdf991d2e3738ae9c3d18 not found

.ko.yaml

defaultBaseImage: ko.local/custom-base:0.0.3

I have tested the same example on a personal machine, and can't reproduce it.

Could you please point me to the right direction? Already tried to prune images, containers, etc, as well as restarting docker.

P.S. it works fine if I set defaultBaseImage: alpine:3.19 directly.

FNSdev avatar Jan 25 '24 12:01 FNSdev

I'm also having this problem using Ubuntu 22.04.3 LTS x86_64 with Ko version 0.14.1

guilhermocc avatar Jan 29 '24 14:01 guilhermocc

@FNSdev Apparently, the problem is with docker, as you can see here: https://github.com/docker/buildx/issues/2218

I got it working by downgrading my docker desktop to 4.25.2 which comes with the following plugin versions:

Client: Docker Engine - Community
 Version:    25.0.1
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.5
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.23.0-desktop.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /usr/lib/docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     /usr/lib/docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.9
    Path:     /usr/lib/docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /usr/lib/docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /usr/lib/docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.9
    Path:     /usr/lib/docker/cli-plugins/docker-scout

Don't know yet which update introduced the bug.

guilhermocc avatar Jan 29 '24 16:01 guilhermocc

I believe this was solved by https://github.com/moby/moby/issues/47210, testing now.

aaomidi avatar Feb 13 '24 16:02 aaomidi

It wasn't :(

aaomidi avatar Feb 13 '24 16:02 aaomidi

@FNSdev, try using ko after this version: https://github.com/ko-build/ko/commit/a271b54fe5f4774a65741f945490c32fe160f0d1

aaomidi avatar Feb 13 '24 21:02 aaomidi

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Keep fresh with the 'lifecycle/frozen' label.

github-actions[bot] avatar May 14 '24 01:05 github-actions[bot]