builder icon indicating copy to clipboard operation
builder copied to clipboard

How to get image locally

Open delfick opened this issue 3 years ago • 5 comments

Hello

I'm trying to use the builder on the example project and I can't quite work it out

I did a git clone [email protected]:home-assistant/addons-example.git and from the addons-example directory did:

docker run \
  --rm \
  -it \
  --name builder \
  --privileged \
  -v $(pwd)/example:/data \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  homeassistant/aarch64-builder \
  --target /data    --aarch64  -d local
[23:41:53] INFO: No crossbuild support on host
[23:41:53] INFO: Using host docker setup with '/var/run/docker.sock'
[23:41:53] INFO: Run addon build for: aarch64
[23:41:53] INFO: Init cache for local/aarch64-addon-example:1.2.0 with tag latest and platform linux/arm64
[23:42:00] WARNING: No cache image found. Disabling cache for this build.
[23:42:00] INFO: Run build for local/aarch64-addon-example:1.2.0 with platform linux/arm64
WARNING: No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 1.8s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                     0.0s
 => => transferring dockerfile: 410B                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                          0.0s
 => [internal] load metadata for ghcr.io/home-assistant/aarch64-base:3.15                                                                                0.4s
 => CACHED [1/3] FROM ghcr.io/home-assistant/aarch64-base:3.15@sha256:005f1df70301d335e050c8db253e69a8b7862b6f1f6ffa31f686751bb165a6e2                   0.0s
 => => resolve ghcr.io/home-assistant/aarch64-base:3.15@sha256:005f1df70301d335e050c8db253e69a8b7862b6f1f6ffa31f686751bb165a6e2                          0.0s
 => [internal] load build context                                                                                                                        0.1s
 => => transferring context: 1.70kB                                                                                                                      0.1s
 => [2/3] RUN     curl -sSLf -o /usr/bin/tempio     "https://github.com/home-assistant/tempio/releases/download/2021.09.0/tempio_aarch64"                1.3s
 => [3/3] COPY rootfs /                                                                                                                                  0.0s
[23:42:02] INFO: Finish build for local/aarch64-addon-example:1.2.0
[23:42:02] INFO: Create image tag: latest
Error response from daemon: failed to find image local/aarch64-addon-example:1.2.0: docker.io/local/aarch64-addon-example:1.2.0: image not known

I'm on MacOS Monterey 12.6 (M1 2020 Macbook Pro) Using podman 4.3.1

Is there an option so that the built image is available to my local podman without pushing it to a docker registry?

delfick avatar Nov 12 '22 02:11 delfick

Pass in --test as an argument

ludeeus avatar Nov 12 '22 08:11 ludeeus

even with --test it does the same thing

╰─ docker run \
  --rm \
  -it \
  --name builder \
  --privileged \
  -v $(pwd)/example:/data \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  homeassistant/aarch64-builder \
  --target /data    --aarch64  -d local --test
[03:20:41] INFO: No crossbuild support on host
[03:20:41] INFO: Using host docker setup with '/var/run/docker.sock'
[03:20:41] INFO: Run addon build for: aarch64
[03:20:41] INFO: Init cache for local/aarch64-addon-example:1.2.0 with tag latest and platform linux/arm64
[03:20:46] WARNING: No cache image found. Disabling cache for this build.
[03:20:46] INFO: Run build for local/aarch64-addon-example:1.2.0 with platform linux/arm64
WARNING: No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 4.7s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 425B                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [internal] load metadata for ghcr.io/home-assistant/aarch64-base:3.15                                                                                                                             0.3s
 => CACHED [1/3] FROM ghcr.io/home-assistant/aarch64-base:3.15@sha256:005f1df70301d335e050c8db253e69a8b7862b6f1f6ffa31f686751bb165a6e2                                                                0.0s
 => => resolve ghcr.io/home-assistant/aarch64-base:3.15@sha256:005f1df70301d335e050c8db253e69a8b7862b6f1f6ffa31f686751bb165a6e2                                                                       0.0s
 => [internal] load build context                                                                                                                                                                     0.2s
 => => transferring context: 1.70kB                                                                                                                                                                   0.1s
 => [2/3] RUN     curl -sSLf -o /usr/bin/tempio     "https://github.com/home-assistant/tempio/releases/download/2021.09.0/tempio_aarch64"                                                             4.3s
 => [3/3] COPY rootfs /                                                                                                                                                                               0.0s
[03:20:51] INFO: Finish build for local/aarch64-addon-example:1.2.0
[03:20:51] INFO: Create image tag: latest
Error response from daemon: failed to find image local/aarch64-addon-example:1.2.0: docker.io/local/aarch64-addon-example:1.2.0: image not known

delfick avatar Nov 12 '22 08:11 delfick

Hi, it seems even in github actions I have the same problem

https://github.com/delfick/photons/commit/963696928d9de5ac04f324c4584a0c1de8375f21

Screen Shot 2022-11-20 at 1 36 07 am Screen Shot 2022-11-20 at 1 35 18 am Screen Shot 2022-11-20 at 1 35 32 am

delfick avatar Nov 19 '22 14:11 delfick

Having the same problem.

I think the --load flag for buildx is missing and I don't understand why this has been working at all.

djmaze avatar Nov 21 '22 23:11 djmaze

Adding the --load flag to the buildx command indeed makes it work for me.

djmaze avatar Nov 22 '22 00:11 djmaze