Skip to content

Commit fbb9223

Browse files
committed
add Scott's link checker script, and fix what it finds
Signed-off-by: Sven Dowideit <[email protected]>
1 parent 4e7fb6b commit fbb9223

39 files changed

+150
-57
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ docs-shell: docs-build
5555
docs-release: docs-build
5656
$(DOCKER_RUN_DOCS) -e OPTIONS -e BUILD_ROOT "$(DOCKER_DOCS_IMAGE)" ./release.sh
5757

58+
docs-test: docs-build
59+
$(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./test.sh
60+
5861
test: build
5962
$(DOCKER_RUN_DOCKER) hack/make.sh binary cross test-unit test-integration test-integration-cli
6063

docs/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ In the root of the `docker` source directory:
3333
If you have any issues you need to debug, you can use `make docs-shell` and then
3434
run `mkdocs serve`
3535

36+
## Testing the links
37+
38+
You can use `make docs-test` to generate a report of missing links that are referenced in
39+
the documentation - there should be none.
40+
3641
## Adding a new document
3742

3843
New document (`.md`) files are added to the documentation builds by adding them

docs/docvalidate.py

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env python
2+
3+
""" I honestly don't even know how the hell this works, just use it. """
4+
__author__ = "Scott Stamp <[email protected]>"
5+
6+
from HTMLParser import HTMLParser
7+
from urlparse import urljoin
8+
from sys import setrecursionlimit
9+
import re
10+
import requests
11+
12+
setrecursionlimit(10000)
13+
root = 'http://localhost:8000'
14+
15+
16+
class DataHolder:
17+
18+
def __init__(self, value=None, attr_name='value'):
19+
self._attr_name = attr_name
20+
self.set(value)
21+
22+
def __call__(self, value):
23+
return self.set(value)
24+
25+
def set(self, value):
26+
setattr(self, self._attr_name, value)
27+
return value
28+
29+
def get(self):
30+
return getattr(self, self._attr_name)
31+
32+
33+
class Parser(HTMLParser):
34+
global root
35+
36+
ids = set()
37+
crawled = set()
38+
anchors = {}
39+
pages = set()
40+
save_match = DataHolder(attr_name='match')
41+
42+
def __init__(self, origin):
43+
self.origin = origin
44+
HTMLParser.__init__(self)
45+
46+
def handle_starttag(self, tag, attrs):
47+
attrs = dict(attrs)
48+
if 'href' in attrs:
49+
href = attrs['href']
50+
51+
if re.match('^{0}|\/|\#[\S]{{1,}}'.format(root), href):
52+
if self.save_match(re.search('.*\#(.*?)$', href)):
53+
if self.origin not in self.anchors:
54+
self.anchors[self.origin] = set()
55+
self.anchors[self.origin].add(
56+
self.save_match.match.groups(1)[0])
57+
58+
url = urljoin(root, href)
59+
60+
if url not in self.crawled and not re.match('^\#', href):
61+
self.crawled.add(url)
62+
Parser(url).feed(requests.get(url).content)
63+
64+
if 'id' in attrs:
65+
self.ids.add(attrs['id'])
66+
# explicit <a name=""></a> references
67+
if 'name' in attrs:
68+
self.ids.add(attrs['name'])
69+
70+
71+
r = requests.get(root)
72+
parser = Parser(root)
73+
parser.feed(r.content)
74+
for anchor in sorted(parser.anchors):
75+
if not re.match('.*/\#.*', anchor):
76+
for anchor_name in parser.anchors[anchor]:
77+
if anchor_name not in parser.ids:
78+
print 'Missing - ({0}): #{1}'.format(
79+
anchor.replace(root, ''), anchor_name)

docs/sources/articles/baseimages.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ page_keywords: Examples, Usage, base image, docker, documentation, examples
55
# Create a Base Image
66

77
So you want to create your own [*Base Image*](
8-
/terms/image/#base-image-def)? Great!
8+
/terms/image/#base-image)? Great!
99

1010
The specific process will depend heavily on the Linux distribution you
1111
want to package. We have some examples below, and you are encouraged to

docs/sources/articles/basics.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If you get `docker: command not found` or something like
1717
incomplete Docker installation or insufficient privileges to access
1818
Docker on your machine.
1919

20-
Please refer to [*Installation*](/installation/#installation-list)
20+
Please refer to [*Installation*](/installation)
2121
for installation instructions.
2222

2323
## Download a pre-built image
@@ -26,7 +26,7 @@ for installation instructions.
2626
$ sudo docker pull ubuntu
2727

2828
This will find the `ubuntu` image by name on
29-
[*Docker Hub*](/userguide/dockerrepos/#find-public-images-on-docker-hub)
29+
[*Docker Hub*](/userguide/dockerrepos/#searching-for-images)
3030
and download it from [Docker Hub](https://hub.docker.com) to a local
3131
image cache.
3232

@@ -174,6 +174,6 @@ will be stored (as a diff). See which images you already have using the
174174
You now have an image state from which you can create new instances.
175175

176176
Read more about [*Share Images via
177-
Repositories*](/userguide/dockerrepos/#working-with-the-repository) or
177+
Repositories*](/userguide/dockerrepos) or
178178
continue to the complete [*Command
179-
Line*](/reference/commandline/cli/#cli)
179+
Line*](/reference/commandline/cli)

docs/sources/articles/chef.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ page_keywords: chef, installation, usage, docker, documentation
77
> **Note**:
88
> Please note this is a community contributed installation path. The only
99
> `official` installation is using the
10-
> [*Ubuntu*](/installation/ubuntulinux/#ubuntu-linux) installation
10+
> [*Ubuntu*](/installation/ubuntulinux) installation
1111
> path. This version may sometimes be out of date.
1212
1313
## Requirements

docs/sources/articles/puppet.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ page_keywords: puppet, installation, usage, docker, documentation
66

77
> *Note:* Please note this is a community contributed installation path. The
88
> only `official` installation is using the
9-
> [*Ubuntu*](/installation/ubuntulinux/#ubuntu-linux) installation
9+
> [*Ubuntu*](/installation/ubuntulinux) installation
1010
> path. This version may sometimes be out of date.
1111
1212
## Requirements

docs/sources/articles/security.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ of another container. Of course, if the host system is setup
3333
accordingly, containers can interact with each other through their
3434
respective network interfaces — just like they can interact with
3535
external hosts. When you specify public ports for your containers or use
36-
[*links*](/userguide/dockerlinks/#working-with-links-names)
36+
[*links*](/userguide/dockerlinks)
3737
then IP traffic is allowed between containers. They can ping each other,
3838
send/receive UDP packets, and establish TCP connections, but that can be
3939
restricted if necessary. From a network architecture point of view, all

docs/sources/articles/using_supervisord.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ page_keywords: docker, supervisor, process management
66

77
> **Note**:
88
> - **If you don't like sudo** then see [*Giving non-root
9-
> access*](/installation/binaries/#dockergroup)
9+
> access*](/installation/binaries/#giving-non-root-access)
1010
1111
Traditionally a Docker container runs a single process when it is
1212
launched, for example an Apache daemon or a SSH server daemon. Often

docs/sources/examples/apt-cacher-ng.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ page_keywords: docker, example, package installation, networking, debian, ubuntu
66

77
> **Note**:
88
> - **If you don't like sudo** then see [*Giving non-root
9-
> access*](/installation/binaries/#dockergroup).
9+
> access*](/installation/binaries/#giving-non-root-access).
1010
> - **If you're using OS X or docker via TCP** then you shouldn't use
1111
> sudo.
1212

docs/sources/examples/couchdb_data_volumes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ page_keywords: docker, example, package installation, networking, couchdb, data
66

77
> **Note**:
88
> - **If you don't like sudo** then see [*Giving non-root
9-
> access*](/installation/binaries/#dockergroup)
9+
> access*](/installation/binaries/#giving-non-root-access)
1010
1111
Here's an example of using data volumes to share the same data between
1212
two CouchDB containers. This could be used for hot upgrades, testing

docs/sources/examples/nodejs_web_app.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ page_keywords: docker, example, package installation, node, centos
66

77
> **Note**:
88
> - **If you don't like sudo** then see [*Giving non-root
9-
> access*](/installation/binaries/#dockergroup)
9+
> access*](/installation/binaries/#giving-non-root-access)
1010
1111
The goal of this example is to show you how you can build your own
1212
Docker images from a parent image using a `Dockerfile`

docs/sources/examples/postgresql_service.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ page_keywords: docker, example, package installation, postgresql
66

77
> **Note**:
88
> - **If you don't like sudo** then see [*Giving non-root
9-
> access*](/installation/binaries/#dockergroup)
9+
> access*](/installation/binaries/#giving-non-root-access)
1010
1111
## Installing PostgreSQL on Docker
1212

docs/sources/http-routingtable.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
[`POST /containers/(id)/stop`](../reference/api/docker_remote_api_v1.9/#post--containers-(id)-stop) **
4343
[`GET /containers/(id)/top`](../reference/api/docker_remote_api_v1.9/#get--containers-(id)-top) **
4444
[`POST /containers/(id)/wait`](../reference/api/docker_remote_api_v1.9/#post--containers-(id)-wait) **
45-
[`POST /containers/create`](../reference/api/docker_remote_api_v1.9/#post--containers-create) **
45+
[`POST /containers/create`](/reference/api/docker_remote_api_v1.9/#create-a-container) **
4646
[`GET /containers/json`](../reference/api/docker_remote_api_v1.9/#get--containers-json) **
4747
[`POST /containers/(id)/resize`](../reference/api/docker_remote_api_v1.9/#get--containers-resize) **
4848
 

docs/sources/installation/amazon.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ over to the [User Guide](/userguide).
4040
## Standard Ubuntu Installation
4141

4242
If you want a more hands-on installation, then you can follow the
43-
[*Ubuntu*](../ubuntulinux/#ubuntu-linux) instructions installing Docker
44-
on any EC2 instance running Ubuntu. Just follow Step 1 from [*Amazon
45-
QuickStart*](#amazon-quickstart) to pick an image (or use one of your
43+
[*Ubuntu*](/installation/ubuntulinux) instructions installing Docker
44+
on any EC2 instance running Ubuntu. Just follow Step 1 from the Amazon
45+
QuickStart above to pick an image (or use one of your
4646
own) and skip the step with the *User Data*. Then continue with the
47-
[*Ubuntu*](../ubuntulinux/#ubuntu-linux) instructions.
47+
[*Ubuntu*](/installation/ubuntulinux) instructions.
4848

4949
Continue with the [User Guide](/userguide/).

docs/sources/installation/binaries.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ need to add `sudo` to all the client commands.
7777
> **Warning**:
7878
> The *docker* group (or the group specified with `-G`) is root-equivalent;
7979
> see [*Docker Daemon Attack Surface*](
80-
> /articles/security/#dockersecurity-daemon) details.
80+
> /articles/security/#docker-daemon-attack-surface) details.
8181
8282
## Upgrades
8383

docs/sources/installation/ubuntulinux.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ alternative group.
240240
> **Warning**:
241241
> The `docker` group (or the group specified with the `-G` flag) is
242242
> `root`-equivalent; see [*Docker Daemon Attack Surface*](
243-
> /articles/security/#dockersecurity-daemon) for details.
243+
> /articles/security/#docker-daemon-attack-surface) for details.
244244
245245
**Example:**
246246

docs/sources/reference/api/docker_remote_api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ output is now generated in the client, using the
366366
You can now split stderr from stdout. This is done by
367367
prefixing a header to each transmission. See
368368
[`POST /containers/(id)/attach`](
369-
/reference/api/docker_remote_api_v1.9/#post--containers-(id)-attach "POST /containers/(id)/attach").
369+
/reference/api/docker_remote_api_v1.9/#attach-to-a-container "POST /containers/(id)/attach").
370370
The WebSocket attach is unchanged. Note that attach calls on the
371371
previous API version didn't change. Stdout and stderr are merged.
372372

docs/sources/reference/api/docker_remote_api_v1.10.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ Status Codes:
499499

500500
When using the TTY setting is enabled in
501501
[`POST /containers/create`
502-
](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
502+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
503503
the stream is the raw data from the process PTY and client's stdin.
504504
When the TTY is disabled, then the stream is multiplexed to separate
505505
stdout and stderr.
@@ -998,7 +998,7 @@ Build an image from Dockerfile via stdin
998998
The archive must include a file called `Dockerfile`
999999
at its root. It may include any number of other files,
10001000
which will be accessible in the build context (See the [*ADD build
1001-
command*](/reference/builder/#dockerbuilder)).
1001+
command*](/reference/builder/#add)).
10021002

10031003
Query Parameters:
10041004

docs/sources/reference/api/docker_remote_api_v1.11.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ Status Codes:
535535

536536
When using the TTY setting is enabled in
537537
[`POST /containers/create`
538-
](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
538+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
539539
the stream is the raw data from the process PTY and client's stdin.
540540
When the TTY is disabled, then the stream is multiplexed to separate
541541
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.12.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ Status Codes:
583583

584584
When using the TTY setting is enabled in
585585
[`POST /containers/create`
586-
](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
586+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
587587
the stream is the raw data from the process PTY and client's stdin.
588588
When the TTY is disabled, then the stream is multiplexed to separate
589589
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.13.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ Status Codes:
576576

577577
When using the TTY setting is enabled in
578578
[`POST /containers/create`
579-
](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
579+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
580580
the stream is the raw data from the process PTY and client's stdin.
581581
When the TTY is disabled, then the stream is multiplexed to separate
582582
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.14.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ Status Codes:
581581

582582
When using the TTY setting is enabled in
583583
[`POST /containers/create`
584-
](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
584+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
585585
the stream is the raw data from the process PTY and client's stdin.
586586
When the TTY is disabled, then the stream is multiplexed to separate
587587
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.15.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ Status Codes:
721721

722722
When using the TTY setting is enabled in
723723
[`POST /containers/create`
724-
](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
724+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
725725
the stream is the raw data from the process PTY and client's stdin.
726726
When the TTY is disabled, then the stream is multiplexed to separate
727727
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.16.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ Status Codes:
669669

670670
When using the TTY setting is enabled in
671671
[`POST /containers/create`
672-
](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
672+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
673673
the stream is the raw data from the process PTY and client's stdin.
674674
When the TTY is disabled, then the stream is multiplexed to separate
675675
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.6.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ Status Codes:
525525

526526
When using the TTY setting is enabled in
527527
[`POST /containers/create`
528-
](/api/docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
528+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
529529
the stream is the raw data from the process PTY and client's stdin.
530530
When the TTY is disabled, then the stream is multiplexed to separate
531531
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.7.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ Status Codes:
470470

471471
When using the TTY setting is enabled in
472472
[`POST /containers/create`
473-
](/api/docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
473+
](/reference/api/docker_remote_api_v1.7/#create-a-container),
474474
the stream is the raw data from the process PTY and client's stdin.
475475
When the TTY is disabled, then the stream is multiplexed to separate
476476
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.8.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ Status Codes:
518518

519519
When using the TTY setting is enabled in
520520
[`POST /containers/create`
521-
](/api/docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
521+
](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
522522
the stream is the raw data from the process PTY and client's stdin.
523523
When the TTY is disabled, then the stream is multiplexed to separate
524524
stdout and stderr.

docs/sources/reference/api/docker_remote_api_v1.9.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ Status Codes:
522522
**Stream details**:
523523

524524
When using the TTY setting is enabled in
525-
[`POST /containers/create`](#post--containers-create), the
525+
[`POST /containers/create`](#create-a-container), the
526526
stream is the raw data from the process PTY and client's stdin. When
527527
the TTY is disabled, then the stream is multiplexed to separate
528528
stdout and stderr.
@@ -1004,7 +1004,7 @@ Build an image from Dockerfile using a POST body.
10041004
The archive must include a file called `Dockerfile`
10051005
at its root. It may include any number of other files,
10061006
which will be accessible in the build context (See the [*ADD build
1007-
command*](/reference/builder/#dockerbuilder)).
1007+
command*](/reference/builder/#add)).
10081008

10091009
Query Parameters:
10101010

0 commit comments

Comments
 (0)