The front end uses docker, Travis + dockerhub

Time:2020-11-21

Demo environment: Windows
Project Name: docker_ Demo

1、 Install docker

Download the docker installation package on the official website, and then install it directly
https://www.docker.com/

Download address of docker official website
Open directly after installation

Open the terminal command line and enter docker. The following information will appear, indicating that the installation is successful

Two core knowledge points of docker

Container and image

The whole life cycle of docker consists of three parts: image + container + repository
First, let’s go back to terminal command line operations

Input: docker images
If no image has been created, it is empty, as follows:

1. Write one first Node.js service

server.js

const koa = require('koa');
const app = new koa();

app.use(async ctx => {
    ctx.body = 'hello docker'
})

app.listen(3000, ()=>{
    console.log("server start on port: 3000");
});

2. Configuration package.json file

{
  "name": "docker_demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "koa": "^2.11.0"
  }
}

Recommended Today

PHP 12th week function learning record

sha1() effect sha1()Function to evaluate the value of a stringSHA-1Hash. usage sha1(string,raw) case <?php $str = “Hello”; echo sha1($str); ?> result f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 sha1_file() effect sha1_file()Function calculation fileSHA-1Hash. usage sha1_file(file,raw) case <?php $filename = “test.txt”; $sha1file = sha1_file($filename); echo $sha1file; ?> result aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d similar_text() effect similar_text()Function to calculate the similarity between two strings. usage similar_text(string1,string2,percent) case […]