From abadf1651671138966b82aa6b47a82b5b416fc17 Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Sat, 25 Dec 2021 21:28:29 +0800 Subject: [PATCH] added bind-mount upload file folder to containers of myems-api and admin --- admin/README.md | 9 ++++++++- myems-api/README.md | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/admin/README.md b/admin/README.md index 6653e273..d4b6c0c9 100644 --- a/admin/README.md +++ b/admin/README.md @@ -30,14 +30,21 @@ cd myems/admin docker build -t myems/myems-admin . ``` * Run a Docker container +If run on Windows host, bind-mount a share upload file folder at c:\upload to the container ```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 -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 --name Assign a name to the container diff --git a/myems-api/README.md b/myems-api/README.md index 30217029..74de2a40 100644 --- a/myems-api/README.md +++ b/myems-api/README.md @@ -56,14 +56,21 @@ cp example.env .env docker build -t myems/myems-api . ``` * Run a Docker container +If run on Windows host, bind-mount a share upload file folder at c:\upload to the container ```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 -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 --name Assign a name to the container