This commit is contained in:
felixfontein
2023-12-10 08:57:33 +00:00
parent 6470c8ab0c
commit 80502d2762
40 changed files with 487 additions and 460 deletions
+20 -12
View File
@@ -1,14 +1,16 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<html class="writer-html5" lang="en" data-content_root="../">
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Docker Guide &mdash; Community.Docker Collection documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/ansible.css" type="text/css" />
<link rel="stylesheet" href="../_static/antsibull-minimal.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/rtd-ethical-ads.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=5707b69d" />
<link rel="stylesheet" type="text/css" href="../_static/css/ansible.css?v=c5b67dd2" />
<link rel="stylesheet" type="text/css" href="../_static/antsibull-minimal.css" />
<link rel="stylesheet" type="text/css" href="../_static/css/rtd-ethical-ads.css?v=289b023e" />
<link rel="shortcut icon" href="../_static/images/Ansible-Mark-RGB_Black.png"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
@@ -33,11 +35,9 @@
<div class="DocSite-globalNav ansibleNav">
<ul>
<li><a href="https://www.ansible.com/ansiblefest" target="_blank">AnsibleFest</a></li>
<li><a href="https://www.ansible.com/tower" target="_blank">Products</a></li>
<li><a href="https://www.ansible.com/community" target="_blank">Community</a></li>
<li><a href="https://www.ansible.com/webinars-training" target="_blank">Webinars & Training</a></li>
<li><a href="https://www.ansible.com/blog" target="_blank">Blog</a></li>
<li><a href="https://forum.ansible.com/" target="_blank">Ansible community forum</a></li>
<li><a href="https://docs.ansible.com/" target="_blank">Documentation</a></li>
</ul>
</div>
@@ -180,7 +180,7 @@
</nav>
<section id="requirements">
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Requirements</a><a class="headerlink" href="#requirements" title="Link to this heading"></a></h2>
<p>Most of the modules and plugins in community.docker require the <a class="reference external" href="https://docker-py.readthedocs.io/en/stable/">Docker SDK for Python</a>. The SDK needs to be installed on the machines where the modules and plugins are executed, and for the Python version(s) with which the modules and plugins are executed. You can use the <a class="reference external" href="https://docs.ansible.com/ansible/devel/collections/community/general/python_requirements_info_module.html#ansible-collections-community-general-python-requirements-info-module" title="(in Ansible vdevel)"><span class="xref std std-ref">community.general.python_requirements_info module</span></a> to make sure that the Docker SDK for Python is installed on the correct machine and for the Python version used by Ansible.</p>
<p>Most of the modules and plugins in community.docker require the <a class="reference external" href="https://docker-py.readthedocs.io/en/stable/">Docker SDK for Python</a>. The SDK needs to be installed on the machines where the modules and plugins are executed, and for the Python version(s) with which the modules and plugins are executed. You can use the <a class="reference external" href="https://docs.ansible.com/ansible/devel/collections/community/general/python_requirements_info_module.html#ansible-collections-community-general-python-requirements-info-module" title="(in Ansible vdevel)"><span>community.general.python_requirements_info module</span></a> to make sure that the Docker SDK for Python is installed on the correct machine and for the Python version used by Ansible.</p>
<p>Note that plugins (inventory plugins and connection plugins) are always executed in the context of Ansible itself. If you use a plugin that requires the Docker SDK for Python, you need to install it on the machine running <code class="docutils literal notranslate"><span class="pre">ansible</span></code> or <code class="docutils literal notranslate"><span class="pre">ansible-playbook</span></code> and for the same Python interpreter used by Ansible. To see which Python is used, run <code class="docutils literal notranslate"><span class="pre">ansible</span> <span class="pre">--version</span></code>.</p>
<p>You can install the Docker SDK for Python for Python 3.6 or later as follows:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>docker
@@ -283,7 +283,7 @@ by Docker SDK for Python.</p>
<p>For working with a plain Docker daemon, that is without Swarm, there are connection plugins, an inventory plugin, and several modules available:</p>
<blockquote>
<div><dl>
<dt>docker connection plugin</dt><dd><p>The <a class="reference internal" href="../docker_connection.html#ansible-collections-community-docker-docker-connection"><span class="std std-ref">community.docker.docker connection plugin</span></a> uses the Docker CLI utility to connect to Docker containers and execute modules in them. It essentially wraps <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">exec</span></code> and <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">cp</span></code>. This connection plugin is supported by the <a class="reference external" href="https://docs.ansible.com/ansible/devel/collections/ansible/posix/synchronize_module.html#ansible-collections-ansible-posix-synchronize-module" title="(in Ansible vdevel)"><span class="xref std std-ref">ansible.posix.synchronize module</span></a>.</p>
<dt>docker connection plugin</dt><dd><p>The <a class="reference internal" href="../docker_connection.html#ansible-collections-community-docker-docker-connection"><span class="std std-ref">community.docker.docker connection plugin</span></a> uses the Docker CLI utility to connect to Docker containers and execute modules in them. It essentially wraps <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">exec</span></code> and <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">cp</span></code>. This connection plugin is supported by the <a class="reference external" href="https://docs.ansible.com/ansible/devel/collections/ansible/posix/synchronize_module.html#ansible-collections-ansible-posix-synchronize-module" title="(in Ansible vdevel)"><span>ansible.posix.synchronize module</span></a>.</p>
</dd>
<dt>docker_api connection plugin</dt><dd><p>The <a class="reference internal" href="../docker_api_connection.html#ansible-collections-community-docker-docker-api-connection"><span class="std std-ref">community.docker.docker_api connection plugin</span></a> talks directly to the Docker daemon to connect to Docker containers and execute modules in them.</p>
</dd>
@@ -298,6 +298,8 @@ by Docker SDK for Python.</p>
</dd>
<dt>docker_image module</dt><dd><p>The <a class="reference internal" href="../docker_image_module.html#ansible-collections-community-docker-docker-image-module"><span class="std std-ref">community.docker.docker_image module</span></a> provides full control over images, including: build, pull, push, tag and remove.</p>
</dd>
<dt>docker_image_load</dt><dd><p>The <a class="reference internal" href="../docker_image_load_module.html#ansible-collections-community-docker-docker-image-load-module"><span class="std std-ref">community.docker.docker_image_load module</span></a> allows you to import one or multiple images from tarballs.</p>
</dd>
<dt>docker_image_info module</dt><dd><p>The <a class="reference internal" href="../docker_image_info_module.html#ansible-collections-community-docker-docker-image-info-module"><span class="std std-ref">community.docker.docker_image_info module</span></a> allows you to list and inspect images.</p>
</dd>
<dt>docker_network module</dt><dd><p>The <a class="reference internal" href="../docker_network_module.html#ansible-collections-community-docker-docker-network-module"><span class="std std-ref">community.docker.docker_network module</span></a> provides full control over Docker networks.</p>
@@ -310,8 +312,14 @@ by Docker SDK for Python.</p>
</dd>
<dt>docker_container module</dt><dd><p>The <a class="reference internal" href="../docker_container_module.html#ansible-collections-community-docker-docker-container-module"><span class="std std-ref">community.docker.docker_container module</span></a> manages the container lifecycle by providing the ability to create, update, stop, start and destroy a Docker container.</p>
</dd>
<dt>docker_container_copy_into</dt><dd><p>The <a class="reference internal" href="../docker_container_copy_into_module.html#ansible-collections-community-docker-docker-container-copy-into-module"><span class="std std-ref">community.docker.docker_container_copy_into module</span></a> allows you to copy files from the control node into a container.</p>
</dd>
<dt>docker_container_exec</dt><dd><p>The <a class="reference internal" href="../docker_container_exec_module.html#ansible-collections-community-docker-docker-container-exec-module"><span class="std std-ref">community.docker.docker_container_exec module</span></a> allows you to execute commands in a running container.</p>
</dd>
<dt>docker_container_info module</dt><dd><p>The <a class="reference internal" href="../docker_container_info_module.html#ansible-collections-community-docker-docker-container-info-module"><span class="std std-ref">community.docker.docker_container_info module</span></a> allows you to inspect a Docker container.</p>
</dd>
<dt>docker_plugin</dt><dd><p>The <a class="reference internal" href="../docker_plugin_module.html#ansible-collections-community-docker-docker-plugin-module"><span class="std std-ref">community.docker.docker_plugin module</span></a> allows you to manage Docker plugins.</p>
</dd>
</dl>
</div></blockquote>
</section>