Docker Image Implementation
Any standard Docker image can be executed on the Orbs Network. The image must adhere to certain requirements to support efficient orchestration by the protocol.
The most important part of a Docker image is the Dockerfile. Orbs VM supports the standard file format as interpreted by orchestrators like Docker Swarm.
To make sure your image as efficient as possible, be sure to follow the best practices for writing Dockerfiles. It is recommended to base your docker image on the official Alpine Linux.
To be a good citizen on the image orchestration protocol, your image must respond to health check queries. When an image fails to respond to health check with an appropriate exit code, it will be restarted. Images that fail to eventually start and reach a healthy state are at risk of non execution.
To support monitoring by the community, your service should maintain a local
status.jsonfile that shares its current status with the outside world. The contents of this file are publicly available from every node running the service via the network status page.
The following Dockerfile example creates a Node.js service based on Alpine Linux. The service uses a shell script that executes a Node.js script for performing the health check and updating
# standard working directory
# install your app
COPY package*.json ./
RUN npm install
COPY dist ./dist
CMD [ "npm", "start" ]
# install healthcheck based on status.json
COPY ./healthcheck.sh ./
COPY ./healthcheck.js ./
HEALTHCHECK CMD /opt/orbs/healthcheck.sh
# install entry point executable
COPY ./entrypoint.sh /opt/orbs/service