Unit 2 Chapter 3: Swift Linux Web Site
In this chapter, you will run a legacy Hugo app, my Swift Linux web site. Yes, I used my Hugo Neutrino tool to create it, and it includes a Dockerfile and docker-compose.yml file.
Building the App
- In a shell terminal, enter the following commands:
cd
mkdir -p docker-hugo
cd docker-hugo
git clone https://gitlab.com/swiftlinux/swiftlinux-org-hugo
- Enter the command
cd swiftlinux-org-hugo
to enter the app's root directory. - Enter the command
bash build.sh; bash server.sh
to build the Hugo app and run the local server. When the process is finished, you can move on to the next step.
Viewing the App
- In your terminal shell, run the command
bash build.sh; bash server.sh
to build the Hugo app and run the local server. - Open your web browser, and go to the URL http://localhost:1313/ on your host system. The Swift Linux Hugo app should now appear. Leave the Hugo server running for now. (You'll stop when it's time to clean up at the end of this chapter.)
Docker Container and Images
- Start a new shell terminal tab for entering additional commands.
- Enter the command
docker ps -a
to list all of the Docker containers. The result should look something like this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
86d0eb9e295e swiftlinux-org-hugo_hugo "hugo server -D --bi…" 7 minutes ago Up 7 minutes 0.0.0.0:1313->1313/tcp swiftlinux-org-hugo_hugo_1
5e496ae7164a 933ecde331b1 "/bin/sh -c 'cat /et…" 14 minutes ago Exited (0) 13 minutes ago epic_roentgen
- Note that two Docker containers are shown above. The first container is dedicated to running the Hugo server. The second container was dedicated to building the app. Note that this container was terminated as soon as the build process was completed.
- Enter the command
docker images -a
to list all of the Docker images. The result should look something like this:
REPOSITORY TAG IMAGE ID CREATED SIZE
swiftlinux-org-hugo_hugo latest af7a9047dfbd 18 minutes ago 314MB
<none> <none> e784db773122 18 minutes ago 314MB
<none> <none> ed1ddf8bc4df 18 minutes ago 314MB
<none> <none> 70cbf365da03 24 minutes ago 117MB
<none> <none> 933ecde331b1 24 minutes ago 117MB
debian testing afb6626cbf32 13 days ago 117MB
- Note that the "debian:testing" Docker image was used by the Dockerfile to create the "swiftlinux-org-hugo_hugo" image, the basis for the above Docker container..
- The "none" images are the results of intermediate steps in the process of creating the "swiftlinux-org-hugo_hugo" image from the "debian:testing" Docker image.
Cleaning Up Docker
- In the shell terminal tab dedicated to the host OS, run the nuke.sh script by entering the command
bash nuke.sh
. This removes the excess Docker networks, all Docker containers, and all Docker images. - The Hugo server you started earlier in this chapter was automatically shut down during the process of removing the Docker container that it ran in.
Deleting the App
Open the file manager app in the host OS, and delete your app from there. Because is owned by your username instead of by root, you do NOT need to be root to delete it, and there should be no permission issues.