Skip to main content

Hello World Sample

The Hello World sample demonstrates basic container deployment by displaying "WebAssembly" in ASCII art — introducing you to the fundamental concepts of building and deploying Atym containers.


Building the Container

Building the hello-world sample involves three main steps: compiling the application to WebAssembly, packaging it into an Atym container, and pushing it to the Atym Hub.

Building the Application

Navigate to the hello-world sample in the Ocre SDK samples directory and create a build directory to compile the application to WebAssembly:

cd ocre-sdk/generic/hello-world/
mkdir build && cd build
cmake ..
make

This creates a WASM module named hello-world.wasm, that will be used by the atym build command in the next step.

Create the Container

Return to the project root directory and build the Atym container:

cd ..
atym build

If the container creation was successful, you should see a new directory, (.atym) in your home directory (~/.atym). In there, you will find a directory with the container images name and the container contents. In our case, the directory is hello-world, as that is the container image name defined in our build.yaml file in the project root.

Push the Container to the Atym Hub

Push your container to the Atym Hub:

atym push hello-world
info

We did not specify a "tag" (e.g. atym push hello-world:tag), which will result in this image being tagged as latest.


Deploying the Container

This section shows you how to deploy the hello-world sample container to your device using the Atym CLI.

tip

This example uses deviceName for device identification, which is typically easier to remember and use. You can also use deviceUUID if preferred. To find your device name or UUID, use atym list devices or check the Atym Hub web interface.

Deploy to the Target Device

Deploy the container using the Atym CLI with the following command, replacing deviceName with your device's name:

atym run hello-world hello-world -n deviceName

Where the first hello-world is your chosen container name, and the next hello-world is the IMAGE_REF[:TAG], which is the container image from your registry. In this example we did not specify a tag, and are therefore running the latest tag. This command also requires a device identifier (-n for deviceName, or -d for deviceUUID).

Verify Deployment

The Atym Hub will deploy your container to the device and you should see the following output in your console:

atym:~$ Client connected.
_ _________ ___ ______________ ______ ____ __
| | /| / / __/ _ )/ _ | / __/ __/ __/ |/ / _ )/ /\ \/ /
| |/ |/ / _// _ / __ |_\ \_\ \/ _// /|_/ / _ / /__\ /
|__/|__/___/____/_/ |_/___/___/___/_/ /_/____/____//_/
powered by Atym

Update v4

Next Steps

After you've mastered basic container deployment, try the Blinky Sample to learn how to control hardware using GPIO.