docker-github-pages icon indicating copy to clipboard operation
docker-github-pages copied to clipboard

Host configuration and access

Open AlexisBRENON opened this issue 8 years ago • 3 comments

Hi,

$ docker run --rm -v $PWD:/usr/src/app -p 4000:4000 starefossen/github-pages:latest jekyll serve --config _config.yml,_config_local.yml

_config_local.yml contains

host: 0.0.0.0
port: 4000

Output:

Configuration file: _config.yml
Configuration file: _config_local.yml
            Source: /usr/src/app
       Destination: /usr/src/app/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.808 seconds.
 Auto-regeneration: enabled for '/usr/src/app'
Configuration file: /usr/src/app/_config.yml
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

Result: generated site is inaccessible from the host via localhost:4000.

Workaround is to add --host 0.0.0.0 to the command line:

$ docker run --rm -v $PWD:/usr/src/app -p 4000:4000 starefossen/github-pages:latest jekyll serve --config _config.yml,_config_local.yml --host 0.0.0.0

Configuration file: _config.yml
Configuration file: _config_local.yml
            Source: /usr/src/app
       Destination: /usr/src/app/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.813 seconds.
 Auto-regeneration: enabled for '/usr/src/app'
Configuration file: /usr/src/app/_config.yml
    Server address: http://0.0.0.0:4000/
  Server running... press ctrl-c to stop.

See configuration files

Kind regards, Alexis.

AlexisBRENON avatar Nov 02 '16 10:11 AlexisBRENON

Good catch @AlexisBRENON. We should probably add a note about this to the README. Would you like to make a Pull Request?

Starefossen avatar Nov 02 '16 13:11 Starefossen

For sure, I can make a PR if necessary, but is there an elegant way to fix this without adding the --host option manually? An option in docker to translate requester IP or something like this...

AlexisBRENON avatar Nov 02 '16 14:11 AlexisBRENON

it seems that this issue should be closed now

Oliboy50 avatar Nov 05 '22 15:11 Oliboy50