File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,3 +166,37 @@ $containerConfig->setTty(true);
166166```
167167
168168Be aware that there is no distinction between stdout and stderr in this mode.
169+
170+
171+ ## Mounting a Volume
172+
173+ This example shows you can map your host volume ` /home/myuser/myapp ` to a container at ` /app `
174+
175+ ``` php
176+ $containerConfig->setVolumes(['/home/myuser/myapp' => (object) []]);
177+
178+ $hostConfig = new HostConfig();
179+ // hostpath:containerpath
180+ $hostConfig->setBinds(['/home/myuser/myapp:/app']);
181+
182+ $containerConfig->setHostConfig($hostConfig);
183+ ```
184+
185+ ## Port Mapping
186+
187+ This example shows how you can map port 8080 on your host machine to port 80 on the container.
188+
189+ ``` php
190+ $containerConfig->setTty(true);
191+ $containerConfig->setExposedPorts(['80/tcp' => (object)[]]);
192+
193+ $portBinding = new PortBinding();
194+ $portBinding->setHostPort('8080');
195+ $portBinding->setHostIp('0.0.0.0');
196+
197+ $portMap = new \ArrayObject();
198+ $portMap['80/tcp'] = [$portBinding];
199+
200+ $hostConfig = new HostConfig();
201+ $hostConfig->setPortBindings($portMap);
202+ ```
You can’t perform that action at this time.
0 commit comments