Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c64f3b

Browse files
author
Steve Johnson
authored
Update DevBox documentation with instructions for setting static listen ports (magento#775)
* Add static port section * Proofreading
1 parent 8e67d23 commit 6c64f3b

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

guides/v2.0/install-gde/docker/docker-ref.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,10 @@ The following DevBox scripts and configuration files are located in the root fol
275275
* `m2devbox-init.[bat|sh]` which starts the DevBox installation.
276276
* `m2devbox-reset.[bat|sh]` which restarts the DevBox installation.
277277

278-
You can run this script, for example, after you stop and start your computer or Docker. DevBox assigns new ports to services; to find the new ports, see [Stop, start, restart, and view port mappings]({{ page.baseurl }}install-gde/docker/docker-commands.html#cloud-docker-cmds-stopstart).
278+
You can run this script, for example, after you stop and start your computer or Docker. DevBox assigns new ports to services. You can do the following:
279+
280+
* To set static listen ports that don't change every time you restart a container, see [Set static listen ports](#devbox-static-port) _before_ you run `m2devbox-init.[bat|sh]`
281+
* To find the listen ports currently being used, see [Stop, start, restart, and view port mappings]({{ page.baseurl }}install-gde/docker/docker-commands.html#cloud-docker-cmds-stopstart).
279282

280283
* `docker-compose.yml` DevBox configuration file.
281284

@@ -289,5 +292,29 @@ When you run the installation script on Windows, an additional command window op
289292
Do not close the Unison sync window; otherwise, files you change won't be added to the Magento docroot.
290293
</div>
291294

295+
### Set static listen ports {#devbox-static-port}
296+
By default, every time you start a Docker container, all listen ports are reassigned randomly. To cause DevBox to use the same listen ports every time you restart, you must modify `docker-compose.yml` _before you initialize_ DevBox for the first time.
297+
298+
To set static listen ports:
299+
300+
1. Open `docker-compose.yml` in a text editor.
301+
302+
It's located in the root directory to which you downloaded DevBox.
303+
2. Locate the `ports:` section.
304+
3. Precede the default listen port with a free port number followed by `:`
305+
306+
An example follows.
307+
308+
ports:
309+
- "12345:80"
310+
- "54321:22"
311+
312+
The preceding example causes the web container to listen on port 12345 and SSH to listen on port 54321.
313+
314+
<div class="bs-callout bs-callout-warning" id="warning" markdown="1">
315+
Make sure the ports you assign to DevBox are not used by another process.
316+
</div>
317+
4. Save your changes to `docker-compose.yml` and exit the text editor.
318+
292319
#### Next step
293320
[PhpStorm prerequisites]({{ page.baseurl }}install-gde/docker/docker-phpstorm-prereq.html)

0 commit comments

Comments
 (0)