6. (Optional) Check docker-ce is on-line correctly:
apt-cachepolicydocker-ce
7. Install Docker:
sudoaptinstalldocker-ce
(Optional) Installation check on terminal:
docker--version
How to Dockerize?
In order to ainize (i.e., deploy on Ainize) applications, the applications need to be dockerized first. Here you'll find an instruction on how to dockerize with step-by-step examples for two major programming frameworks:
Only Dockerfile at repo's root directory is supported currently.
The filename of Dockerfile should be case-sensitive and not be included file extensions.
Node.js
Create a simple web server
We will go through how to dockerize a simple web server from scratch. Before getting started, Node.js and Docker need to be installed in advance.
1. Create a Node.js project.
npminit
2. Initialize package.json file.
{"name":"ainize-docker-nodejs","version":"1.0.0","description":"tutorial for dockerize","main":"index.js","scripts":{"start":"node index.js" },"author":"ainize","license":"ISC"}
3. Generate index.js file.
touchindex.js
4. Fill in the simple code snippet.
console.log('hello');
5. Run the simple code and it will show the result.