Docker Community Forums

Share and learn in the Docker community.

Accessing container port from the outside fails

docker

(Toogley) #1

Hello.

I have this Dockerfile:

FROM fedora:latest

RUN dnf update --assumeyes
RUN dnf install --assumeyes ruby-devel
RUN dnf install --assumeyes rubygems
RUN dnf install --assumeyes rubygems-devel
RUN dnf install --assumeyes libffi
RUN dnf install --assumeyes libffi-devel

# jekyll things 
RUN  dnf install --assumeyes rubygem-jekyll
RUN  dnf install --assumeyes rubygem-rb-inotify
RUN  gem install jekyll-gist
RUN  gem install jekyll-paginate
RUN  gem install jekyll-sass-converter
RUN  gem install jekyll-sitemap

# tools
RUN dnf install --assumeyes git
RUN dnf install --assumeyes tmux

RUN git clone https://github.com/neomutt/neomutt.github.io.git
EXPOSE 4000

RUN ["/bin/bash"]

After the following steps:
$ sudo docker build -t fedora-jekyll .
$ sudo docker run --publish-all=true -it fedora-jekyll /bin/bash
[root@014b16f40ef4 /]# cd neomutt.github.io/ && jekyll serve
Configuration file: /neomutt.github.io/_config.yml
Configuration file: /neomutt.github.io/_config.yml
Source: .
Destination: ./_site
Incremental build: disabled. Enable with --incremental
Generating…
Liquid Warning: Liquid syntax error (line 18): Unexpected character / in “{{https://github.com/p.nick}}” in feed.xml
done in 6.408 seconds.
Auto-regeneration: enabled for '.'
Configuration file: /neomutt.github.io/_config.yml
Server address: http://127.0.0.1:4000/
Server running… press ctrl-c to stop.

i can’t access the url http://127.0.0.1:4000/ from the host, but i can from inside the container. How can i fix this?