In order to create your microservice and make it work you have to pass three major steps:
Choose your language:
Here we explain how to build the container image and push it to docker hub repository.
1. Sign up here https://hub.docker.com, sign in and create your public repository:
2. Go to Terminal.
3. Go to the folder where your files are (final code and docker file) with the following command:
for example, cd Desktop/folder...
4. Build the container image with the following command:
sudo docker build --no-cache -t marylin/catalog:sub_select_nodejs . (use your own repository name and folder)
NOTE:You need to append '-arm' to command above if you're building conatainer for ARM architecture:
sudo docker build --no-cache -t marylin/catalog:sub_select_nodejs-arm .
Be sure to type the '.' at the end of the command. This tells Docker to look in the current directory for the Dockerfile
What's really happening is that you are tagging your image so it can be distinguished from other microservices in the catalog
In the end you will see smth like this: Successfully built 356d14821233
TIP: If the result of docker build is ...returned a non-zero code: 137, try to stop ioFog Agent with sudo service iofog stop command, then build docker again and start ioFog agent with the command sudo service iofog start.
5. Be sure to login to Docker Hub via command line:
sudo docker login
6. Push the image into your catalog with:
sudo docker push marylin/catalog:sub_select_nodejs
NOTE: You need to append '-arm' to command above if you're pushing conatainer for ARM architecture:
sudo docker push marylin/catalog:sub_select_nodejs-arm
7. Go to your Public repository at https://hub.docker.com
You will see your pushed container image on the Tags tab.
Use the "Publish" menu in the ioAuthoring tool to access the publishing portal.
Publish page allows to publish containers and use them on Build page afterwards.
The Elements that you publish in the portal will be available to you and other members of your organization. They will not be available to the general public.
Be sure to enter your container image string properly, such as:
NOTE: No matter you are building for an arm device or x86 device, DO NOT ADD -arm at the end of your identifier in Container Image field.
4. If you want to change the icon of your element, you can click on Choose File button below and upload an image:
After that click on Change Icon Image button and you will see your image on the element
5. The element that you have published appears in the catalog alongside the publicly available elements on Build page:
You can use your microservice right now for IoT system creation.