Merge pull request #908 from infosiftr/docker-tweaks

Update Docker example output and convert it to use "%%IMAGE%%"
This commit is contained in:
yosifkit 2017-05-12 15:49:44 -07:00 committed by GitHub
commit 4d99ffc5a3
1 changed files with 77 additions and 57 deletions

View File

@ -21,7 +21,7 @@ If you are still convinced that you need Docker-in-Docker and not just access to
**IMPORTANT:** this image defaults to `--storage-driver=vfs`, which will be very slow and inefficient (but is the only driver which is guaranteed to work regardless of your underlying filesystem). Which driver you should use varies depending on your needs, but a good rule of thumb is that your DinD instance should be using the same driver as your host (which can be seen under `Storage Driver` in the output of `docker info`). See the "Custom daemon flags" section below for how to specify your storage driver.
```console
$ docker run --privileged --name some-docker -d docker:1.8-dind
$ docker run --privileged --name some-docker -d %%IMAGE%%:stable-dind
```
**Note:** `--privileged` is required for Docker-in-Docker to function properly, but it should be used with care as it provides full access to the host environment, as explained [in the relevant section of the Docker documentation](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities).
@ -31,94 +31,114 @@ This image includes `EXPOSE 2375` (the Docker port), so standard container linki
## Connect to it from a second container
```console
$ docker run --rm --link some-docker:docker docker:1.7 version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.8.1
Server API version: 1.20
Go version (server): go1.4.2
Git commit (server): d12ea79
OS/Arch (server): linux/amd64
$ docker run --rm --link some-docker:docker %%IMAGE%%:edge version
Client:
Version: 17.05.0-ce
API version: 1.27 (downgraded from 1.29)
Go version: go1.7.5
Git commit: 89658be
Built: Fri May 5 15:36:11 2017
OS/Arch: linux/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: linux/amd64
Experimental: false
```
```console
$ docker run -it --rm --link some-docker:docker docker:1.8 sh
$ docker run -it --rm --link some-docker:docker %%IMAGE%%:edge sh
/ # docker version
Client:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:49:29 UTC 2015
Version: 17.05.0-ce
API version: 1.27 (downgraded from 1.29)
Go version: go1.7.5
Git commit: 89658be
Built: Fri May 5 15:36:11 2017
OS/Arch: linux/amd64
Server:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:49:29 UTC 2015
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: linux/amd64
Experimental: false
```
```console
$ docker run --rm --link some-docker:docker docker info
$ docker run --rm --link some-docker:docker %%IMAGE%% info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.03.1-ce
Storage Driver: vfs
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.9-gentoo
Operating System: Alpine Linux v3.2 (containerized)
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.4.63-gentoo
Operating System: Alpine Linux v3.5 (containerized)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.4 GiB
Name: 4f19ef15a373
ID: 3GTC:FH6T:4G5U:7NF4:GM77:JGYU:BOKS:XFCY:H3IQ:JDJ5:X73Z:2K2K
Name: 393376fdc461
ID: FDP3:4GDT:L2WP:D4CC:UAW5:RHNA:4Z4G:WQYY:YWBE:7RER:LV7E:USY5
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
```
```console
$ docker run --rm --link some-docker:docker docker:git build https://github.com/docker-library/hello-world.git
Sending build context to Docker daemon 132.1 kB
Step 0 : FROM scratch
--->
Step 1 : COPY hello /
---> 29bef505052d
Removing intermediate container f98aab888906
Step 2 : CMD /hello
---> Running in a735b4037032
---> 3c2b1350a3c4
Removing intermediate container a735b4037032
Successfully built 3c2b1350a3c4
```
```console
$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker version
$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock %%IMAGE%% version
Client:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:49:29 UTC 2015
Version: 17.05.0-ce
API version: 1.28 (downgraded from 1.29)
Go version: go1.7.5
Git commit: 89658be
Built: Fri May 5 15:36:11 2017
OS/Arch: linux/amd64
Server:
Version: 1.9.0-dev
API version: 1.21
Go version: go1.4.2
Git commit: 7e3088c-dirty
Built: Tue Aug 18 19:53:53 UTC 2015
Version: 17.04.0-ce
API version: 1.28 (minimum version 1.12)
Go version: go1.8
Git commit: 4845c56
Built: Thu Apr 27 07:51:43 2017
OS/Arch: linux/amd64
Experimental: false
```
## Custom daemon flags
```console
$ docker run --privileged --name some-overlay-docker -d docker:dind --storage-driver=overlay
$ docker run --privileged --name some-overlay-docker -d %%IMAGE%%:dind --storage-driver=overlay
```
## Where to Store Data
@ -134,7 +154,7 @@ The Docker documentation is a good starting point for understanding the differen
2. Start your `%%REPO%%` container like this:
```console
$ docker run --privileged --name some-docker -v /my/own/var-lib-docker:/var/lib/docker -d docker:dind
$ docker run --privileged --name some-docker -v /my/own/var-lib-docker:/var/lib/docker -d %%IMAGE%%:dind
```
The `-v /my/own/var-lib-docker:/var/lib/docker` part of the command mounts the `/my/own/var-lib-docker` directory from the underlying host system as `/var/lib/docker` inside the container, where Docker by default will write its data files.