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

Docker image does not run on M1 MacBooks #60

Open
bcalmac opened this issue Dec 18, 2021 · 10 comments
Open

Docker image does not run on M1 MacBooks #60

bcalmac opened this issue Dec 18, 2021 · 10 comments

Comments

@bcalmac
Copy link

bcalmac commented Dec 18, 2021

The s12v/sns images from DockerHub are only for linux/amd64 and do not work on the new M1 MacBooks. Those require the linux/arm64 architecture.

I can build the image locally, but it would be nice to have it on DockerHub.

@bcalmac
Copy link
Author

bcalmac commented Dec 18, 2021

Here's my arm64 image for version 0.4.1 if anyone else needs it: https://hub.docker.com/r/bcalmac/sns

@bcalmac
Copy link
Author

bcalmac commented Dec 18, 2021

And the Dockerfile if you want to build it locally:

FROM openjdk:11.0.13-jre-slim

EXPOSE 9911

VOLUME /etc/sns

ENV AWS_DEFAULT_REGION=us-west-2 \
	AWS_ACCESS_KEY_ID=foo \
	AWS_SECRET_ACCESS_KEY=bar \
	DB_PATH=/etc/sns/db.json

ADD "https://github.com/s12v/sns/releases/download/0.4.1/sns-0.4.1.jar" "/sns.jar"

CMD ["java", "-jar", "/sns.jar"]

@adelaydeelsevier
Copy link

adelaydeelsevier commented Mar 5, 2022

Thank you @bcalmac - I'm now using your version. In our Go code, I've now got this so it'll run on both types of processor (amd64 and arm64):

  func (c *Containers) getSnsDockerImageName() string {
	  r, _ := syscall.Sysctl("sysctl.proc_translated")
  
	  var dockerImageName string
	  if c.isAppleSiliconArm64(r) {
		  dockerImageName = "bcalmac/sns"
	  } else {
		  dockerImageName = "s12v/sns"
	  }
	  return dockerImageName
  }

  func (c *Containers) isAppleSiliconArm64(r string) bool {
	  return r == "\x00\x00\x00"
  }

It's a work-around, but it would be great, if you guys were able to merge this into this image so that we don't need to do this. Thanks very much if you can.

@warrenseine
Copy link

I've actually published a multiarch version based on @bcalmac's Dockerfile. Feel free to test it.

@adelaydeelsevier
Copy link

@warrenseine thank you. it took me a while to get back to looking at this, but I have now tried your version and it works perfectly :-)

@warrenseine
Copy link

To be fair, I've migrated my Docker setup to LocalStack so I can have SQS and SNS (and potentially more AWS services) stubbed in a single multiarch container. But I'll keep the image up as it's still useful.

@adelaydeelsevier
Copy link

To be fair, I've migrated my Docker setup to LocalStack so I can have SQS and SNS (and potentially more AWS services) stubbed in a single multiarch container. But I'll keep the image up as it's still useful.

That would be great, thanks. If it becomes a bind, I would be happy to fork and maintain it.

@TheJosh
Copy link

TheJosh commented Jun 6, 2022

Our work made a reimplementation of this mock sns service too. Has a few other features such as limited support for subscription filtering, and a debug interface to see the requests and subscriptions.

It's publicly listed on Docker but the source isn't yet public. The source may well be public at some time in the future; I'm going to poke my boss to see if it can be open sourced.

https://hub.docker.com/r/nationalcrimecheck/mock-sns

@adelaydeelsevier
Copy link

thanks @TheJosh I will stick with the existing approach for now as the additional features I do not need; if you do manage to make the source available, I'd be happy to look at it.

@jameskbride
Copy link

Hello and apologies for the self-advertisement, I've created local-sns as a reimplementation of this project, which includes arm64 support. See jameskbride/local-sns#21 for more details.

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

5 participants