Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The ARM to Z of Multi-Architecture Microservices

156 views

Published on

Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/2F3mH0r.

Christy Norman Perez and Christopher Jones discuss creating multi-platform images using Docker; emulating architectures in containers, demonstrating pulling all of this together in a Docker Swarm consisting of workers of different CPU architectures such as arm64, ppc64le, s390x, and x86_64. Filmed at qconsf.com.

Christy Norman Perez is a Software Developer at IBM who is focused on expanding and improving Docker's capabilities on IBM POWER Systems. Christopher Jones is a Software Developer at IBM, who works on development and testing of Docker on IBM POWER Systems. He can be found on Docker’s GitHub repository submitting and reviewing multi-architecture issues and pull requests.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

The ARM to Z of Multi-Architecture Microservices

  1. 1. The ARM to z of Multi- Architecture Microservices Chris Jones Open Source Developer, IBM Christy Norman Perez Open Source Developer, IBM
  2. 2. InfoQ.com: News & Community Site • Over 1,000,000 software developers, architects and CTOs read the site world- wide every month • 250,000 senior developers subscribe to our weekly newsletter • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • 2 dedicated podcast channels: The InfoQ Podcast, with a focus on Architecture and The Engineering Culture Podcast, with a focus on building • 96 deep dives on innovative topics packed as downloadable emags and minibooks • Over 40 new content items per week Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ microservices-multi-architecture
  3. 3. Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide Presented at QCon San Francisco www.qconsf.com
  4. 4. • What is "multi-arch?" • Challenges • Benefits • The path of multi-arch Agenda • Demo – Building images • Demo – Shipping images • Demo – Running Swarm • Q&A
  5. 5. What are we talking about?
  6. 6. • User experience across architectures is the same • Expand your project Goals
  7. 7. Why should you care?
  8. 8. • Grow your project • Strengths of other platforms Benefits
  9. 9. Vendor lock-in
  10. 10. Benefits to others
  11. 11. Challenges
  12. 12. $ uname –m ppc64le $ docker run –it ubuntu standard_init_linux.go:178: exec user process caused “no such file or directory” $ docker run –it ppc64le/ubuntu * root@eb7051894530:/# Usability
  13. 13. $ uname –m arm64 $ docker run –it rethinkdb standard_init_linux.go:178: exec user process caused “no such file or directory” $ docker run –it arm64/rethinkdb docker: Error response from daemon: repository arm64/rethinkdb not found: does not exist or no pull access. Availability
  14. 14. • Users have to remember they are on a different architecture • Arch-dependent (Devs?) image names harm usability (ref frozen images script?) • Siloed projects cause heartbreaks Summary
  15. 15. Tools
  16. 16. • actual hardware • cross-compiling • full-system emulation (QEMU) • user-mode emulation (binfmt_misc) Building binaries and images
  17. 17. • Allows you to run ELF binaries that weren’t compiled on your host architecture • Maps non-native binaries to arch-specific interpreters (e.g. QEMU) • Pre-Configured in Docker for Mac! binfmt_misc
  18. 18. binfmt_misc qemu-arm qemu-ppc64le qemu-amd64 qemuX binfmt_misc
  19. 19. $ uname -m x86_64 # docker run ppc64le image $ docker run -it --rm ppc64le/busybox:latest uname -m ppc64le Docker for Mac
  20. 20. # build ppc64le image on non-native hardware $ docker build -v qemu-static-ppc64le -t awesome-app- ppc64le -f Dockerfile.ppc64le . Building using binfmt_misc https://github.com/multiarch/qemu-user-static
  21. 21. Cross-compiling
  22. 22. # go $ GOOS=linux GOARCH=arm go build # java $ javac HelloWorld.java examples
  23. 23. Cross-Compile Workflow java-app> ├── Dockerfile.build ├── Dockerfile.arm ├── Dockerfile.amd64 ├── Dockerfile.ppc64le ├── Dockerfile.s390x └── HelloWorld.java
  24. 24. Cross-Compile Workflow # Dockerfile.build FROM openjdk COPY HelloWorld.java HelloWorld.java RUN javac HelloWorld.java Dev system (amd64): $ docker build -t hwj -f Dockerfile.build . # repeatable build env $ docker run --name hello-world-temp hwj # need container $ docker cp hello-world-temp:HelloWorld.class . # copy out of container
  25. 25. Cross-Compile Workflow Dev system (amd64): $ docker build -t clnperez/hello-world-arm -f Dockerfile.arm . $ docker push clnperez/hello-world-arm # Dockerfile.arm FROM arm32v7/openjdk COPY HelloWorld.class HelloWorld.class CMD ["java", "HelloWorld"] ARM user: $ docker run clnperez/hello-world-arm Hello World!
  26. 26. Manifest lists
  27. 27. Manifest list • A multi-arch "image” * • Engine decides which to pull • Extra image detail • Use in place of image name anywhere myrepo/mylist amd64 image arm image ppc64le image *but not
  28. 28. • Create & push manifest list to registry • "Shallow pull" (inspect) of image • Inspect manifest lists `docker manifest` command
  29. 29. # create interactively using cli $ docker manifest create ubuntu / arm/ubuntu / amd64/ubuntu / ppc64le/ubuntu / s390x/ubuntu # push to registry $ docker manifest push ubuntu docker manifest
  30. 30. # or create using yaml $ docker manifest push -f clnperez_hw.yaml docker manifest - yaml (soon)
  31. 31. $ docker manifest inspect ubuntu | grep “arch” "architecture": "amd64", "architecture": "arm", "architecture": "arm64", "architecture": "386", "architecture": "ppc64le", "architecture": "s390x", docker manifest
  32. 32. Project structure
  33. 33. ├── Dockerfile.amd64 ├── Dockerfile.arm ├── Dockerfile.ppc64le ├── Dockerfile.s390x ├── Dockerfile.windows Makefiles, Dockerfiles & build scripts • Multiple Dockerfiles (e.g. Dockerfile.arm32v7) • FROM can be passed in as an ARG • Can use manifest inspect to get arch-specific FROM • Be mindful of hardcoding arch values
  34. 34. • If you must... • ifdefs & build constraints Optimizations zfs.go:// +build linux freebsd solaris zfs_unsupported.go:// +build !linux,!freebsd,!solaris
  35. 35. Putting it all together
  36. 36. tophj/qcon
  37. 37. tophj/qcon • tophj/qcon:arm64 • tophj/qcon:amd64 • tophj/qcon:ppc64le • tophj/qcon:s390x
  38. 38. ├── Dockerfile.armhf ├── Dockerfile.ppc64le ├── Dockerfile.s390x ├── Dockerfile.x86_64 ├── img │ ├── captain_logo.png │ ├── captain.png │ ├── christy_logo.png │ ├── christy.png │ ├── pink.png │ └── tophj.png └── server.go docker swarm demo
  39. 39. # create our tophj/demo manifest list which points to our # architecture specific images $ docker manifest create tophj/demo tophj/x86_64-demo tophj/armhf-demo tophj/ppc64le-demo tophj/s390x-demo docker swarm demo
  40. 40. # annotate to change armhf to arm $ docker manifest annotate tophj/demo tophj/armhf-demo --os linux --arch arm # finally push the manifest list $ docker manifest push tophj/demo docker swarm demo
  41. 41. $ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 3nisms9qfi27ko0683bylxyud s390 Ready Active 7jwo7d5braat1l6n63j8xfue6 * x86_64 Ready Active Leader n5tqx2yk77123sjiapqwmu14e armhf Ready Active u30pwzlt5hthwbbsdok8nxyh8 ppc64le Ready Active docker swarm demo
  42. 42. # start the swarm service using the multi-arch image name $ docker service create --mode global --name dockercon -p 8082:8080 tophj/demo # start a simple load-balancer for fun $ docker run -itd -p 80:81 --name nginx -v /christy/nginx:/etc/nginx nginx # visit the IP of your load balancer in your browser # be sure to refresh for multi-arch fun docker swarm demo
  43. 43. docker swarm demo
  44. 44. • Server image: https://c1.staticflickr.com/4/3519/3462607995_150a6b2624_b.jpg • HtcpcpTeapot image: https://commons.wikimedia.org/wiki/File:Htcpcp_teapot.jpg • Raspberry Pi is a trademark of the Raspberry Pi Foundation. • https://github.com/dockersamples/docker-swarm-visualizer • ARMHF VM from Scaleway • X86 VM from DigitalOcean • Gophers: http://gopherize.me References & Legal
  45. 45. Thank You! Go forth and multi-arch! @qcon #qcon
  46. 46. Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ microservices-multi-architecture

×