Run the docker-compose project downloaded from gitbub on docker

Table of contents

1. Download code from github to local

1. Get it through the github command

2. Download the package directly to the local via zip

3. Difference

2. Find the docker-compose.yml file in the code package

1. If the official website has a prompt path, you can find this file directly in the folder

 2. Use the development software to open the project view (available software search yml)

 3. Knowledge supplement (yml file writing)

 3. Run the docker-compose.yml file to docker

1. Create a folder to place the docker-compose.yml file

2. Configure the domestic accelerator in docker

3. Right-click windows and click Windows PowerShell (administrator) mode to enter commands

4. Folder permissions

5. Exception example


1. Download code from github to local

The example used this time is the foreign low-code platform appsmith: GitHub - appsmithorg/appsmith: Framework to build admin panels, internal tools, and dashboards. Integrates with 15+ databases and any API.

1. Get it through the github command

Right click on Git Bash Here 

Enter the command:

git clone 

 Get pull request link from github

 Failure example (clone sometimes times out, it takes several attempts to get the package):

 Successful example (after seeing all the logs are "done", it means that the project is pulled successfully):

 2. Download the package directly to the local via zip

 After the download is complete, you will directly get a package in zip format

 Unzip to the local code space

3. Difference

git clone + copied URL The downloaded file has a .git folder

And if you download the ZIP package directly, it does not have its own .git folder, and you need to initialize the database creation through the git init command


Directly download the zip package: it can be used after decompression. Simply get a project file locally. If you want to directly pull or push to the remote git warehouse, it will definitely not work. git clone: ​​git will be created in your current folder
first A local warehouse, and then copy the project. At this time, you can directly git pull or push under this folder.

Summarize:

If you just want to download the project file and study the code by yourself, it will be easier to download the zip directly. If you want to add bricks and tiles to this open source project, then git clone will be better

2. Find the docker-compose.yml file in the code package

If you don’t have docker installed locally on Windows, you can read this article: Install Docker on Windows_陈远YIL的博客-CSDN博客

1. If the official website has a prompt path, you can find this file directly in the folder

 2. Use the development software to open the project view (available software search yml)

 3. Knowledge supplement (yml file writing)

The template file is the core of using Docker-Compose, so there are many instruction keywords involved

The default template file name is docker-compose.yml, and the format is YAML format

A docker-compose.yml file can be divided into three layers

The local port and the port used for mapping are one. For example, the example is port 80 and port 443. You must ensure that the port is not occupied in order to successfully deploy on docker

example:

#第一层 版本号
version: "3"  #代表使用docker-compose项目的版本号
#第二层:services 服务配置
services:
  web:
    build: .
    ports:  #宿主机和容器的端口映射
       "80:80"
       "443:443"
       "9001:9001"
    volumes:
       ./stacks:/appsmith-stacks
    labels:
      com.centurylinklabs.watchtower.enable: "true"
# 第三层 其他配置 网络、卷、全局规划

 3. Run the docker-compose.yml file to docker

1. Create a folder to place the docker-compose.yml file

2. Configure the domestic accelerator in docker

You can add and configure the domestic accelerator under Docker Engine, add it under Docker Engine

{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}

The URL in [] can be replaced with the URL of the domestic mirror source at will. I am using the mirror source of the University of Science and Technology of China here.

You can choose at will, fill in and save the file, then click Apply&restart to restart docker to complete the configuration

Docker China official:
https://registry.docker-cn.com

University of Science and Technology of China:
https://docker.mirrors.ustc.edu.cn
Netease:
http://hub-mirror.c.163.com
Aliyun:
https://{your_id}.mirror.aliyuncs.com
daocloud:
http: //{your_id}.m.daocloud.io

3. Right-click windows and click Windows PowerShell (administrator) mode to enter commands

 See personal habits available CMD (administrator) mode

 cd to yml placement path

start command

docker-compose up -d 

stop command

docker-compose down

example:

When starting docker for the first time, it will download dependencies from the image. The network needs to be stable, and it will take some time. After the dependencies are downloaded, it can be started quickly next time (if the network is unstable, you can try a few more times)

4. Folder permissions

Docker will generate a stacks in the folder to store data dependencies and logs

We need to give the project file full control and modification permissions, without permission the project will not be accessible

Open the browser and enter localhost , you will see the following page, appsmith started successfully

 

5. Exception example

 The process pid that occupies the port needs to be deleted, and the program can only run normally

 Then restart once: docker-compose up -d 

 When port 443 is occupied:

driver failed programming external connectivity on endpoint appsmith (b7139303035f81f1710277e689cf7011171d8b7a42e3de92ce00f05fc0ad0f0a): Bind for 0.0.0.0:443 failed: port is already allocated

 Enter netstat -ano|findstr to view the port occupancy without turning off all of them, just stop the LISTENING process

 Example: taskkill -pid 21016 -f

                      It is not easy to create, if it is helpful to you, please like it and collect it~ 

Guess you like

Origin blog.csdn.net/qq_55917018/article/details/130390954