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

Install Issue - Ubuntu Image on Mac M1 Pro #2870

Open
Lachlan-White opened this issue May 13, 2024 · 3 comments
Open

Install Issue - Ubuntu Image on Mac M1 Pro #2870

Lachlan-White opened this issue May 13, 2024 · 3 comments
Labels
awaiting-response Waiting for clarification or response from original author needs-investigation

Comments

@Lachlan-White
Copy link

What happened:
Attempting to build docker image leveraging install script for syft.

What you expected to happen:
Syft to be installed

Steps to reproduce the issue:

# Dockerfile for Container
FROM mcr.microsoft.com/powershell:latest

# Install curl for making GitHub API calls
RUN apt-get update && apt-get install -y curl \
    curl \
    git \
    gnupg \
    software-properties-common

# Install Syft
RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin

# Set the working directory
WORKDIR /usr/src/app

# Copy all powershell scripts within folder
COPY *.ps1 .

# Set permissions to execute the script
RUN chmod +x *.ps1

# Set the script as the entry point
CMD ["pwsh", "-File", "run.ps1"]

Anything else we need to know?: Error Message:

=> ERROR [3/6] RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin                                                5.4s
------                                                                                                                                                                         
 > [3/6] RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin:                                                           
2.184 [info] fetching release script for tag='v1.4.1'                                                                                                                          
3.853 [info] using release tag='v1.4.1' version='1.4.1' os='linux' arch='armv7' 
5.331 [error] could not find release asset for os='linux' arch='armv7' format='tar.gz'  
5.337 [error] failed to install syft 
------
dockerfile:12
--------------------
  10 |     
  11 |     # Install Syft
  12 | >>> RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
  13 |     
  14 |     # Set the working directory
--------------------
ERROR: failed to solve: process "/bin/sh -c curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin" did not complete successfully: exit code: 1

Environment:

  • Output of syft version:
  • OS (e.g: cat /etc/os-release or similar): Mac M1 running Ubuntu Image for container.
@Lachlan-White Lachlan-White added the bug Something isn't working label May 13, 2024
@spiffcs
Copy link
Contributor

spiffcs commented May 14, 2024

Nice catch @Lachlan-White

It looks like our current .goreleaser.yaml doesn't account for a v7 distribution here.

This section does not exist in our release file:

    # GOARM to build for when GOARCH is arm.
    # For more info refer to: https://go.dev/doc/install/source#environment
    #
    # Default: [ 6 ]
    goarm:
      - 6
      - 7

Reading again, it also looks like we only support arm64 as a release candidate: ARM64 (64-bit): Also known as ARMv8

  - id: linux-build
    dir: ./cmd/syft
    binary: syft
    goos:
      - linux
    goarch:
      - amd64
      - arm64
      - ppc64le
      - s390x

To reproduce this I also ran

❯ docker run -it mcr.microsoft.com/powershell:latest /bin/sh
# uname -m
x86_64

It looks like for the powershell latest docker image the arch should be x86_64) arch="amd64" ;;

I was also able to install syft successfully when running that image interactively:

# curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
[info] fetching release script for tag='v1.4.1'
[info] using release tag='v1.4.1' version='1.4.1' os='linux' arch='amd64'
[info] installed /usr/local/bin/syft

Do you have any more information on why your mcr.microsoft.com/powershell:latest /bin/sh is returning an arm32 architecture?

I can talk with the team about updating our release assets, but want to also get to the bottom of why we're seeing different outcomes on our respective machine.

Here is the link to the powershell official docker image along with the tags and their supported architecture:
https://hub.docker.com/_/microsoft-powershell

@spiffcs spiffcs added needs-investigation and removed bug Something isn't working labels May 14, 2024
@Lachlan-White
Copy link
Author

Hey @spiffcs, thanks for the quick response!

Have no idea why the default output of the Microsoft image is returning an arm32 by default.

I might just force the version specifically in arm64 which would fix my issue, but it is an interesting scenario.

If you had anything you wanted me to test on my local to help, just let me know

@spiffcs
Copy link
Contributor

spiffcs commented May 15, 2024

If you run this on your local what's your result?

docker run  -it mcr.microsoft.com/powershell:latest /bin/sh
# uname -a
Linux 83b1dbc1234f 6.6.26-linuxkit #1 SMP PREEMPT_DYNAMIC Sat Apr 27 04:15:35 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I copied your Dockerfile and removed the powershell lines and was able to get a successful install.

What happens if you do the same for the alpine version or any explicitly tagged x86_64 arch?

docker run -it mcr.microsoft.com/powershell:lts-alpine-3.17 /bin/sh
Unable to find image 'mcr.microsoft.com/powershell:lts-alpine-3.17' locally
lts-alpine-3.17: Pulling from powershell
3c854c8cbf46: Pull complete
09b3f3175f8c: Pull complete
0505aeb2a439: Pull complete
Digest: sha256:2064d42be1cb05f5d83995f2b12f95737fe74924cbd8519fda886ad834e0b4f8
Status: Downloaded newer image for mcr.microsoft.com/powershell:lts-alpine-3.17
/ # uname -a
Linux aab7448f7e05 6.6.26-linuxkit #1 SMP PREEMPT_DYNAMIC Sat Apr 27 04:15:35 UTC 2024 x86_64 Linux

@wagoodman wagoodman added the awaiting-response Waiting for clarification or response from original author label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-response Waiting for clarification or response from original author needs-investigation
Projects
Status: No status
Development

No branches or pull requests

3 participants