最近作項目作一個shared Dynamodb, 使用docker掛載一個image,發現怎麼都掛載不上,java
使用git
$ pwd E:\Work\Aws\git\schema\dynamodb\local $ ls init.sh README.md shared-local-instance.db $ cat README.md docker run -v "$PWD":/dynamodb_local_db -p 8000:8000 cnadiminti/dynamodb-local:l atest
$ docker run -v "$PWD":/dynamodb_local_db -p 8000:8000 cnadiminti/dynamodb-local:latest
結果發現掛載不上:docker
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 08f63c3ff31a cnadiminti/dynamodb-local:latest "/docker-entrypoint." 7 minutes ago Up 7 minutes 0.0.0.0:8000->8000/tcp affectionate_par e $ docker exec -it cd2bb8d20608 /bin/bash $ docker exec -it 08f63c3ff31a /bin/bash root@08f63c3ff31a:/var/dynamodb_local# ls DynamoDBLocal.jar LICENSE.txt third_party_licenses DynamoDBLocal_lib README.txt root@08f63c3ff31a:/var/dynamodb_local# cd / root@08f63c3ff31a:/# ls bin docker-entrypoint.sh etc lib64 opt run sys var boot docker-java-home home media proc sbin tmp dev dynamodb_local_db lib mnt root srv usr root@08f63c3ff31a:/# cd dynamodb_local_db root@08f63c3ff31a:/dynamodb_local_db# ls
(注: 發現沒有掛載成功,由於該目錄裏邊沒有文件)
作過以下嘗試:bash
停掉container, 從新掛載,不行tcp
停掉container,rm contaniner, 從新掛載,不行spa
關掉docker 終端,從新掛載,不行code
刪掉image從新掛載,仍是不行blog
後來發現我須要掛載的本機目錄是E:\Work\Aws\git\schema\dynamodb\local,可是docker運行的VM裏邊setting中Shared Folder中只有c/Usersit
解決辦法:把須要掛載的文件放到c:/users 目錄下能夠了io
*TODO: docker 原理, image ,machine的關係,docker 命令
docker run -v "$PWD":/dynamodb_local_db -p 8000:8000 cnadiminti/dynamodb-local:l atest