added bind-mount upload file folder to containers of myems-api and admin

pull/103/head
13621160019@163.com 2021-12-25 21:28:29 +08:00
parent d0e06e122e
commit abadf16516
2 changed files with 16 additions and 2 deletions

9
admin/README.md vendored
View File

@ -30,14 +30,21 @@ cd myems/admin
docker build -t myems/myems-admin . docker build -t myems/myems-admin .
``` ```
* Run a Docker container * Run a Docker container
If run on Windows host, bind-mount a share upload file folder at c:\upload to the container
```bash ```bash
docker run -d -p 8001:8001 --restart always --name myems-admin myems/myems-admin docker run -d -p 8001:8001 -v c:\upload:/var/www/html/admin/upload --restart always --name myems-admin myems/myems-admin
```
If run on Linux host, bind-mount a share upload file folder at /upload to the container
```bash
docker run -d -p 8001:8001 -v /upload:/var/www/html/admin/upload --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.
--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

View File

@ -56,14 +56,21 @@ cp example.env .env
docker build -t myems/myems-api . docker build -t myems/myems-api .
``` ```
* Run a Docker container * Run a Docker container
If run on Windows host, bind-mount a share upload file folder at c:\upload to the container
```bash ```bash
docker run -d -p 8000:8000 --restart always --name myems-api myems/myems-api docker run -d -p 8000:8000 -v c:\upload:/var/www/html/admin/upload --restart always --name myems-api myems/myems-api
```
If run on Linux host, bind-mount a share upload file folder at /upload to the container
```bash
docker run -d -p 8000:8000 -v /upload:/var/www/html/admin/upload --restart always --name myems-api myems/myems-api
``` ```
-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, 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.
--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