You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<liclass="toctree-l2"><aclass="reference internal" href="index.html#what-is-the-docker-proxy-stack">What is the Docker-Proxy-Stack?</a></li>
57
+
<liclass="toctree-l2"><aclass="reference internal" href="index.html#how-does-the-proxy-stack-work">How does the Proxy-Stack work?</a></li>
58
+
<liclass="toctree-l2"><aclass="reference internal" href="index.html#how-to-add-projects-to-the-docker-proxy-network">How to add Projects to the Docker Proxy Network</a></li>
<spanid="docs-docker-proxy-dockerexec"></span><h1>DockerExec<aclass="headerlink" href="#dockerexec" title="Permalink to this headline"></a></h1>
90
+
<p>To simplify most of the aforementioned tasks and add additional functionality for usual interactions with the
91
+
Docker-Proxy-Stack, we provice the Bash script <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span></code>.</p>
92
+
<sectionid="advantages">
93
+
<h2>Advantages<aclass="headerlink" href="#advantages" title="Permalink to this headline"></a></h2>
94
+
<olclass="arabic simple">
95
+
<li><p>Concise commands for Docker and Docker-Compose.</p></li>
96
+
<li><p>Perform additional tasks like stopping all local Docker containers or remove old image layers.</p></li>
97
+
<li><p>Update local <codeclass="docutils literal notranslate"><spanclass="pre">/etc/hosts</span></code> automatically.</p></li>
98
+
<li><p>Synchronize the containers <codeclass="docutils literal notranslate"><spanclass="pre">/etc/hosts</span></code> files automatically.</p></li>
99
+
<li><p>Starting up a project will print the projects domain to your command line.</p></li>
100
+
<li><p>Helps with “spawning” new global containers for the network.</p></li>
101
+
</ol>
102
+
</section>
103
+
<sectionid="how-to-use-dockerexec">
104
+
<h2>How to use DockerExec?<aclass="headerlink" href="#how-to-use-dockerexec" title="Permalink to this headline"></a></h2>
105
+
<olclass="arabic simple">
106
+
<li><p>Try and follow <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">help</span></code> for a list of commands.</p></li>
107
+
</ol>
108
+
</section>
109
+
<sectionid="limitations-of-dockerexec">
110
+
<h2>Limitations of DockerExec<aclass="headerlink" href="#limitations-of-dockerexec" title="Permalink to this headline"></a></h2>
111
+
<p>At this point some variables and configuration are hard coded and have to be set manually for a new project.
112
+
You also need Bash. <codeclass="docutils literal notranslate"><spanclass="pre">/bin/sh</span></code> will not suffice.</p>
113
+
<olclass="arabic simple">
114
+
<li><p>Your projects Docker-Compose file has to have the name <codeclass="docutils literal notranslate"><spanclass="pre">docker-compose.proxy.y(a)ml</span></code>.</p>
115
+
<ulclass="simple">
116
+
<li><p>Depending on your environment there can also be a <codeclass="docutils literal notranslate"><spanclass="pre">docker-compose.prod.y(a)ml</span></code> or for a single Compose file
117
+
<codeclass="docutils literal notranslate"><spanclass="pre">docker-compose.y(a)ml</span></code>. These are not suited for local dev environments.</p></li>
118
+
</ul>
119
+
</li>
120
+
<li><p>You have to provide a <codeclass="docutils literal notranslate"><spanclass="pre">.env</span></code> file in your project root to set necessary variables. A best practice would be to
121
+
have a version-controlled <codeclass="docutils literal notranslate"><spanclass="pre">.env.template</span></code> which you copy over to <codeclass="docutils literal notranslate"><spanclass="pre">.env</span></code> and customize on deployment.</p></li>
122
+
</ol>
123
+
</section>
124
+
<sectionid="spawn-global-network-containers">
125
+
<spanid="docs-docker-proxy-spawn-instructions"></span><h2>Spawn global network containers<aclass="headerlink" href="#spawn-global-network-containers" title="Permalink to this headline"></a></h2>
126
+
<p>Having the Docker-Proxy-Stack installed, you are still missing services. With its new configuration in v2, the only
127
+
container that is ensured on every init is the NGINX proxy, which will allow the basics. If you like to start a MySQL
128
+
database with your stack, you have to “spawn” and enable this container first. To do that, the
129
+
<codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">spawn</span><spanclass="pre">create</span></code> should be prefered.</p>
130
+
<p>This command will ask you the mandatory question for any container that will be started on init. Just pass a name and
131
+
the docker image to do so, e.g. “mysql5” and “mysql:5.7”. By telling the process to enable the container, a soft link
132
+
will be created for you. Then hit <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">proxy</span><spanclass="pre">init</span></code> to see the result.</p>
133
+
<p>As the example above, any service container can be added to the stack. Try more databases like PostgreSQL, add a Redis
134
+
or dev tools like the Adminer. You could also add <aclass="reference external" href="https://github.com/mcuadros/ofelia">Ofelia</a> for cron jobs or
135
+
<aclass="reference external" href="https://hub.docker.com/r/collabora/code">Collabora</a> for editing office files. Whatever fits your needs.</p>
136
+
<p>If you need to configured the basic start of a container, e.g. with command parameters, volumes or environment
137
+
variables, just head to the Docker-Proxy-Stack installation directory, open the spawned container behind
138
+
<codeclass="docutils literal notranslate"><spanclass="pre">spawns-available/{container-name}</span></code> with an editor and change the file until it matches your setup. Don’t forget to
139
+
restart the stack.</p>
140
+
<p>As the <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">proxy</span><spanclass="pre">init</span></code> will only start the containers within the <codeclass="docutils literal notranslate"><spanclass="pre">path/to/Docker-Proxy/spawns-enabled</span></code>
141
+
directory, you can use the <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">spawn</span><spanclass="pre">enabled/disable</span><spanclass="pre">{filename}</span></code> command, to link those necessary files. Keep
142
+
in mind to restart the Proxy-Stack, so the changes can take effect.</p>
143
+
</section>
144
+
<sectionid="a-minimal-configuration-for-php">
145
+
<h2>A Minimal Configuration for PHP<aclass="headerlink" href="#a-minimal-configuration-for-php" title="Permalink to this headline"></a></h2>
146
+
<p>Some environment variables cannot be read from the <codeclass="docutils literal notranslate"><spanclass="pre">.env</span></code> file and have to be manually added to the container under
147
+
<codeclass="docutils literal notranslate"><spanclass="pre">environment</span></code>. E.g. the domain name.</p>
<p>These files can be created within any current directory with the <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">proxy</span><spanclass="pre">generate</span><spanclass="pre">${project-name}</span></code> command.
211
+
See <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">help</span></code> for better usage info.</p>
212
+
<p>Use the <codeclass="docutils literal notranslate"><spanclass="pre">START_CONTAINER</span></code> variable to define the container, that will be allocated with <codeclass="docutils literal notranslate"><spanclass="pre">docker</span><spanclass="pre">exec</span><spanclass="pre">-it</span></code> at the
213
+
end of a <codeclass="docutils literal notranslate"><spanclass="pre">DockerExec</span><spanclass="pre">(dev|prod|proxy)</span><spanclass="pre">start</span></code> command. If <codeclass="docutils literal notranslate"><spanclass="pre">START_CONTAINER=none</span></code> is set, the <codeclass="docutils literal notranslate"><spanclass="pre">docker</span><spanclass="pre">exec</span></code> will be
214
+
omitted. If not defined, it falls back to search for the first container with <codeclass="docutils literal notranslate"><spanclass="pre">-app</span></code> suffix.</p>
0 commit comments