gssong
V2EX  ›  Docker

doker 容器访问宿主机文件

  •  
  •   gssong · Apr 23, 2020 · 5456 views
    This topic created in 2240 days ago, the information mentioned may be changed or developed.

    docker 容器中是一个Spring 的文件预览项目

    现在我想要把宿主机的 /a-minimalist 目录挂载到容器中的 /a-minimalist 目录,我能在容器中用同样的路径访问宿主机中 /a-minimalist 下面的文件

    docker run -it -p 8012:8012 keking/kkfileview  -v /a-minimalist:/a-minimalist
    

    这样写命令为啥不对,容器中并没有生成 /a-minimalist 这个文件夹

    3 replies    2020-04-23 10:22:20 +08:00
    luckyrayyy
        1
    luckyrayyy  
       Apr 23, 2020
    你为啥把 -v 写后面,不记得这样可以啊
    arischow
        2
    arischow  
       Apr 23, 2020
    ```
    docker run -it -p 8012:8012 -v /a-minimalist:/a-minimalist keking/kkfileview
    ```
    hzfyjgw
        3
    hzfyjgw  
       Apr 23, 2020
    -v -p 参数放 repo/image:tag 之前
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1361 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 17:18 · PVG 01:18 · LAX 10:18 · JFK 13:18
    ♥ Do have faith in what you're doing.