使用以下命令行:
docker run -ti -v /hostDirectory:/containerDirectory
我可以将主机上的目录映射到容器上的目录。
如何获得相同的效果using saltstack's dockerng?我没有在文档中看到引用主机卷目录映射到容器上的目录的任何地方,看起来dockerng只支持使用docker创建的卷。
答案 0 :(得分:1)
dockerng中的相关参数已重命名为'绑定'在dockerng.running函数下
binds
Files/directories to bind mount. Each bind mount should be passed in the format <host_path>:<container_path>:<read_only>, where <read_only> is one of rw (for read-write access) or ro (for read-only access).
foo:
dockerng.running:
- image: bar/baz:latest
- binds: /srv/www:/var/www:ro,/etc/foo.conf:/usr/local/etc/foo.conf:rw
Binds can be passed as a YAML list instead of a comma-separated list:
foo:
dockerng.running:
- image: bar/baz:latest
- binds:
- /srv/www:/var/www:ro
- /home/myuser/conf/foo.conf:/etc/foo.conf:rw
Optionally, the read-only information can be left off the end and the bind mount will be assumed to be read-write. The example below is equivalent to the one above:
foo:
dockerng.running:
- image: bar/baz:latest
- binds:
- /srv/www:/var/www:ro
- /home/myuser/conf/foo.conf:/etc/foo.conf