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

Buildpacks produces linux/amd64 images on linux/arm64/v8 (M1 Mac) machines. #112

Open
j-windsor opened this issue Mar 4, 2021 · 2 comments

Comments

@j-windsor
Copy link

Repro steps:

  1. use cloud code go hello world sample.
  2. run pack build hello-world-go --builder gcr.io/buildpacks/builder:v1 --path ./. It will build successfully.
  3. run this (below). Note that the image runs successfully on an M1 Mac even though the platform is very different.
➜  go-hello-world git:(master) ✗ docker run hello-world-go
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
2021/03/04 21:34:30 Server listening on port :8080
  1. run docker image inspect hello-world-go to verify. Output:
[
    {
        "Id": "sha256:63851e5c479a2e8bc605d882d749c3c9c5f3e79bf895763f06b552ce8abea0f2",
        "RepoTags": [
            "hello-world-go:latest"
        ],
        "RepoDigests": [],
        "Parent": "",
        "Comment": "",
        "Created": "1980-01-01T00:00:01Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "cnb",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "DEBIAN_FRONTEND=noninteractive",
                "PATH=/cnb/process:/cnb/lifecycle:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "CNB_USER_ID=1000",
                "CNB_GROUP_ID=1000",
                "CNB_STACK_ID=google",
                "PORT=8080",
                "CNB_LAYERS_DIR=/layers",
                "CNB_APP_DIR=/workspace",
                "CNB_PLATFORM_API=0.4",
                "CNB_DEPRECATION_MODE=quiet"
            ],
            "Cmd": null,
            "Image": "sha256:aa08b59bfecec305f0357ef091b6c2af52553e3dc9f82076000ea9607339ac46",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/cnb/process/web"
            ],
            "OnBuild": null,
            "Labels": {
                "io.buildpacks.build.metadata": "{\"bom\":null,\"buildpacks\":[{\"id\":\"google.go.runtime\",\"version\":\"0.9.1\"},{\"id\":\"google.go.build\",\"version\":\"0.9.0\"},{\"id\":\"google.utils.label\",\"version\":\"0.0.1\"}],\"launcher\":{\"version\":\"0.10.2\",\"source\":{\"git\":{\"repository\":\"github.com/buildpacks/lifecycle\",\"commit\":\"960cf58\"}}},\"processes\":[{\"type\":\"web\",\"command\":\"/layers/google.go.build/bin/main\",\"args\":null,\"direct\":true,\"buildpackID\":\"google.go.build\"}]}",
                "io.buildpacks.lifecycle.metadata": "{\"app\":[{\"sha\":\"sha256:70c27410a4a815e7e086e4a5e4f42f8a75340e7476c42b846f6bdeab6f7447b6\"}],\"buildpacks\":[{\"key\":\"google.go.runtime\",\"version\":\"0.9.1\",\"layers\":{}},{\"key\":\"google.go.build\",\"version\":\"0.9.0\",\"layers\":{\"bin\":{\"sha\":\"sha256:55c826a737e6bd4d430a16d0b844b70f59becc5768b4347528cf9d03c82ff3a3\",\"data\":{},\"build\":false,\"launch\":true,\"cache\":false}}},{\"key\":\"google.utils.label\",\"version\":\"0.0.1\",\"layers\":{}}],\"config\":{\"sha\":\"sha256:3990daccb002152264b5352a49eba085b8027474dd1667aeebc8d50623c23959\"},\"launcher\":{\"sha\":\"sha256:576e5f5696c6fcae9b679dca450d7ab127176f5c529bc9790b42abb9e3658cfa\"},\"process-types\":{\"sha\":\"sha256:83d85471d9f8a3834b4e27cf701e3f0aef220cc816d9c173c7d32cd73909a590\"},\"runImage\":{\"topLayer\":\"sha256:3fd970aa9e35cc28e3b04656cfd43247aaf5b4803a833b0aca206fd38386ea21\",\"reference\":\"675c3ee754ac793e91fc28adfd00a161b2c5e17d2952f6352b315c6caf537b64\"},\"stack\":{\"runImage\":{\"image\":\"gcr.io/buildpacks/gcp/run:v1\"}}}",
                "io.buildpacks.project.metadata": "{}",
                "io.buildpacks.stack.id": "google"
            }
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 129830232,
        "VirtualSize": 129830232,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/1347a433b4eebf9f094dc5ed481e7d2413b1eaa11ef4bf83b1fa0fb28ce444df/diff:/var/lib/docker/overlay2/ac081f81942c33ccfaa5bafec7b392ee6c7d37768cc3a7c8cc9371adf0fcb948/diff:/var/lib/docker/overlay2/f471c57d46ec09bfd333e50f866cfab852f88894ecbda619ae7bb44fa9df40c3/diff:/var/lib/docker/overlay2/52b37ddce44569e9e54eedddf762342d47a86b7bd974c45128592ee235b2bb33/diff:/var/lib/docker/overlay2/834b761625190a72efaf73322a004e74ec28b0a9b0a91bd0e9e36ea41140b98d/diff:/var/lib/docker/overlay2/9583eccac1742c436427abddf3b311687676462334bcfa7a453f75a42bf7ff5c/diff:/var/lib/docker/overlay2/dfd1aebcea5d055552728a25f5ed5710fa6084843e4f697fe0ef23110d836077/diff:/var/lib/docker/overlay2/a486489579b89d3b10fe99b8169a442540c201364574ed0a1403a387a3b297b0/diff:/var/lib/docker/overlay2/00953b7369c89711f20114c718cb43be8cb0e2dcf30dab96c008bbb9c39debee/diff",
                "MergedDir": "/var/lib/docker/overlay2/88e077cb595532e5516035bfa590d22dfb31a2954591036acec0d2c4aa06bcf3/merged",
                "UpperDir": "/var/lib/docker/overlay2/88e077cb595532e5516035bfa590d22dfb31a2954591036acec0d2c4aa06bcf3/diff",
                "WorkDir": "/var/lib/docker/overlay2/88e077cb595532e5516035bfa590d22dfb31a2954591036acec0d2c4aa06bcf3/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:15c45f7e4eae2c5acf2eaaf68b297df185bb7e090d92dd9618d85b95a148f9d6",
                "sha256:2b77f0d5aff80e22e2573f2dbc29895899b4bc2f7448d44997b70f4a7501ebf2",
                "sha256:84ff92691f909a05b224e1c56abb4864f01b4f8e3c854e4bb4c7baf1d3f6d652",
                "sha256:0839753e8256123d351820644c6dd093be6d673a517bf8be524df7ae02327168",
                "sha256:3fd970aa9e35cc28e3b04656cfd43247aaf5b4803a833b0aca206fd38386ea21",
                "sha256:55c826a737e6bd4d430a16d0b844b70f59becc5768b4347528cf9d03c82ff3a3",
                "sha256:70c27410a4a815e7e086e4a5e4f42f8a75340e7476c42b846f6bdeab6f7447b6",
                "sha256:576e5f5696c6fcae9b679dca450d7ab127176f5c529bc9790b42abb9e3658cfa",
                "sha256:3990daccb002152264b5352a49eba085b8027474dd1667aeebc8d50623c23959",
                "sha256:83d85471d9f8a3834b4e27cf701e3f0aef220cc816d9c173c7d32cd73909a590"
            ]
        },
        "Metadata": {
            "LastTagTime": "2021-03-04T21:33:36.407190967Z"
        }
    }
]
@briandealwis
Copy link
Member

Buildpacks does not yet support building for linux/arm64 yet.

buildpacks/lifecycle#435

@peterfortuin
Copy link

I have tried this as well, but got a different result. For me it does tries to run/build a x86 image, but it's really slow. So I never got an image that I can run.

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

3 participants