Skip to content

Instantly share code, notes, and snippets.

@jm-g
Forked from jasonmp85/update-docker-docs
Last active September 23, 2016 14:58
Show Gist options
  • Save jm-g/747a0be8352cf18339f56e9db5acd1f5 to your computer and use it in GitHub Desktop.
Save jm-g/747a0be8352cf18339f56e9db5acd1f5 to your computer and use it in GitHub Desktop.
Install Docker man pages for your Docker version
#!/bin/bash
# make bash behave
set -euo pipefail
IFS=$'\n\t'
# adapted from: http://stackoverflow.com/a/32239112
# create tmpdir and register cleanup callback
tmpdir=$(mktemp -d ~/.docker-man.XXXXXXXX)
cd "${tmpdir}"
function cleanup {
# docker-clean -c
rm -rf "${tmpdir}"
}
trap cleanup EXIT
# ensure we're getting the right doc version
dockerversion=$(docker version -f '{{ .Client.Version }}')
git clone --quiet --branch "v${dockerversion}" --depth 1 \
https://github.com/docker/docker.git
cd docker/man
docker build -t docker/md2man .
docker run -v $(pwd):/man -w /man -i docker/md2man ./md2man-all.sh
cp -Rv man* /usr/local/share/man/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment