I'm trying to work with a jekyll site locally using vim and github, all within a docker container on my Windows 10 machine. I want to work in the container like it is a linux virtual machine with my Downloads directory as a volume and jekyll served on port 55.
My docker initialization is
docker container run -t -d -p 55:4000 -v ${PWD}:"/home/Downloads/" [container ID]
To start the jekyll site I run the following within the docker container
jekyll new my-awesome-site
cd my-awesome-site
bundle exec jekyll serve
...
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
There is nothing showing up locally at 127.0.0.1:55
What am I doing wrong?
Here is my Dockerfile
FROM: ubuntu:latest
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y git && apt-get install -y software-properties-common
RUN apt-get install -y python-pip python-dev ruby-full build-essential
RUN pip install --upgrade pip
RUN apt-get install -y vim
# build ruby configuration
RUN mkdir gems \
&& echo '# Install Ruby Gems to /gems' >> /gems/.bashrc \
&& echo 'export GEM_HOME=/gems' >> /gems/.bashrc \
&& echo 'export PATH=/gems/bin:$PATH' >> /gems/.bashrc \
&& /bin/bash -c "source /gems/.bashrc"
# install jekyll
RUN gem install jekyll bundler
EXPOSE 4000
WORKDIR /home/work
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e25f6359ce49 572 "/bin/bash" 28 minutes ago Up 28 minutes 0.0.0.0:55->4000/tcp loving_gagarin
Use bundle exec jekyll serve --host 0.0.0.0
This special host will tell jekyll to serve on all interfaces so that docker can relay the tragic to the outside world.
As a side note, don't use a port less than 1024, it may cause unexpected troubles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With