DEV Community

Shahriyar Al Mustakim Mitul
Shahriyar Al Mustakim Mitul

Posted on

Docker series (Part 13): Edit codes running in containers using Bind Mounts

The tasks we will complete in this blog

Image description

So for this assignment, we will use this repository

Let's fork it and clone it in our system. Then go to the bindmount-sample-1 folder

Image description
You can also see files within it

Image description

Oh! by the way if you don't know what is Jekyll, here it is

  1. First we will go to the folder and create a container from this image

Image description

docker container run -p 80:4000 -v $(pwd):/site bretfisher/jekyll-serve
Enter fullscreen mode Exit fullscreen mode

here we set the port from 80 to 4000

volume had set to current directory using $(pwd) . Also we used /site to specify the images volumes to be directed to local directory $(pwd)

You can know more from here

Now you can see the server up and running

Image description

Go to localhost and you can see this

Image description

  1. GO to the "Welcome to Jekyll " link Image description

You can also view this from VS code

Image description

  1. Now lets change something from this file. We are changing the title from "title: "Welcome to Jekyll!" to "title: "Welcome to Jekyll! by Mitul" and save it

If you go to the terminal, you can see changes

Image description

  1. Refresh the website page (localhost)

Image description
Done!

Top comments (0)