From b8fd98ab3c31db49a3b8eca563f3d8b590ae210b Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Fri, 1 Nov 2024 08:59:16 -0400 Subject: [PATCH] Specify a local address when exposing ports with Docker (#20891) * Specify a local address when exposing ports with Docker cf. https://docs.docker.com/engine/reference/commandline/run/#publish-or-expose-port--p---expose Signed-off-by: Richard Gibson * Provide and explain docker run examples with and without confinement to localhost Signed-off-by: Richard Gibson * Update README.md Co-authored-by: Richard Gibson --------- Signed-off-by: Richard Gibson Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- docs/install.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/install.md b/docs/install.md index af8f0e7eac..1c182cdd34 100644 --- a/docs/install.md +++ b/docs/install.md @@ -41,7 +41,15 @@ The Docker image can be used to serve element-web as a web server. The easiest w it is to use the prebuilt image: ```bash -docker run -p 80:80 vectorim/element-web +docker run --rm -p 127.0.0.1:80:80 vectorim/element-web +``` + +A server can also be made available to clients outside the local host by omitting the +explicit local address as described in +[docker run documentation](https://docs.docker.com/engine/reference/commandline/run/#publish-or-expose-port--p---expose): + +```bash +docker run --rm -p 80:80 vectorim/element-web ``` To supply your own custom `config.json`, map a volume to `/app/config.json`. For example, @@ -49,7 +57,7 @@ if your custom config was located at `/etc/element-web/config.json` then your Do would be: ```bash -docker run -p 80:80 -v /etc/element-web/config.json:/app/config.json vectorim/element-web +docker run --rm -p 127.0.0.1:80:80 -v /etc/element-web/config.json:/app/config.json vectorim/element-web ``` To build the image yourself: