@@ -107,44 +107,59 @@ HTML styled "just right".
107107Jekyll will print a local URL where the site can be viewed (usually,
108108[ http://0.0.0.0:4000/ ] ( http://0.0.0.0:4000/ ) ).
109109
110- ### Testing using Docker environment
110+ ### Testing using a Container environment
111+
112+ Note: The example commands below use ` podman ` , but you can replace it with a
113+ compatible tool, such as ` docker ` .
111114
112115A containerized development environment can be built using the local
113- Dockerfile . You can build it with the following command:
116+ Containerfile . You can build it with the following command:
114117
115118``` bash
116- docker build -t webdev .
119+ podman build -t webdev -f Containerfile .
117120```
118121
119122This action will produce a ` webdev ` image, with all the website's build
120- prerequisites preinstalled. When a container is run from this image, it
121- will perform a ` jekyll serve ` command with the polling option enabled,
122- so that changes you make locally will be immediately reflected after
123- reloading the page in your browser.
124-
125- When you run a container using the webdev image, your current working
126- directory will be mounted, so that any changes made by the build inside
127- the container will be reflected in your local workspace. This is done with
128- the ` -v ` flag. To run the container, execute the following command:
123+ prerequisites preinstalled. When a container is run from this image, it will
124+ perform a ` jekyll serve ` command with the polling option enabled, so that
125+ changes you make locally will be immediately reflected after reloading the page
126+ in your browser. To run the container, execute the following command:
129127
130128``` bash
131- docker run -d - v " $PWD " :/mnt/workdir -p 4000:4000 webdev
129+ podman run -i -t --rm - v " $( pwd ) " :/mnt/workdir:Z -p 4000:4000 webdev
132130```
133131
132+ Flags used in this command are as follows:
133+
134+ * ` -i ` : run interactively, to send keyboard commands to the process
135+ * ` -t ` : allocate a psuedo-TTY, to send signals like with Ctrl-C to exit
136+ * ` --rm ` : clean up the container resources after exiting
137+ * ` -v "$(pwd)":/mnt/workdir:Z ` : mount your current working directory, so that
138+ any changes made by the build inside the container will be reflected in the
139+ local workspace on the host; ` :Z ` causes the host files to be labeled for
140+ SELinux, so the container can access them; the most recent container running
141+ will relabel for its own access; use lower-case ` :z ` instead, if you need the
142+ directory to be shared across multiple running containers at the same time;
143+ restore any labels to their system defaults with ` restorecon -RFv . ` .
144+ * ` -p 4000:4000 ` : forward port TCP from the container to the host, so you can
145+ view the served Jekyll site in a browser on the host
146+
134147While this container is running, you will be able to review the rendered website
135148in your local browser at [ http://127.0.0.1:4000/ ] ( http://127.0.0.1:4000/ ) .
136149
137150Shell access can be obtained by overriding the default container command.
138151
139- This is useful for adding new gems, or modifying the Gemfile.lock for updating
140- existing dependencies.
152+ This is useful for adding new gems to ` Gemfile ` or to run ` bundle update ` to
153+ update the existing dependencies in ` Gemfile.lock ` .
154+
155+ When using shell access, the local directory must be mounted to ensure the
156+ ` Gemfile ` and ` Gemfile.lock ` updates are reflected in your local environment so
157+ you can create a commit and submit a PR.
141158
142- When using shell access, the local directory must be mounted to ensure
143- the Gemfile and Gemfile.lock updates are reflected in your local
144- environment so you can create a commit and submit a PR.
159+ To do this, execute the same command as before, but with ` /bin/bash ` on the end:
145160
146161``` bash
147- docker run -v " $PWD " :/mnt/workdir -it webdev /bin/bash
162+ podman run -i -t --rm - v " $( pwd ) " :/mnt/workdir:Z -p 4000:4000 webdev /bin/bash
148163```
149164
150165You may need to manually delete the ` _site ` or ` .jekyll-cache ` directories if
0 commit comments