Common resources for LXC and systemd-nspawn containers
2015.8.0 新版功能.
These functions are not designed to be called directly, but instead from the
lxc
, nspawn
, and
dockerng
execution modules. They provide for
common logic to be re-used for common actions.
salt.modules.container_resource.
cache_file
(source)¶Wrapper for cp.cache_file which raises an error if the file was unable to be cached.
CLI Example:
salt myminion container_resource.cache_file salt://foo/bar/baz.txt
salt.modules.container_resource.
copy_to
(*args, **kwargs)¶Common logic for copying files to containers
CLI Example:
salt myminion container_resource.copy_to mycontainer /local/file/path /container/file/path container_type=docker exec_driver=nsenter
salt.modules.container_resource.
run
(*args, **kwargs)¶Common logic for running shell commands in containers
CLI Example:
salt myminion container_resource.run mycontainer 'ps aux' container_type=docker exec_driver=nsenter output=stdout