From 437230107bca1b38a0cb5fe2707fbfacea5d9936 Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Thu, 13 Jan 2022 11:21:16 +0800 Subject: [PATCH] updated docker installation in README --- myems-aggregation/README.md | 39 +++++++++++++++++++++++++------ myems-api/README.md | 6 ++--- myems-cleaning/README.md | 37 ++++++++++++++++++++++++----- myems-modbus-tcp/README.md | 44 +++++++++++++++++++++++++++-------- myems-normalization/README.md | 37 ++++++++++++++++++++++++----- 5 files changed, 131 insertions(+), 32 deletions(-) diff --git a/myems-aggregation/README.md b/myems-aggregation/README.md index 8203af1a..d00bd2e4 100644 --- a/myems-aggregation/README.md +++ b/myems-aggregation/README.md @@ -1,6 +1,6 @@ ## myems-aggregation -MyEMS Aggregation Service +Data Aggregation Service 数据汇总服务 @@ -31,26 +31,51 @@ chmod +x run.sh In this section, you will install myems-aggregation on Docker. -* Copy example.env file to .env file and modify the .env file +* Copy source code to root directory +On Windows: +```bash +cp -r myems/myems-aggregation c:\ +cd c:\myems-aggregation +``` + +On Linux: +```bash +cp -r myems/myems-aggregation / +cd /myems/myems-aggregation +``` + +* Duplicate example.env file as .env file and modify the .env file +Replace ~~127.0.0.1~~ with real **HOST** IP address. ```bash -cd myems/myems-aggregation cp example.env .env ``` + * Build a Docker image ```bash docker build -t myems/myems-aggregation . ``` * Run a Docker container +On Windows host, bind-mount the .env to the container: ```bash -docker run -d --restart always --name myems-aggregation myems/myems-aggregation +docker run -d -v c:\myems-aggregation\.env:/code/.env --restart always --name myems-aggregation myems/myems-aggregation ``` +On Linux host, bind-mount the .env to the container: +```bash +docker run -d -p 8000:8000 -v /myems-aggregation/.env:/.env --restart always --name myems-aggregation myems/myems-aggregation +``` +* -d Run container in background and print container ID --d Run container in background and print container ID +* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory. ---restart Restart policy to apply when a container exits +* --restart Restart policy to apply when a container exits ---name Assign a name to the container +* --name Assign a name to the container + +The absolute path before colon is for path on host and that may vary on your system. +The absolute path after colon is for path on container and that CANNOT be changed. +By passing .env as bind-mount parameter, you can change the configuration values later. +If you changed .env file, restart the container to make the change effective. If you want to immigrate the image to another computer, * Export image to tarball file diff --git a/myems-api/README.md b/myems-api/README.md index e016a91f..95c7e8f1 100644 --- a/myems-api/README.md +++ b/myems-api/README.md @@ -56,7 +56,7 @@ cd c:\myems-api On Linux: ```bash cp -r myems/myems-api / -cd /myems/myems-api +cd /myems-api ``` * Duplicate example.env file as .env file and modify the .env file @@ -71,12 +71,12 @@ docker build -t myems/myems-api . ``` * Run a Docker container On Windows host, bind-mount a share upload folder at c:\myems-upload to the container, - and also bind-mount the .env to the container. + and also bind-mount the .env to the container: ```bash docker run -d -p 8000:8000 -v c:\myems-upload:/var/www/html/admin/upload -v c:\myems-api\.env:/code/.env --restart always --name myems-api myems/myems-api ``` On Linux host, bind-mount a share upload file folder at /myems-upload to the container, - and also bind-mount the .env to the container. + and also bind-mount the .env to the container: ```bash docker run -d -p 8000:8000 -v /myems-upload:/var/www/html/admin/upload -v /myems-api/.env:/.env --restart always --name myems-api myems/myems-api ``` diff --git a/myems-cleaning/README.md b/myems-cleaning/README.md index 0c172707..ba8c6dca 100644 --- a/myems-cleaning/README.md +++ b/myems-cleaning/README.md @@ -30,26 +30,51 @@ chmod +x run.sh In this section, you will install myems-cleaning on Docker. -* Copy example.env file to .env file and modify the .env file +* Copy source code to root directory +On Windows: +```bash +cp -r myems/myems-cleaning c:\ +cd c:\myems-cleaning +``` + +On Linux: +```bash +cp -r myems/myems-cleaning / +cd /myems-cleaning +``` + +* Duplicate example.env file as .env file and modify the .env file +Replace ~~127.0.0.1~~ with real **HOST** IP address. ```bash -cd myems/myems-cleaning cp example.env .env ``` + * Build a Docker image ```bash docker build -t myems/myems-cleaning . ``` * Run a Docker container +On Windows host, bind-mount the .env to the container: ```bash -docker run -d --restart always --name myems-cleaning myems/myems-cleaning +docker run -d -v c:\myems-cleaning\.env:/code/.env --restart always --name myems-cleaning myems/myems-cleaning ``` +On Linux host, bind-mount the .env to the container: +```bash +docker run -d -p 8000:8000 -v /myems-cleaning/.env:/.env --restart always --name myems-cleaning myems/myems-cleaning +``` +* -d Run container in background and print container ID --d Run container in background and print container ID +* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory. ---restart Restart policy to apply when a container exits +* --restart Restart policy to apply when a container exits ---name Assign a name to the container +* --name Assign a name to the container + +The absolute path before colon is for path on host and that may vary on your system. +The absolute path after colon is for path on container and that CANNOT be changed. +By passing .env as bind-mount parameter, you can change the configuration values later. +If you changed .env file, restart the container to make the change effective. If you want to immigrate the image to another computer, * Export image to tarball file diff --git a/myems-modbus-tcp/README.md b/myems-modbus-tcp/README.md index 6b6b7cd7..22375cd4 100644 --- a/myems-modbus-tcp/README.md +++ b/myems-modbus-tcp/README.md @@ -29,29 +29,53 @@ chmod +x run.sh In this section, you will install myems-modbus-tcp on Docker. -* Copy example.env file to .env file and modify the .env file -Note: There is a default Gateway Token in example.env, - if you run more than one myems-modbus-tcp instances, - please create new Gateway and get new token in Admin UI. - +In this section, you will install myems-modbus-tcp on Docker. + +* Copy source code to root directory + +On Windows: +```bash +cp -r myems/myems-modbus-tcp c:\ +cd c:\myems-modbus-tcp +``` + +On Linux: +```bash +cp -r myems/myems-modbus-tcp / +cd /myems-modbus-tcp +``` + +* Duplicate example.env file as .env file and modify the .env file +Replace ~~127.0.0.1~~ with real **HOST** IP address. ```bash -cd myems/myems-modbus-tcp cp example.env .env ``` + * Build a Docker image ```bash docker build -t myems/myems-modbus-tcp . ``` * Run a Docker container +On Windows host, bind-mount the .env to the container: ```bash -docker run -d --restart always --name myems-modbus-tcp myems/myems-modbus-tcp +docker run -d -v c:\myems-modbus-tcp\.env:/code/.env --restart always --name myems-modbus-tcp myems/myems-modbus-tcp ``` +On Linux host, bind-mount the .env to the container: +```bash +docker run -d -p 8000:8000 -v /myems-modbus-tcp/.env:/.env --restart always --name myems-modbus-tcp myems/myems-modbus-tcp +``` +* -d Run container in background and print container ID --d Run container in background and print container ID +* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory. ---restart Restart policy to apply when a container exits +* --restart Restart policy to apply when a container exits ---name Assign a name to the container +* --name Assign a name to the container + +The absolute path before colon is for path on host and that may vary on your system. +The absolute path after colon is for path on container and that CANNOT be changed. +By passing .env as bind-mount parameter, you can change the configuration values later. +If you changed .env file, restart the container to make the change effective. If you want to immigrate the image to another computer, * Export image to tarball file diff --git a/myems-normalization/README.md b/myems-normalization/README.md index 7597d7c8..d03e6e60 100644 --- a/myems-normalization/README.md +++ b/myems-normalization/README.md @@ -37,26 +37,51 @@ chmod +x run.sh In this section, you will install myems-normalization on Docker. -* Copy example.env file to .env file and modify the .env file +* Copy source code to root directory +On Windows: +```bash +cp -r myems/myems-normalization c:\ +cd c:\myems-normalization +``` + +On Linux: +```bash +cp -r myems/myems-normalization / +cd /myems-normalization +``` + +* Duplicate example.env file as .env file and modify the .env file +Replace ~~127.0.0.1~~ with real **HOST** IP address. ```bash -cd myems/myems-normalization cp example.env .env ``` + * Build a Docker image ```bash docker build -t myems/myems-normalization . ``` * Run a Docker container +On Windows host, bind-mount the .env to the container: ```bash -docker run -d --restart always --name myems-normalization myems/myems-normalization +docker run -d -v c:\myems-normalization\.env:/code/.env --restart always --name myems-normalization myems/myems-normalization ``` +On Linux host, bind-mount the .env to the container: +```bash +docker run -d -p 8000:8000 -v /myems-normalization/.env:/.env --restart always --name myems-normalization myems/myems-normalization +``` +* -d Run container in background and print container ID --d Run container in background and print container ID +* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory. ---restart Restart policy to apply when a container exits +* --restart Restart policy to apply when a container exits ---name Assign a name to the container +* --name Assign a name to the container + +The absolute path before colon is for path on host and that may vary on your system. +The absolute path after colon is for path on container and that CANNOT be changed. +By passing .env as bind-mount parameter, you can change the configuration values later. +If you changed .env file, restart the container to make the change effective. If you want to immigrate the image to another computer, * Export image to tarball file