mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-15 19:42:06 +00:00
297 lines
22 KiB
HTML
297 lines
22 KiB
HTML
|
||
|
||
<!DOCTYPE html>
|
||
<html class="writer-html5" lang="en" data-content_root="./">
|
||
<head>
|
||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<meta content="2.23.0" name="antsibull-docs" />
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>community.docker.nsenter connection – execute on host running controller container — Community.Docker Collection documentation</title>
|
||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=41de9001" />
|
||
<link rel="stylesheet" type="text/css" href="_static/css/ansible.css?v=b54c304f" />
|
||
<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"/>
|
||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
||
<script src="_static/documentation_options.js?v=7f41d439"></script>
|
||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<script src="_static/js/theme.js"></script>
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="community.docker.docker_containers inventory – Ansible dynamic inventory plugin for Docker containers" href="docker_containers_inventory.html" />
|
||
<link rel="prev" title="community.docker.docker_api connection – Run tasks in docker containers" href="docker_api_connection.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
|
||
|
||
|
||
|
||
|
||
</head>
|
||
|
||
<body class="wy-body-for-nav"><!-- extra body elements for Ansible beyond RTD Sphinx Theme -->
|
||
|
||
<div class="DocSite-globalNav ansibleNav">
|
||
<ul>
|
||
<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>
|
||
|
||
<a class="DocSite-nav" href="https://ansible-collections.github.io/community.docker/branch/main/" style="padding-bottom: 30px;">
|
||
|
||
<img class="DocSiteNav-logo"
|
||
src="_static/images/Ansible-Mark-RGB_White.png"
|
||
alt="Ansible Logo">
|
||
<div class="DocSiteNav-title">Community.Docker Collection Docs</div>
|
||
</a>
|
||
<div class="wy-grid-for-nav">
|
||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||
<div class="wy-side-scroll">
|
||
<div class="wy-side-nav-search" >
|
||
|
||
|
||
|
||
<a href="index.html" class="icon icon-home">
|
||
Community.Docker Collection
|
||
</a><!--- Based on https://github.com/rtfd/sphinx_rtd_theme/pull/438/files -->
|
||
|
||
<div class="version">
|
||
|
||
|
||
|
||
</div>
|
||
<div role="search">
|
||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
||
<label class="sr-only" for="q">Search docs:</label>
|
||
<input type="text" class="st-default-search-input" id="q" name="q" placeholder="Search docs" />
|
||
<input type="hidden" name="check_keywords" value="yes" />
|
||
<input type="hidden" name="area" value="default" />
|
||
</form>
|
||
</div>
|
||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Community.Docker Release Notes</a></li>
|
||
</ul>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="docsite/scenario_guide.html">Docker Guide</a></li>
|
||
</ul>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="current_container_facts_module.html">community.docker.current_container_facts module – Return facts about whether the module runs in a container</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_compose_v2_module.html">community.docker.docker_compose_v2 module – Manage multi-container Docker applications with Docker Compose CLI plugin</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_compose_v2_exec_module.html">community.docker.docker_compose_v2_exec module – Run command in a container of a Compose service</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_compose_v2_pull_module.html">community.docker.docker_compose_v2_pull module – Pull a Docker compose project</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_compose_v2_run_module.html">community.docker.docker_compose_v2_run module – Run command in a new container of a Compose service</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_config_module.html">community.docker.docker_config module – Manage docker configs</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_container_module.html">community.docker.docker_container module – manage Docker containers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_container_copy_into_module.html">community.docker.docker_container_copy_into module – Copy a file into a Docker container</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_container_exec_module.html">community.docker.docker_container_exec module – Execute command in a docker container</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_container_info_module.html">community.docker.docker_container_info module – Retrieves facts about docker container</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_context_info_module.html">community.docker.docker_context_info module – Retrieve information on Docker contexts for the current user</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_host_info_module.html">community.docker.docker_host_info module – Retrieves facts about docker host and lists of objects of the services</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_module.html">community.docker.docker_image module – Manage docker images</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_build_module.html">community.docker.docker_image_build module – Build Docker images using Docker buildx</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_export_module.html">community.docker.docker_image_export module – Export (archive) Docker images</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_info_module.html">community.docker.docker_image_info module – Inspect docker images</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_load_module.html">community.docker.docker_image_load module – Load docker image(s) from archives</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_pull_module.html">community.docker.docker_image_pull module – Pull Docker images from registries</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_push_module.html">community.docker.docker_image_push module – Push Docker images to registries</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_remove_module.html">community.docker.docker_image_remove module – Remove Docker images</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_image_tag_module.html">community.docker.docker_image_tag module – Tag Docker images with new names and/or tags</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_login_module.html">community.docker.docker_login module – Log into a Docker registry</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_network_module.html">community.docker.docker_network module – Manage Docker networks</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_network_info_module.html">community.docker.docker_network_info module – Retrieves facts about docker network</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_node_module.html">community.docker.docker_node module – Manage Docker Swarm node</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_node_info_module.html">community.docker.docker_node_info module – Retrieves facts about docker swarm node from Swarm Manager</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_plugin_module.html">community.docker.docker_plugin module – Manage Docker plugins</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_prune_module.html">community.docker.docker_prune module – Allows to prune various docker objects</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_secret_module.html">community.docker.docker_secret module – Manage docker secrets</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_stack_module.html">community.docker.docker_stack module – docker stack module</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_stack_info_module.html">community.docker.docker_stack_info module – Return information on all docker stacks</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_stack_task_info_module.html">community.docker.docker_stack_task_info module – Return information of the tasks on a docker stack</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_swarm_module.html">community.docker.docker_swarm module – Manage Swarm cluster</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_swarm_info_module.html">community.docker.docker_swarm_info module – Retrieves facts about Docker Swarm cluster</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_swarm_service_module.html">community.docker.docker_swarm_service module – docker swarm service</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_swarm_service_info_module.html">community.docker.docker_swarm_service_info module – Retrieves information about docker services from a Swarm Manager</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_volume_module.html">community.docker.docker_volume module – Manage Docker volumes</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_volume_info_module.html">community.docker.docker_volume_info module – Retrieve facts about Docker volumes</a></li>
|
||
</ul>
|
||
<ul class="current">
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_connection.html">community.docker.docker connection – Run tasks in docker containers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_api_connection.html">community.docker.docker_api connection – Run tasks in docker containers</a></li>
|
||
<li class="toctree-l1 current"><a class="current reference internal" href="#">community.docker.nsenter connection – execute on host running controller container</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="#synopsis">Synopsis</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#parameters">Parameters</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#notes">Notes</a><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="#authors">Authors</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#collection-links">Collection links</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_containers_inventory.html">community.docker.docker_containers inventory – Ansible dynamic inventory plugin for Docker containers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_machine_inventory.html">community.docker.docker_machine inventory – Docker Machine inventory source</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="docker_swarm_inventory.html">community.docker.docker_swarm inventory – Ansible dynamic inventory plugin for Docker swarm nodes</a></li>
|
||
</ul>
|
||
<!-- extra nav elements for Ansible beyond RTD Sphinx Theme -->
|
||
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||
<a href="index.html">Community.Docker Collection</a>
|
||
</nav>
|
||
|
||
<div class="wy-nav-content">
|
||
<div class="rst-content">
|
||
<div role="navigation" aria-label="Page navigation">
|
||
<ul class="wy-breadcrumbs">
|
||
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
|
||
<li class="breadcrumb-item active">community.docker.nsenter connection – execute on host running controller container</li>
|
||
<li class="wy-breadcrumbs-aside">
|
||
<!-- User defined GitHub URL -->
|
||
<a href="https://github.com/ansible-collections/community.docker/edit/main/plugins/connection/nsenter.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!—%20Your%20description%20here%20–%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> Edit on GitHub</a>
|
||
</li>
|
||
</ul>
|
||
<hr/>
|
||
</div>
|
||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||
|
||
|
||
<div itemprop="articleBody">
|
||
|
||
<span class="target" id="ansible-collections-community-docker-nsenter-connection"></span><section id="community-docker-nsenter-connection-execute-on-host-running-controller-container">
|
||
<h1>community.docker.nsenter connection – execute on host running controller container<a class="headerlink" href="#community-docker-nsenter-connection-execute-on-host-running-controller-container" title="Link to this heading"></a></h1>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This connection plugin is part of the <a class="reference external" href="https://galaxy.ansible.com/ui/repo/published/community/docker/">community.docker collection</a> (version 5.1.0).</p>
|
||
<p>It is not included in <code class="docutils literal notranslate"><span class="pre">ansible-core</span></code>.
|
||
To check whether it is installed, run <code class="code docutils literal notranslate"><span class="pre">ansible-galaxy</span> <span class="pre">collection</span> <span class="pre">list</span></code>.</p>
|
||
<p>To install it, use: <code class="code docutils literal notranslate"><span class="pre">ansible-galaxy</span> <span class="pre">collection</span> <span class="pre">install</span> <span class="pre">community.docker</span></code>.</p>
|
||
<p>To use it in a playbook, specify: <code class="code docutils literal notranslate"><span class="pre">community.docker.nsenter</span></code>.</p>
|
||
</div>
|
||
<p class="ansible-version-added">New in community.docker 1.9.0</p>
|
||
<nav class="contents local" id="contents">
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="#synopsis" id="id1">Synopsis</a></p></li>
|
||
<li><p><a class="reference internal" href="#parameters" id="id2">Parameters</a></p></li>
|
||
<li><p><a class="reference internal" href="#notes" id="id3">Notes</a></p></li>
|
||
</ul>
|
||
</nav>
|
||
<section id="synopsis">
|
||
<h2><a class="toc-backref" href="#id1" role="doc-backlink">Synopsis</a><a class="headerlink" href="#synopsis" title="Link to this heading"></a></h2>
|
||
<ul class="simple">
|
||
<li><p>This connection plugin allows Ansible, running in a privileged container, to execute tasks on the container host instead of in the container itself.</p></li>
|
||
<li><p>This is useful for running Ansible in a pull model, while still keeping the Ansible control node containerized.</p></li>
|
||
<li><p>It relies on having privileged access to run <code class="docutils literal notranslate"><span class="pre">nsenter</span></code> in the host’s PID namespace, allowing it to enter the namespaces of the provided PID (default PID 1, or init/systemd).</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="parameters">
|
||
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Parameters</a><a class="headerlink" href="#parameters" title="Link to this heading"></a></h2>
|
||
<table class="longtable ansible-option-table docutils align-default" style="width: 100%">
|
||
<thead>
|
||
<tr class="row-odd"><th class="head"><p>Parameter</p></th>
|
||
<th class="head"><p>Comments</p></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr class="row-even"><td><div class="ansible-option-cell">
|
||
<div class="ansibleOptionAnchor" id="parameter-nsenter_pid"></div><p class="ansible-option-title" id="ansible-collections-community-docker-nsenter-connection-parameter-nsenter-pid"><strong>nsenter_pid</strong></p>
|
||
<a class="ansibleOptionLink" href="#parameter-nsenter_pid" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span></p>
|
||
</div></td>
|
||
<td><div class="ansible-option-cell"><p>PID to attach with using nsenter.</p>
|
||
<p>The default should be fine unless you are attaching as a non-root user.</p>
|
||
<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">1</span></code></p>
|
||
<p class="ansible-option-line"><strong class="ansible-option-configuration">Configuration:</strong></p>
|
||
<ul>
|
||
<li><p>INI entry:</p>
|
||
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[nsenter_connection]</span>
|
||
<span class="na">nsenter_pid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Environment variable: <span class="target" id="index-0"></span><a class="reference internal" href="environment_variables.html#envvar-ANSIBLE_NSENTER_PID"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">ANSIBLE_NSENTER_PID</span></code></a></p></li>
|
||
<li><p>Variable: ansible_nsenter_pid</p></li>
|
||
</ul>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Configuration entries listed above for each entry type (Ansible variable, environment variable, and so on) have a low to high priority order.
|
||
For example, a variable that is lower in the list will override a variable that is higher up.
|
||
The entry types are also ordered by precedence from low to high priority order.
|
||
For example, an ansible.cfg entry (further up in the list) is overwritten by an Ansible variable (further down in the list).</p>
|
||
</div>
|
||
</section>
|
||
<section id="notes">
|
||
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Notes</a><a class="headerlink" href="#notes" title="Link to this heading"></a></h2>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<ul class="simple">
|
||
<li><p>The remote user is ignored; this plugin always runs as root.</p></li>
|
||
<li><p>This plugin requires the Ansible controller container to be launched in the following way: (1) The container image contains the <code class="docutils literal notranslate"><span class="pre">nsenter</span></code> program; (2) The container is launched in privileged mode; (3) The container is launched in the host’s PID namespace (<code class="docutils literal notranslate"><span class="pre">--pid</span> <span class="pre">host</span></code>).</p></li>
|
||
</ul>
|
||
</div>
|
||
<section id="authors">
|
||
<h3>Authors<a class="headerlink" href="#authors" title="Link to this heading"></a></h3>
|
||
<ul class="simple">
|
||
<li><p>Jeff Goldschrafe (@jgoldschrafe)</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="collection-links">
|
||
<h3>Collection links<a class="headerlink" href="#collection-links" title="Link to this heading"></a></h3>
|
||
<ul class="ansible-links">
|
||
<li><span><a aria-role="button" class="ansible-link reference external" href="https://github.com/ansible-collections/community.docker/issues" rel="noopener external" target="_blank">Issue Tracker</a></span></li>
|
||
<li><span><a aria-role="button" class="ansible-link reference external" href="https://github.com/ansible-collections/community.docker" rel="noopener external" target="_blank">Repository (Sources)</a></span></li>
|
||
<li><span><a aria-role="button" class="ansible-link reference external" href="https://forum.ansible.com/tags/c/help/6/none/docker" rel="noopener external" target="_blank">Ask for help (Docker)</a></span></li>
|
||
<li><span><a aria-role="button" class="ansible-link reference external" href="https://forum.ansible.com/tags/c/help/6/none/docker-compose" rel="noopener external" target="_blank">Ask for help (Docker Compose)</a></span></li>
|
||
<li><span><a aria-role="button" class="ansible-link reference external" href="https://forum.ansible.com/tags/c/help/6/none/docker-swarm" rel="noopener external" target="_blank">Ask for help (Docker Swarm)</a></span></li>
|
||
<li><span><a aria-role="button" class="ansible-link reference external" href="https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&template=bug_report.md" rel="noopener external" target="_blank">Submit a bug report</a></span></li>
|
||
<li><span><a aria-role="button" class="ansible-link reference external" href="https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&template=feature_request.md" rel="noopener external" target="_blank">Request a feature</a></span></li>
|
||
<li><span><a class="reference internal" href="index.html#communication-for-community-docker"><span class="std std-ref">Communication</span></a></span></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||
<a href="docker_api_connection.html" class="btn btn-neutral float-left" title="community.docker.docker_api connection – Run tasks in docker containers" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||
<a href="docker_containers_inventory.html" class="btn btn-neutral float-right" title="community.docker.docker_containers inventory – Ansible dynamic inventory plugin for Docker containers" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||
</div>
|
||
|
||
<hr/>
|
||
|
||
<div role="contentinfo">
|
||
<p>© Copyright Community.Docker Contributors.</p>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</footer>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
<script>
|
||
jQuery(function () {
|
||
SphinxRtdTheme.Navigation.enable(true);
|
||
});
|
||
</script><!-- extra footer elements for Ansible beyond RTD Sphinx Theme -->
|
||
|
||
</body>
|
||
</html> |