Using Jekyll With Docker
While figuring out how to move my site to Netlify I came to the conclussion I needed to update the Ruby and Jekyll versions. I thought this would be a great opportunity to learn Docker, so I don’t need to install software.
I checked a few introductory courses to Docker. The one that summarized everything in a succint and clear way was this one by Nana.
Then I was on the search for a good docker image for jekyll. This image by Bret Fisher is the one I chose (they are actually two images, one for cli and one for serving). The commands I use are as follows:
I only used this command once to create the site from scratch
docker run -v $(pwd):/site bretfisher/jekyll new .
Then with this command the the site is served
docker run -p 8080:4000 -v $(pwd):/site bretfisher/jekyll-serve
Once the container was created with the previous command, now I can simply use docker start
and docker stop
to serve or stop serving the site in localhost.
docker start my-docker-container-name
docker stop my-docker-container-name