Skip to content

Instantly share code, notes, and snippets.

@mattstratton
Last active April 24, 2018 00:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattstratton/471a7e1cf781d10de47cb44b69fa3a8e to your computer and use it in GitHub Desktop.
Save mattstratton/471a7e1cf781d10de47cb44b69fa3a8e to your computer and use it in GitHub Desktop.
Docker For DevOpsDays.org

The shell script (hugoserver.sh) currently runs. The PowerShell script (hugoserver.ps1) is throwing errors, as displayed in the output.log in this gist.

To test, run git clone git@github.com:devopsdays/devopsdays-web.git and then run one of the above scripts in the cloned directory (note: the hugoserver.sh script is already part of the directory; the PowerShell script is not).

The result should look like this, if it works:

 ~/src/devopsdays-web/ [master*] ./hugoserver.sh
hugo-server
hugo-server
Started building site
0 of 2 drafts rendered
0 future content
745 pages created
10 non-page files copied
2 paginator pages created
18 tags created
0 categories created
in 18955 ms
Watching for changes in /site/{data,content,layouts,static,themes}
Serving pages from /site/public
Web Server is available at http://localhost:1313/ (bind address 0.0.0.0)
Press Ctrl+C to stop
$MyPath = (Get-Item -Path ".\" -Verbose).FullName
Write-Host $MyPath
docker stop hugo-server
docker rm hugo-server
docker run -p 1313:1313 -v ${MyPath}:/site -e VIRTUAL_HOST="${1}" --name hugo-server devopsdays/docker-hugo-server:v0.16
# !/bin/bash
#
# File: hugoserver.sh
#
# Purpose: Run the Hugo container as a local server
#
docker stop hugo-server
docker rm hugo-server
docker run -p 1313:1313 -v $(pwd):/site -e VIRTUAL_HOST="${1}" --name hugo-server devopsdays/docker-hugo-server:v0.16
PS C:\Users\Matt\src\devopsdays-web> C:\Users\Matt\src\devopsdays-web\hugoserver.ps1
C:\Users\Matt\src\devopsdays-web
hugo-server
hugo-server
docker : Error: Unable to locate Config file. Perhaps you need to create a new site.
At C:\Users\Matt\src\devopsdays-web\hugoserver.ps1:6 char:1
+ docker run -p 1313:1313 -v ${MyPath}:/site -e VIRTUAL_HOST="${1}" --n ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Error: Unable t...ate a new site.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Run `hugo help new` for details. (Unsupported Config Type "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment