SlideShare a Scribd company logo
A Safe Dock for our Programs
Docker + WASM (+WASI)
By Mario A. Santini
Mario A. Santini
Software Developer
Telecomunication Field
Docker Desktop
●
Minimum version 4.15
●
Enable containerd
( say goodbay to all existing images)
●
Use the scratch image
Run WASM on Docker
Docker Engine
Containerd
containerd-shim containerd-shim containerd-shim
runc runc wasmedge
Container process Container process Wasm Module
DEMO TIME!
1 fn main() {
2 println!("Hello, Docker Hub!");
3 }
main.rs
Dockerfile
1 FROM scratch
2
3 COPY ./target/wasm32-wasi/release/hello-docker.wasm 
/hello-docker.wasm
4 ENTRYPOINT [ "hello-docker.wasm" ]
$ docker run 
--runtime=io.containerd.wasmedge.v1 
$image_name
$ docker buildx build 
--platform=wasi/wasm32 
-t $image_name .
How Good Stuff Usually Came From
«Amateurs sit and wait for
inspiration, the rest of us just get
up and go to work.»
Stephen King
From JavaScript to asm.js
Source Code AST
Bytecode
Baseline
Compiled
Code
Ion-
Compiled
Code
Run
Run & Profile
Parse Generate
Compile
Compile
Bail
Mozilla asm.js
Source Code AST
Bytecode
Baseline
Compiled
Code
Ion-
Compiled
Code
Run
Run & Profile
Parse Generate
Compile
Compile
Bail
asm.js
WebAssembly
WebAssembly is a binary instruction format for a stack-
based virtual machine.
...is designed as a portable compilation target for
programming languages, enabling deployment on the web
for client and server applications.
webassembly.org
What’s make WASM so cool
●
Efficient and fast
●
Safe
●
Open and debuggable
●
Part of the open web platform
Efficient and fast
●
Compact in size
●
Fast load time
●
Execution at “native speed”
●
Binary format
●
Can take advantage of the hardware*
Safe
●
Memory safe
●
Sandboxes execution environment
●
Same origin and permission policy
enforcement (on the web platform)
Part of the open web platform
●
Designed to enforce versionless,
feature-tested, backward-compatible
●
Callable in and out from JavaScript
●
Accessing the web API
...but it’s not limited on that platform...
How it Works on the Web
●
Load the .wasm file from JavaScript
●
Compile it with the WebAssembly
interface
●
Instantiate the module through
JavaScript
●
Access the exported functions
A WASM File Example
;; simple.wasm
(module
(func $i (import "imports" "i") (param i32))
(func (export "e")
i32.const 42
call $i))
How to Work on the Browser
function instantiate(bytes, imports) {
return WebAssembly
.compile(bytes)
.then(m => new WebAssembly.Instance(m, imports));
}
var importObject = {
imports: {
i: arg => console.log(arg)
}
};
fetch('simple.wasm')
.then(response => response.arrayBuffer())
.then(bytes => instantiate(bytes, importObject))
.then(instance => instance.exports.e());
WebAssembly System Interface
●
It’s designed to be independent from Browsers
and web APIs or JavaScript
●
Inspired by POSIX
●
Focused on portability and security
●
A modular set of standard interfaces
WIP
●
WASI is still Work In Progress
●
WASI-CORE is the starting point
●
There are also open points:
– Asynchronous I/O
– File watching
– File locking
WASM 2.0 and Beyond
●
Tail calls → standardized but still not ready
●
Exception handling
●
Garbage collection
●
Memory64
●
Multiple memory
●
Relaxed SIMD
●
Threads and atomics
●
Type reflection
Conclusions
●
WASM is not ready on the server yet
●
It’s a pretty good portable format
●
Running WASM as a container it’s really
promising
●
WASI is still in a early stage
References
●
Docker + WASM https://docs.docker.com/desktop/wasm/
●
Emscripten https://emscripten.org/
●
Wasmtime https://wasmtime.dev/
●
WasmEdge https://wasmedge.org/
●
Lunatic https://github.com/lunatic-solutions/lunatic
●
AssemblyScript https://www.assemblyscript.org/
●
W3C WASM https://www.w3.org/wasm/
●
WebAssembly https://webassembly.org/
●
Bytecode Alliance https://bytecodealliance.org/
●
WASI https://wasi.dev/
Thanks!

More Related Content

Similar to A Safe Dock for our Programs

DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
inside-BigData.com
 
Win32 Perl Wmi
Win32 Perl WmiWin32 Perl Wmi
Win32 Perl Wmi
ddn123456
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
Ben Hall
 
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
Pavol Pitoňák
 
Side effects-con-redux
Side effects-con-reduxSide effects-con-redux
Side effects-con-redux
Nicolas Quiceno Benavides
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
Simon Su
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
Roman Rodomansky
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with Vagrant
Artefactual Systems - AtoM
 
Fabricio - Docker deploy automation
Fabricio - Docker deploy automationFabricio - Docker deploy automation
Fabricio - Docker deploy automation
Rinat Khabibiev
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
kognate
 
Continous Delivery to Kubernetes using Helm
Continous Delivery to Kubernetes using HelmContinous Delivery to Kubernetes using Helm
Continous Delivery to Kubernetes using Helm
Bitnami
 
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Continuous Delivery of Cloud Applications with Docker Containers and IBM BluemixContinuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Florian Georg
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholm
Jameel Nabbo
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and Webpack
Ignacio Martín
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
Justin Ryan
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
Tudor Barbu
 
Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)
Mike Melusky
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
Expanding WebAssembly.pdf
Expanding WebAssembly.pdfExpanding WebAssembly.pdf
Expanding WebAssembly.pdf
StemFunfacts
 

Similar to A Safe Dock for our Programs (20)

DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
Win32 Perl Wmi
Win32 Perl WmiWin32 Perl Wmi
Win32 Perl Wmi
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
 
Side effects-con-redux
Side effects-con-reduxSide effects-con-redux
Side effects-con-redux
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with Vagrant
 
Fabricio - Docker deploy automation
Fabricio - Docker deploy automationFabricio - Docker deploy automation
Fabricio - Docker deploy automation
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
Continous Delivery to Kubernetes using Helm
Continous Delivery to Kubernetes using HelmContinous Delivery to Kubernetes using Helm
Continous Delivery to Kubernetes using Helm
 
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Continuous Delivery of Cloud Applications with Docker Containers and IBM BluemixContinuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholm
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and Webpack
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
Expanding WebAssembly.pdf
Expanding WebAssembly.pdfExpanding WebAssembly.pdf
Expanding WebAssembly.pdf
 

More from Mario Alexandro Santini

Rust With async / .await
Rust With async / .awaitRust With async / .await
Rust With async / .await
Mario Alexandro Santini
 
Rust_Threads.pdf
Rust_Threads.pdfRust_Threads.pdf
Rust_Threads.pdf
Mario Alexandro Santini
 
The_Borrow_Checker.pdf
The_Borrow_Checker.pdfThe_Borrow_Checker.pdf
The_Borrow_Checker.pdf
Mario Alexandro Santini
 
Vuejs
VuejsVuejs
The Rust Programming Language
The Rust Programming LanguageThe Rust Programming Language
The Rust Programming Language
Mario Alexandro Santini
 
Introduction to typescript
Introduction to typescriptIntroduction to typescript
Introduction to typescript
Mario Alexandro Santini
 
The myth of the small script
The myth of the small scriptThe myth of the small script
The myth of the small script
Mario Alexandro Santini
 
Docker jug taa
Docker   jug taaDocker   jug taa
Docker jug taa
Mario Alexandro Santini
 
Lambda architecture
Lambda architectureLambda architecture
Lambda architecture
Mario Alexandro Santini
 

More from Mario Alexandro Santini (9)

Rust With async / .await
Rust With async / .awaitRust With async / .await
Rust With async / .await
 
Rust_Threads.pdf
Rust_Threads.pdfRust_Threads.pdf
Rust_Threads.pdf
 
The_Borrow_Checker.pdf
The_Borrow_Checker.pdfThe_Borrow_Checker.pdf
The_Borrow_Checker.pdf
 
Vuejs
VuejsVuejs
Vuejs
 
The Rust Programming Language
The Rust Programming LanguageThe Rust Programming Language
The Rust Programming Language
 
Introduction to typescript
Introduction to typescriptIntroduction to typescript
Introduction to typescript
 
The myth of the small script
The myth of the small scriptThe myth of the small script
The myth of the small script
 
Docker jug taa
Docker   jug taaDocker   jug taa
Docker jug taa
 
Lambda architecture
Lambda architectureLambda architecture
Lambda architecture
 

Recently uploaded

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

A Safe Dock for our Programs

  • 1. A Safe Dock for our Programs Docker + WASM (+WASI) By Mario A. Santini
  • 2. Mario A. Santini Software Developer Telecomunication Field
  • 3. Docker Desktop ● Minimum version 4.15 ● Enable containerd ( say goodbay to all existing images) ● Use the scratch image
  • 4. Run WASM on Docker Docker Engine Containerd containerd-shim containerd-shim containerd-shim runc runc wasmedge Container process Container process Wasm Module
  • 6. 1 fn main() { 2 println!("Hello, Docker Hub!"); 3 } main.rs Dockerfile 1 FROM scratch 2 3 COPY ./target/wasm32-wasi/release/hello-docker.wasm /hello-docker.wasm 4 ENTRYPOINT [ "hello-docker.wasm" ]
  • 7. $ docker run --runtime=io.containerd.wasmedge.v1 $image_name $ docker buildx build --platform=wasi/wasm32 -t $image_name .
  • 8. How Good Stuff Usually Came From «Amateurs sit and wait for inspiration, the rest of us just get up and go to work.» Stephen King
  • 9. From JavaScript to asm.js Source Code AST Bytecode Baseline Compiled Code Ion- Compiled Code Run Run & Profile Parse Generate Compile Compile Bail
  • 10. Mozilla asm.js Source Code AST Bytecode Baseline Compiled Code Ion- Compiled Code Run Run & Profile Parse Generate Compile Compile Bail asm.js
  • 11. WebAssembly WebAssembly is a binary instruction format for a stack- based virtual machine. ...is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications. webassembly.org
  • 12. What’s make WASM so cool ● Efficient and fast ● Safe ● Open and debuggable ● Part of the open web platform
  • 13. Efficient and fast ● Compact in size ● Fast load time ● Execution at “native speed” ● Binary format ● Can take advantage of the hardware*
  • 14. Safe ● Memory safe ● Sandboxes execution environment ● Same origin and permission policy enforcement (on the web platform)
  • 15. Part of the open web platform ● Designed to enforce versionless, feature-tested, backward-compatible ● Callable in and out from JavaScript ● Accessing the web API ...but it’s not limited on that platform...
  • 16. How it Works on the Web ● Load the .wasm file from JavaScript ● Compile it with the WebAssembly interface ● Instantiate the module through JavaScript ● Access the exported functions
  • 17. A WASM File Example ;; simple.wasm (module (func $i (import "imports" "i") (param i32)) (func (export "e") i32.const 42 call $i))
  • 18. How to Work on the Browser function instantiate(bytes, imports) { return WebAssembly .compile(bytes) .then(m => new WebAssembly.Instance(m, imports)); } var importObject = { imports: { i: arg => console.log(arg) } }; fetch('simple.wasm') .then(response => response.arrayBuffer()) .then(bytes => instantiate(bytes, importObject)) .then(instance => instance.exports.e());
  • 19. WebAssembly System Interface ● It’s designed to be independent from Browsers and web APIs or JavaScript ● Inspired by POSIX ● Focused on portability and security ● A modular set of standard interfaces
  • 20.
  • 21. WIP ● WASI is still Work In Progress ● WASI-CORE is the starting point ● There are also open points: – Asynchronous I/O – File watching – File locking
  • 22. WASM 2.0 and Beyond ● Tail calls → standardized but still not ready ● Exception handling ● Garbage collection ● Memory64 ● Multiple memory ● Relaxed SIMD ● Threads and atomics ● Type reflection
  • 23. Conclusions ● WASM is not ready on the server yet ● It’s a pretty good portable format ● Running WASM as a container it’s really promising ● WASI is still in a early stage
  • 24. References ● Docker + WASM https://docs.docker.com/desktop/wasm/ ● Emscripten https://emscripten.org/ ● Wasmtime https://wasmtime.dev/ ● WasmEdge https://wasmedge.org/ ● Lunatic https://github.com/lunatic-solutions/lunatic ● AssemblyScript https://www.assemblyscript.org/ ● W3C WASM https://www.w3.org/wasm/ ● WebAssembly https://webassembly.org/ ● Bytecode Alliance https://bytecodealliance.org/ ● WASI https://wasi.dev/