diff --git a/docker-compose-on-linux.yml b/docker-compose-on-linux.yml index 29f8ac73..75743614 100644 --- a/docker-compose-on-linux.yml +++ b/docker-compose-on-linux.yml @@ -4,9 +4,7 @@ services: build: ./myems-api command: gunicorn app:api -b 0.0.0.0:8000 --timeout 600 --workers=4 volumes: - - type: bind - source: /upload - target: /var/www/myems-admin/upload + - /myems-upload:/var/www/myems-admin/upload restart: always ports: - "8000:8000" @@ -37,9 +35,7 @@ services: healthcheck: test: [ "CMD","nginx","-t" ] volumes: - - type: bind - source: /upload - target: /var/www/myems-admin/upload + - /myems-upload:/var/www/myems-admin/upload restart: always ports: - "8001:8001" diff --git a/docker-compose-on-windows.yml b/docker-compose-on-windows.yml index 60244a9a..30774ed9 100644 --- a/docker-compose-on-windows.yml +++ b/docker-compose-on-windows.yml @@ -4,9 +4,7 @@ services: build: ./myems-api command: gunicorn app:api -b 0.0.0.0:8000 --timeout 600 --workers=4 volumes: - - type: bind - source: c:\upload - target: /var/www/myems-admin/upload + - c:\myems-upload:/var/www/myems-admin/upload restart: always ports: - "8000:8000" @@ -37,9 +35,7 @@ services: healthcheck: test: [ "CMD","nginx","-t" ] volumes: - - type: bind - source: c:\upload - target: /var/www/myems-admin/upload + - c:\myems-upload:/var/www/myems-admin/upload restart: always ports: - "8001:8001" diff --git a/myems-admin/README.md b/myems-admin/README.md index aa2391a8..2a14ec7e 100644 --- a/myems-admin/README.md +++ b/myems-admin/README.md @@ -43,25 +43,29 @@ docker build -t myems/myems-admin . ``` * Run a Docker container + If run on Windows host, bind-mount a share upload file folder at c:\myems-upload to the container and also bind-mount nginx.conf -v parameter for upload folder must be same with that in myems-api ```bash -docker run -d -p 8001:8001 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-admin/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-admin myems/myems-admin +docker run -d -p 8001:8001 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin ``` If run on Linux host, bind-mount a share upload file folder at /myems-upload to the container and also bind-mount nginx.conf ```bash -docker run -d -p 8001:8001 -v /myems-upload:/var/www/myems-admin/upload -v /myems-admin/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-admin myems/myems-admin +docker run -d -p 8001:8001 -v /myems-upload:/var/www/myems-admin/upload -v /myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin ``` --d Run container in background and print container ID +* -d Run container in background and print container ID --p Publish a container's port(s) to the host, 8001:8001 (Host:Container) binds port 8001 (right) of the container to TCP port 8001 (left) of the host machine. +* -p Publish a container's port(s) to the host, 8001:8001 (Host:Container) binds port 8001 (right) of the container to +TCP port 8001 (left) of the host machine. --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. +* -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. +The ro option, if present, causes the bind mount to be mounted into the container as read-only. ---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 If you want to immigrate the image to another computer, * Export image to tarball file diff --git a/myems-aggregation/README.md b/myems-aggregation/README.md index 11b42c6a..b440a219 100644 --- a/myems-aggregation/README.md +++ b/myems-aggregation/README.md @@ -56,17 +56,20 @@ cp example.env .env docker build -t myems/myems-aggregation . ``` * Run a Docker container + On Windows host, bind-mount the .env to the container: ```bash -docker run -d -v c:\myems-aggregation\.env:/code/.env --restart always --name myems-aggregation myems/myems-aggregation +docker run -d -v c:\myems-aggregation\.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation ``` On Linux host, bind-mount the .env to the container: ```bash -docker run -d -v /myems-aggregation/.env:/code/.env --restart always --name myems-aggregation myems/myems-aggregation +docker run -d -v /myems-aggregation/.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation ``` * -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. +* -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. +The ro option, if present, causes the bind mount to be mounted into the container as read-only. * --restart Restart policy to apply when a container exits diff --git a/myems-api/README.md b/myems-api/README.md index fc3edc48..83e95687 100644 --- a/myems-api/README.md +++ b/myems-api/README.md @@ -92,22 +92,26 @@ 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: ```bash -docker run -d -p 8000:8000 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-api\.env:/code/.env --restart always --name myems-api myems/myems-api +docker run -d -p 8000:8000 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-api\.env:/code/.env:ro --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: ```bash -docker run -d -p 8000:8000 -v /myems-upload:/var/www/myems-admin/upload -v /myems-api/.env:/code/.env --restart always --name myems-api myems/myems-api +docker run -d -p 8000:8000 -v /myems-upload:/var/www/myems-admin/upload -v /myems-api/.env:/code/.env:ro --restart always --name myems-api myems/myems-api ``` * -d Run container in background and print container ID -* -p Publish a container's port(s) to the host, 8000:8000 (Host:Container) binds port 8000 (right) of the container to TCP port 8000 (left) of the host machine. +* -p Publish a container's port(s) to the host, 8000:8000 (Host:Container) binds port 8000 (right) of the container to +TCP port 8000 (left) of the host machine. -* -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. +* -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. +The ro option, if present, causes the bind mount to be mounted into the container as read-only. * --restart Restart policy to apply when a container exits diff --git a/myems-cleaning/README.md b/myems-cleaning/README.md index 0c467bac..607713ed 100644 --- a/myems-cleaning/README.md +++ b/myems-cleaning/README.md @@ -55,17 +55,20 @@ cp example.env .env docker build -t myems/myems-cleaning . ``` * Run a Docker container + On Windows host, bind-mount the .env to the container: ```bash -docker run -d -v c:\myems-cleaning\.env:/code/.env --restart always --name myems-cleaning myems/myems-cleaning +docker run -d -v c:\myems-cleaning\.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning ``` On Linux host, bind-mount the .env to the container: ```bash -docker run -d -v /myems-cleaning/.env:/code/.env --restart always --name myems-cleaning myems/myems-cleaning +docker run -d -v /myems-cleaning/.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning ``` * -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. +* -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. +The ro option, if present, causes the bind mount to be mounted into the container as read-only. * --restart Restart policy to apply when a container exits diff --git a/myems-modbus-tcp/README.md b/myems-modbus-tcp/README.md index 3fecaafd..aa1b0e3d 100644 --- a/myems-modbus-tcp/README.md +++ b/myems-modbus-tcp/README.md @@ -1,6 +1,7 @@ ## MyEMS Modbus TCP Service ### Introduction + This service is a component of MyEMS Community Edition to acquire data from Modbus TCP devices. ### Prerequisites @@ -55,17 +56,20 @@ cp example.env .env 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 -v c:\myems-modbus-tcp\.env:/code/.env --restart always --name myems-modbus-tcp myems/myems-modbus-tcp +docker run -d -v c:\myems-modbus-tcp\.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp ``` On Linux host, bind-mount the .env to the container: ```bash -docker run -d -v /myems-modbus-tcp/.env:/code/.env --restart always --name myems-modbus-tcp myems/myems-modbus-tcp +docker run -d -v /myems-modbus-tcp/.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp ``` * -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. +* -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. +The ro option, if present, causes the bind mount to be mounted into the container as read-only. * --restart Restart policy to apply when a container exits diff --git a/myems-normalization/README.md b/myems-normalization/README.md index 10e24ed4..fb170944 100644 --- a/myems-normalization/README.md +++ b/myems-normalization/README.md @@ -51,7 +51,9 @@ cp -r myems/myems-normalization / cd /myems-normalization ``` -* Duplicate example.env file as .env file and modify the .env file +* Create .env file + +Duplicate example.env file as .env file and modify the .env file Replace ~~127.0.0.1~~ with real **HOST** IP address. ```bash cp example.env .env @@ -62,17 +64,20 @@ cp example.env .env docker build -t myems/myems-normalization . ``` * Run a Docker container + On Windows host, bind-mount the .env to the container: ```bash -docker run -d -v c:\myems-normalization\.env:/code/.env --restart always --name myems-normalization myems/myems-normalization +docker run -d -v c:\myems-normalization\.env:/code/.env:ro --restart always --name myems-normalization myems/myems-normalization ``` On Linux host, bind-mount the .env to the container: ```bash -docker run -d -v /myems-normalization/.env:/code/.env --restart always --name myems-normalization myems/myems-normalization +docker run -d -v /myems-normalization/.env:/code/.env:ro --restart always --name myems-normalization myems/myems-normalization ``` * -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. +* -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. +The ro option, if present, causes the bind mount to be mounted into the container as read-only. * --restart Restart policy to apply when a container exits diff --git a/myems-web/README.md b/myems-web/README.md index 4941d538..58118d73 100644 --- a/myems-web/README.md +++ b/myems-web/README.md @@ -1,6 +1,7 @@ # myems-web ## Introduction + Web用户界面,用于MyEMS能源数据可视化 Web UI for MyEMS energy data visualization @@ -13,6 +14,7 @@ Node.js 17.0.0 or later ## Running in Local Environment for Development * Install Node.js via binary archive on Linux + Download Current Linux Binaries (x64) from https://nodejs.org/en/download/current/ ```bash @@ -25,7 +27,6 @@ sudo ln -s /usr/local/lib/nodejs/node-vxx.x.x-linux-x64/bin/npx /usr/bin/npx Download the latest current version Windows installer (.msi) 64-bit from https://nodejs.org/en/download/current/ Install Node.js with Setup Wizard - Test installation ```bash node -v @@ -90,22 +91,28 @@ docker build -t myems/myems-web . ``` * Run a Docker container + If run on Windows host, bind-mount nginx.conf to the container ```bash -docker run -d -p 80:80 -v c:\myems-web/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-web myems/myems-web +docker run -d -p 80:80 -v c:\myems-web/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-web myems/myems-web ``` If run on Linux host, bind-mount nginx.conf ```bash -docker run -d -p 80:80 -v /myems-web/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-web myems/myems-web +docker run -d -p 80:80 -v /myems-web/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-web myems/myems-web ``` --d Run container in background and print container ID +* -d Run container in background and print container ID --p Publish a container's port(s) to the host, 80:80 (Host:Container) binds port 80 (right) of the container to TCP port 80 (left) of the host machine. +* -p Publish a container's port(s) to the host, 80:80 (Host:Container) binds port 80 (right) of the container to +TCP port 80 (left) of the host machine. ---restart Restart policy to apply when a container exits +* -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. +The ro option, if present, causes the bind mount to be mounted into the container as read-only. ---name Assign a name to the container +* --restart Restart policy to apply when a container exits + +* --name Assign a name to the container If you want to immigrate the image to another computer, * Export image to tarball file