Compare commits
1 Commits
docs
..
v1.8.0-rc2
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a9d4eaa6e |
@@ -1,6 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 1.8.0 (2015-08-11)
|
## 1.8.0 (2015-07-24)
|
||||||
|
|
||||||
### Distribution
|
### Distribution
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
* Remove RC4 from the list of registry cipher suites
|
* Remove RC4 from the list of registry cipher suites
|
||||||
* Add syslog-facility option
|
* Add syslog-facility option
|
||||||
* LXC execdriver compatibility with recent LXC versions
|
* LXC execdriver compatibility with recent LXC versions
|
||||||
* Mark LXC execriver as deprecated (to be removed with the migration to runc)
|
|
||||||
|
|
||||||
### Plugins
|
### Plugins
|
||||||
|
|
||||||
@@ -85,11 +85,6 @@
|
|||||||
- Fix error caused using default gateways outside of the allocated range
|
- Fix error caused using default gateways outside of the allocated range
|
||||||
- Format times in inspect command with a template as RFC3339Nano
|
- Format times in inspect command with a template as RFC3339Nano
|
||||||
- Make registry client to accept 2xx and 3xx http status responses as successful
|
- Make registry client to accept 2xx and 3xx http status responses as successful
|
||||||
- Fix race issue that caused the daemon to crash with certain layer downloads failed in a specific order.
|
|
||||||
- Fix error when the docker ps format was not valid.
|
|
||||||
- Remove redundant ip forward check.
|
|
||||||
- Fix issue trying to push images to repository mirrors.
|
|
||||||
- Fix error cleaning up network entrypoints when there is an initialization issue.
|
|
||||||
|
|
||||||
## 1.7.1 (2015-07-14)
|
## 1.7.1 (2015-07-14)
|
||||||
|
|
||||||
|
|||||||
@@ -170,11 +170,9 @@ func customFormat(ctx Context, containers []types.Container) {
|
|||||||
format += "\t{{.Size}}"
|
format += "\t{{.Size}}"
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.New("").Parse(format)
|
tmpl, err := template.New("ps template").Parse(format)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
buffer.WriteString(fmt.Sprintf("Template parsing error: %v\n", err))
|
buffer.WriteString(fmt.Sprintf("Invalid `docker ps` format: %v\n", err))
|
||||||
buffer.WriteTo(ctx.Output)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, container := range containers {
|
for _, container := range containers {
|
||||||
@@ -183,9 +181,8 @@ func customFormat(ctx Context, containers []types.Container) {
|
|||||||
c: container,
|
c: container,
|
||||||
}
|
}
|
||||||
if err := tmpl.Execute(buffer, containerCtx); err != nil {
|
if err := tmpl.Execute(buffer, containerCtx); err != nil {
|
||||||
buffer = bytes.NewBufferString(fmt.Sprintf("Template parsing error: %v\n", err))
|
buffer = bytes.NewBufferString(fmt.Sprintf("Invalid `docker ps` format: %v\n", err))
|
||||||
buffer.WriteTo(ctx.Output)
|
break
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if table && len(header) == 0 {
|
if table && len(header) == 0 {
|
||||||
header = containerCtx.fullHeader()
|
header = containerCtx.fullHeader()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package ps
|
package ps
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -11,7 +10,7 @@ import (
|
|||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestContainerPsContext(t *testing.T) {
|
func TestContainerContextID(t *testing.T) {
|
||||||
containerId := stringid.GenerateRandomID()
|
containerId := stringid.GenerateRandomID()
|
||||||
unix := time.Now().Unix()
|
unix := time.Now().Unix()
|
||||||
|
|
||||||
@@ -87,16 +86,3 @@ func TestContainerPsContext(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerPsFormatError(t *testing.T) {
|
|
||||||
out := bytes.NewBufferString("")
|
|
||||||
ctx := Context{
|
|
||||||
Format: "{{InvalidFunction}}",
|
|
||||||
Output: out,
|
|
||||||
}
|
|
||||||
|
|
||||||
customFormat(ctx, make([]types.Container, 0))
|
|
||||||
if out.String() != "Template parsing error: template: :1: function \"InvalidFunction\" not defined\n" {
|
|
||||||
t.Fatalf("Expected format error, got `%v`\n", out.String())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
FROM debian:jessie
|
FROM debian:jessie
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV GO_VERSION 1.4.2
|
ENV GO_VERSION 1.4.2
|
||||||
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
FROM debian:stretch
|
FROM debian:stretch
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV GO_VERSION 1.4.2
|
ENV GO_VERSION 1.4.2
|
||||||
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
FROM debian:wheezy
|
FROM debian:wheezy
|
||||||
RUN echo deb http://http.debian.net/debian wheezy-backports main > /etc/apt/sources.list.d/wheezy-backports.list
|
RUN echo deb http://http.debian.net/debian wheezy-backports main > /etc/apt/sources.list.d/wheezy-backports.list
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV GO_VERSION 1.4.2
|
ENV GO_VERSION 1.4.2
|
||||||
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ for version in "${versions[@]}"; do
|
|||||||
build-essential # "essential for building Debian packages"
|
build-essential # "essential for building Debian packages"
|
||||||
curl ca-certificates # for downloading Go
|
curl ca-certificates # for downloading Go
|
||||||
debhelper # for easy ".deb" building
|
debhelper # for easy ".deb" building
|
||||||
|
dh-apparmor # for apparmor debhelper
|
||||||
dh-systemd # for systemd debhelper integration
|
dh-systemd # for systemd debhelper integration
|
||||||
git # for "git commit" info in "docker -v"
|
git # for "git commit" info in "docker -v"
|
||||||
libapparmor-dev # for "sys/apparmor.h"
|
libapparmor-dev # for "sys/apparmor.h"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
FROM ubuntu-debootstrap:precise
|
FROM ubuntu-debootstrap:precise
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash-completion build-essential curl ca-certificates debhelper git libapparmor-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y bash-completion build-essential curl ca-certificates debhelper dh-apparmor git libapparmor-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV GO_VERSION 1.4.2
|
ENV GO_VERSION 1.4.2
|
||||||
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
FROM ubuntu-debootstrap:trusty
|
FROM ubuntu-debootstrap:trusty
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV GO_VERSION 1.4.2
|
ENV GO_VERSION 1.4.2
|
||||||
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
FROM ubuntu-debootstrap:vivid
|
FROM ubuntu-debootstrap:vivid
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV GO_VERSION 1.4.2
|
ENV GO_VERSION 1.4.2
|
||||||
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
FROM ubuntu-debootstrap:wily
|
FROM ubuntu-debootstrap:wily
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV GO_VERSION 1.4.2
|
ENV GO_VERSION 1.4.2
|
||||||
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
# This order should be applied to lists, alternatives and code blocks.
|
# This order should be applied to lists, alternatives and code blocks.
|
||||||
|
|
||||||
__docker_q() {
|
__docker_q() {
|
||||||
docker ${host:+-H "$host"} ${config:+--config "$config"} 2>/dev/null "$@"
|
docker ${host:+-H "$host"} 2>/dev/null "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
__docker_containers_all() {
|
__docker_containers_all() {
|
||||||
@@ -325,10 +325,6 @@ _docker_docker() {
|
|||||||
"
|
"
|
||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--config)
|
|
||||||
_filedir -d
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--log-level|-l)
|
--log-level|-l)
|
||||||
__docker_log_levels
|
__docker_log_levels
|
||||||
return
|
return
|
||||||
@@ -1398,7 +1394,6 @@ _docker() {
|
|||||||
--tlsverify
|
--tlsverify
|
||||||
"
|
"
|
||||||
local global_options_with_args="
|
local global_options_with_args="
|
||||||
--config
|
|
||||||
--host -H
|
--host -H
|
||||||
--log-level -l
|
--log-level -l
|
||||||
--tlscacert
|
--tlscacert
|
||||||
@@ -1406,7 +1401,7 @@ _docker() {
|
|||||||
--tlskey
|
--tlskey
|
||||||
"
|
"
|
||||||
|
|
||||||
local host config
|
local host
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
@@ -1421,11 +1416,6 @@ _docker() {
|
|||||||
(( counter++ ))
|
(( counter++ ))
|
||||||
host="${words[$counter]}"
|
host="${words[$counter]}"
|
||||||
;;
|
;;
|
||||||
# save config so that completion can use custom configuration directories
|
|
||||||
--config)
|
|
||||||
(( counter++ ))
|
|
||||||
config="${words[$counter]}"
|
|
||||||
;;
|
|
||||||
$(__docker_to_extglob "$global_options_with_args") )
|
$(__docker_to_extglob "$global_options_with_args") )
|
||||||
(( counter++ ))
|
(( counter++ ))
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ After=network.target docker.socket
|
|||||||
Requires=docker.socket
|
Requires=docker.socket
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
|
||||||
ExecStart=/usr/bin/docker daemon -H fd://
|
ExecStart=/usr/bin/docker daemon -H fd://
|
||||||
MountFlags=slave
|
MountFlags=slave
|
||||||
LimitNOFILE=1048576
|
LimitNOFILE=1048576
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.Hos
|
|||||||
if err := daemon.mergeAndVerifyConfig(config, img); err != nil {
|
if err := daemon.mergeAndVerifyConfig(config, img); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
if !config.NetworkDisabled && daemon.SystemConfig().IPv4ForwardingDisabled {
|
||||||
|
warnings = append(warnings, "IPv4 forwarding is disabled.")
|
||||||
|
}
|
||||||
if hostConfig == nil {
|
if hostConfig == nil {
|
||||||
hostConfig = &runconfig.HostConfig{}
|
hostConfig = &runconfig.HostConfig{}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,16 +40,20 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
|
|||||||
file,
|
file,
|
||||||
umount,
|
umount,
|
||||||
|
|
||||||
|
signal (receive) peer=/usr/bin/docker,
|
||||||
|
signal (receive) peer=docker-unconfined,
|
||||||
|
|
||||||
deny @{PROC}/sys/fs/** wklx,
|
deny @{PROC}/sys/fs/** wklx,
|
||||||
deny @{PROC}/fs/** wklx,
|
deny @{PROC}/fs/** wklx,
|
||||||
deny @{PROC}/sysrq-trigger rwklx,
|
deny @{PROC}/sysrq-trigger rwklx,
|
||||||
deny @{PROC}/mem rwklx,
|
deny @{PROC}/mem rwklx,
|
||||||
deny @{PROC}/kmem rwklx,
|
deny @{PROC}/kmem rwklx,
|
||||||
deny @{PROC}/kcore rwklx,
|
deny @{PROC}/kore rwklx,
|
||||||
deny @{PROC}/sys/kernel/[^s][^h][^m]* wklx,
|
deny @{PROC}/sys/kernel/[^s][^h][^m]* wklx,
|
||||||
deny @{PROC}/sys/kernel/*/** wklx,
|
deny @{PROC}/sys/kernel/*/** wklx,
|
||||||
|
|
||||||
deny mount,
|
deny mount,
|
||||||
|
deny ptrace (trace) peer=docker-default,
|
||||||
|
|
||||||
deny /sys/[^f]*/** wklx,
|
deny /sys/[^f]*/** wklx,
|
||||||
deny /sys/f[^s]*/** wklx,
|
deny /sys/f[^s]*/** wklx,
|
||||||
@@ -59,6 +63,21 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
|
|||||||
deny /sys/firmware/efi/efivars/** rwklx,
|
deny /sys/firmware/efi/efivars/** rwklx,
|
||||||
deny /sys/kernel/security/** rwklx,
|
deny /sys/kernel/security/** rwklx,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profile docker-unconfined flags=(attach_disconnected,mediate_deleted,complain) {
|
||||||
|
#include <abstractions/base>
|
||||||
|
|
||||||
|
network,
|
||||||
|
capability,
|
||||||
|
file,
|
||||||
|
umount,
|
||||||
|
mount,
|
||||||
|
pivot_root,
|
||||||
|
change_profile -> *,
|
||||||
|
|
||||||
|
ptrace,
|
||||||
|
signal,
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
func generateProfile(out io.Writer) error {
|
func generateProfile(out io.Writer) error {
|
||||||
|
|||||||
@@ -198,8 +198,9 @@ func (d *driver) setPrivileged(container *configs.Config) (err error) {
|
|||||||
container.Devices = hostDevices
|
container.Devices = hostDevices
|
||||||
|
|
||||||
if apparmor.IsEnabled() {
|
if apparmor.IsEnabled() {
|
||||||
container.AppArmorProfile = "unconfined"
|
container.AppArmorProfile = "docker-unconfined"
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ func NewDriver(root, initPath string, options []string) (*driver, error) {
|
|||||||
|
|
||||||
if apparmor.IsEnabled() {
|
if apparmor.IsEnabled() {
|
||||||
if err := installAppArmorProfile(); err != nil {
|
if err := installAppArmorProfile(); err != nil {
|
||||||
apparmorProfiles := []string{"docker-default"}
|
apparmor_profiles := []string{"docker-default", "docker-unconfined"}
|
||||||
|
|
||||||
// Allow daemon to run if loading failed, but are active
|
// Allow daemon to run if loading failed, but are active
|
||||||
// (possibly through another run, manually, or via system startup)
|
// (possibly through another run, manually, or via system startup)
|
||||||
for _, policy := range apparmorProfiles {
|
for _, policy := range apparmor_profiles {
|
||||||
if err := hasAppArmorProfileLoaded(policy); err != nil {
|
if err := hasAppArmorProfileLoaded(policy); err != nil {
|
||||||
return nil, fmt.Errorf("AppArmor enabled on system but the %s profile could not be loaded.", policy)
|
return nil, fmt.Errorf("AppArmor enabled on system but the %s profile could not be loaded.", policy)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,24 +6,8 @@ COPY . /src
|
|||||||
|
|
||||||
COPY . /docs/content/
|
COPY . /docs/content/
|
||||||
|
|
||||||
RUN svn checkout https://github.com/docker/compose/trunk/docs /docs/content/compose
|
WORKDIR /docs/content
|
||||||
RUN svn checkout https://github.com/docker/swarm/trunk/docs /docs/content/swarm
|
|
||||||
RUN svn checkout https://github.com/docker/machine/trunk/docs /docs/content/machine
|
|
||||||
RUN svn checkout https://github.com/docker/distribution/trunk/docs /docs/content/registry
|
|
||||||
RUN svn checkout https://github.com/kitematic/kitematic/trunk/docs /docs/content/kitematic
|
|
||||||
RUN svn checkout https://github.com/docker/tutorials/trunk/docs /docs/content/
|
|
||||||
RUN svn checkout https://github.com/docker/opensource/trunk/docs /docs/content/opensource
|
|
||||||
|
|
||||||
|
RUN /docs/content/touch-up.sh
|
||||||
|
|
||||||
|
WORKDIR /docs
|
||||||
|
|
||||||
# Sed to process GitHub Markdown
|
|
||||||
# 1-2 Remove comment code from metadata block
|
|
||||||
# 3 Change ](/word to ](/project/ in links
|
|
||||||
# 4 Change ](word.md) to ](/project/word)
|
|
||||||
# 5 Remove .md extension from link text
|
|
||||||
# 6 Change ](../ to ](/project/word)
|
|
||||||
# 7 Change ](../../ to ](/project/ --> not implemented
|
|
||||||
#
|
|
||||||
#
|
|
||||||
RUN /src/pre-process.sh /docs
|
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ own.
|
|||||||
container with this image.
|
container with this image.
|
||||||
|
|
||||||
The container exposes port 8000 on the localhost so that you can connect and
|
The container exposes port 8000 on the localhost so that you can connect and
|
||||||
see your changes. If you use Docker Machine, the `docker-machine ip
|
see your changes. If you are running Boot2Docker, use the `boot2docker ip`
|
||||||
<machine-name>` command gives you the address of your server.
|
to get the address of your server.
|
||||||
|
|
||||||
6. Check your writing for style and mechanical errors.
|
6. Check your writing for style and mechanical errors.
|
||||||
|
|
||||||
@@ -158,20 +158,18 @@ update the root docs pages by running
|
|||||||
|
|
||||||
$ make AWS_S3_BUCKET=dowideit-docs BUILD_ROOT=yes docs-release
|
$ make AWS_S3_BUCKET=dowideit-docs BUILD_ROOT=yes docs-release
|
||||||
|
|
||||||
### Errors publishing using a Docker Machine VM
|
### Errors publishing using Boot2Docker
|
||||||
|
|
||||||
Sometimes, in a Windows or Mac environment, the publishing procedure returns this
|
Sometimes, in a Boot2Docker environment, the publishing procedure returns this
|
||||||
error:
|
error:
|
||||||
|
|
||||||
Post http:///var/run/docker.sock/build?rm=1&t=docker-docs%3Apost-1.2.0-docs_update-2:
|
Post http:///var/run/docker.sock/build?rm=1&t=docker-docs%3Apost-1.2.0-docs_update-2:
|
||||||
dial unix /var/run/docker.sock: no such file or directory.
|
dial unix /var/run/docker.sock: no such file or directory.
|
||||||
|
|
||||||
If this happens, set the Docker host. Run the following command to get the
|
If this happens, set the Docker host. Run the following command to set the
|
||||||
variables in your shell:
|
variables in your shell:
|
||||||
|
|
||||||
docker-machine env <machine-name>
|
$ eval "$(boot2docker shellinit)"
|
||||||
|
|
||||||
Then, set your environment accordingly.
|
|
||||||
|
|
||||||
## Cherry-picking documentation changes to update an existing release.
|
## Cherry-picking documentation changes to update an existing release.
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ parent = "smn_images"
|
|||||||
# Create a base image
|
# Create a base image
|
||||||
|
|
||||||
So you want to create your own [*Base Image*](
|
So you want to create your own [*Base Image*](
|
||||||
/reference/glossary/#base-image)? Great!
|
/terms/image/#base-image)? Great!
|
||||||
|
|
||||||
The specific process will depend heavily on the Linux distribution you
|
The specific process will depend heavily on the Linux distribution you
|
||||||
want to package. We have some examples below, and you are encouraged to
|
want to package. We have some examples below, and you are encouraged to
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ image cache.
|
|||||||
> characters of the full image ID - which can be found using
|
> characters of the full image ID - which can be found using
|
||||||
> `docker inspect` or `docker images --no-trunc=true`.
|
> `docker inspect` or `docker images --no-trunc=true`.
|
||||||
|
|
||||||
|
> **Note:** if you are using a remote Docker daemon, such as Boot2Docker,
|
||||||
|
> then _do not_ type the `sudo` before the `docker` commands shown in the
|
||||||
|
> documentation's examples.
|
||||||
|
|
||||||
## Running an interactive shell
|
## Running an interactive shell
|
||||||
|
|
||||||
To run an interactive shell in the Ubuntu image:
|
To run an interactive shell in the Ubuntu image:
|
||||||
|
|||||||
@@ -11,7 +11,111 @@ weight = 7
|
|||||||
|
|
||||||
# Using certificates for repository client verification
|
# Using certificates for repository client verification
|
||||||
|
|
||||||
The orginal content was deprecated. For information about configuring
|
In [Running Docker with HTTPS](/articles/https), you learned that, by default,
|
||||||
cerficates, see [deploying a registry
|
Docker runs via a non-networked Unix socket and TLS must be enabled in order
|
||||||
server](http://docs.docker.com/registry/deploying/). To reach an older version
|
to have the Docker client and the daemon communicate securely over HTTPS.
|
||||||
of this content, refer to an older version of the documentation.
|
|
||||||
|
Now, you will see how to allow the Docker registry (i.e., *a server*) to
|
||||||
|
verify that the Docker daemon (i.e., *a client*) has the right to access the
|
||||||
|
images being hosted with *certificate-based client-server authentication*.
|
||||||
|
|
||||||
|
We will show you how to install a Certificate Authority (CA) root certificate
|
||||||
|
for the registry and how to set the client TLS certificate for verification.
|
||||||
|
|
||||||
|
## Understanding the configuration
|
||||||
|
|
||||||
|
A custom certificate is configured by creating a directory under
|
||||||
|
`/etc/docker/certs.d` using the same name as the registry's hostname (e.g.,
|
||||||
|
`localhost`). All `*.crt` files are added to this directory as CA roots.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> In the absence of any root certificate authorities, Docker
|
||||||
|
> will use the system default (i.e., host's root CA set).
|
||||||
|
|
||||||
|
The presence of one or more `<filename>.key/cert` pairs indicates to Docker
|
||||||
|
that there are custom certificates required for access to the desired
|
||||||
|
repository.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> If there are multiple certificates, each will be tried in alphabetical
|
||||||
|
> order. If there is an authentication error (e.g., 403, 404, 5xx, etc.), Docker
|
||||||
|
> will continue to try with the next certificate.
|
||||||
|
|
||||||
|
Our example is set up like this:
|
||||||
|
|
||||||
|
/etc/docker/certs.d/ <-- Certificate directory
|
||||||
|
└── localhost <-- Hostname
|
||||||
|
├── client.cert <-- Client certificate
|
||||||
|
├── client.key <-- Client key
|
||||||
|
└── localhost.crt <-- Registry certificate
|
||||||
|
|
||||||
|
## Creating the client certificates
|
||||||
|
|
||||||
|
You will use OpenSSL's `genrsa` and `req` commands to first generate an RSA
|
||||||
|
key and then use the key to create the certificate.
|
||||||
|
|
||||||
|
$ openssl genrsa -out client.key 4096
|
||||||
|
$ openssl req -new -x509 -text -key client.key -out client.cert
|
||||||
|
|
||||||
|
> **Warning:**:
|
||||||
|
> Using TLS and managing a CA is an advanced topic.
|
||||||
|
> You should be familiar with OpenSSL, x509, and TLS before
|
||||||
|
> attempting to use them in production.
|
||||||
|
|
||||||
|
> **Warning:**
|
||||||
|
> These TLS commands will only generate a working set of certificates on Linux.
|
||||||
|
> The version of OpenSSL in Mac OS X is incompatible with the type of
|
||||||
|
> certificate Docker requires.
|
||||||
|
|
||||||
|
## Testing the verification setup
|
||||||
|
|
||||||
|
You can test this setup by using Apache to host a Docker registry.
|
||||||
|
For this purpose, you can copy a registry tree (containing images) inside
|
||||||
|
the Apache root.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> You can find such an example [here](
|
||||||
|
> http://people.gnome.org/~alexl/v1.tar.gz) - which contains the busybox image.
|
||||||
|
|
||||||
|
Once you set up the registry, you can use the following Apache configuration
|
||||||
|
to implement certificate-based protection.
|
||||||
|
|
||||||
|
# This must be in the root context, otherwise it causes a re-negotiation
|
||||||
|
# which is not supported by the TLS implementation in go
|
||||||
|
SSLVerifyClient optional_no_ca
|
||||||
|
|
||||||
|
<Location /v1>
|
||||||
|
Action cert-protected /cgi-bin/cert.cgi
|
||||||
|
SetHandler cert-protected
|
||||||
|
|
||||||
|
Header set x-docker-registry-version "0.6.2"
|
||||||
|
SetEnvIf Host (.*) custom_host=$1
|
||||||
|
Header set X-Docker-Endpoints "%{custom_host}e"
|
||||||
|
</Location>
|
||||||
|
|
||||||
|
Save the above content as `/etc/httpd/conf.d/registry.conf`, and
|
||||||
|
continue with creating a `cert.cgi` file under `/var/www/cgi-bin/`.
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
if [ "$HTTPS" != "on" ]; then
|
||||||
|
echo "Status: 403 Not using SSL"
|
||||||
|
echo "x-docker-registry-version: 0.6.2"
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$SSL_CLIENT_VERIFY" == "NONE" ]; then
|
||||||
|
echo "Status: 403 Client certificate invalid"
|
||||||
|
echo "x-docker-registry-version: 0.6.2"
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Content-length: $(stat --printf='%s' $PATH_TRANSLATED)"
|
||||||
|
echo "x-docker-registry-version: 0.6.2"
|
||||||
|
echo "X-Docker-Endpoints: $SERVER_NAME"
|
||||||
|
echo "X-Docker-Size: 0"
|
||||||
|
echo
|
||||||
|
|
||||||
|
cat $PATH_TRANSLATED
|
||||||
|
|
||||||
|
This CGI script will ensure that all requests to `/v1` *without* a valid
|
||||||
|
certificate will be returned with a `403` (i.e., HTTP forbidden) error.
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ These options :
|
|||||||
- Set `tls` to true with the server certificate and key specified using `--tlscert` and `--tlskey` respectively
|
- Set `tls` to true with the server certificate and key specified using `--tlscert` and `--tlskey` respectively
|
||||||
- Listen for connections on `tcp://192.168.59.3:2376`
|
- Listen for connections on `tcp://192.168.59.3:2376`
|
||||||
|
|
||||||
The command line reference has the [complete list of daemon flags](/reference/commandline/daemon)
|
The command line reference has the [complete list of daemon flags](/reference/commandline/cli/#daemon)
|
||||||
with explanations.
|
with explanations.
|
||||||
|
|
||||||
## Ubuntu
|
## Ubuntu
|
||||||
@@ -114,7 +114,7 @@ These options :
|
|||||||
- Set `tls` to true with the server certificate and key specified using `--tlscert` and `--tlskey` respectively
|
- Set `tls` to true with the server certificate and key specified using `--tlscert` and `--tlskey` respectively
|
||||||
- Listen for connections on `tcp://192.168.59.3:2376`
|
- Listen for connections on `tcp://192.168.59.3:2376`
|
||||||
|
|
||||||
The command line reference has the [complete list of daemon flags](/reference/commandline/daemon)
|
The command line reference has the [complete list of daemon flags](/reference/commandline/cli/#daemon)
|
||||||
with explanations.
|
with explanations.
|
||||||
|
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ These options :
|
|||||||
- Set `tls` to true with the server certificate and key specified using `--tlscert` and `--tlskey` respectively
|
- Set `tls` to true with the server certificate and key specified using `--tlscert` and `--tlskey` respectively
|
||||||
- Listen for connections on `tcp://192.168.59.3:2376`
|
- Listen for connections on `tcp://192.168.59.3:2376`
|
||||||
|
|
||||||
The command line reference has the [complete list of daemon flags](/reference/commandline/daemon)
|
The command line reference has the [complete list of daemon flags](/reference/commandline/cli/#daemon)
|
||||||
with explanations.
|
with explanations.
|
||||||
|
|
||||||
5. Save and close the file.
|
5. Save and close the file.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ First generate CA private and public keys:
|
|||||||
State or Province Name (full name) [Some-State]:Queensland
|
State or Province Name (full name) [Some-State]:Queensland
|
||||||
Locality Name (eg, city) []:Brisbane
|
Locality Name (eg, city) []:Brisbane
|
||||||
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker Inc
|
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker Inc
|
||||||
Organizational Unit Name (eg, section) []:Sales
|
Organizational Unit Name (eg, section) []:Boot2Docker
|
||||||
Common Name (e.g. server FQDN or YOUR name) []:$HOST
|
Common Name (e.g. server FQDN or YOUR name) []:$HOST
|
||||||
Email Address []:Sven@home.org.au
|
Email Address []:Sven@home.org.au
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,81 @@ weight = 8
|
|||||||
|
|
||||||
# Run a local registry mirror
|
# Run a local registry mirror
|
||||||
|
|
||||||
The orginal content was deprecated. [An archived
|
## Why?
|
||||||
version](https://docs.docker.com/v1.6/articles/registry_mirror) is available in
|
|
||||||
the 1.7 documentation. For information about configuring mirrors with the latest
|
If you have multiple instances of Docker running in your environment
|
||||||
Docker Registry version, please file a support request with [the Distribution
|
(e.g., multiple physical or virtual machines, all running the Docker
|
||||||
project](https://github.com/docker/distribution/issues).
|
daemon), each time one of them requires an image that it doesn't have
|
||||||
|
it will go out to the internet and fetch it from the public Docker
|
||||||
|
registry. By running a local registry mirror, you can keep most of the
|
||||||
|
image fetch traffic on your local network.
|
||||||
|
|
||||||
|
## How does it work?
|
||||||
|
|
||||||
|
The first time you request an image from your local registry mirror,
|
||||||
|
it pulls the image from the public Docker registry and stores it locally
|
||||||
|
before handing it back to you. On subsequent requests, the local registry
|
||||||
|
mirror is able to serve the image from its own storage.
|
||||||
|
|
||||||
|
## How do I set up a local registry mirror?
|
||||||
|
|
||||||
|
There are two steps to set up and use a local registry mirror.
|
||||||
|
|
||||||
|
### Step 1: Configure your Docker daemons to use the local registry mirror
|
||||||
|
|
||||||
|
You will need to pass the `--registry-mirror` option to your Docker daemon on
|
||||||
|
startup:
|
||||||
|
|
||||||
|
docker daemon --registry-mirror=http://<my-docker-mirror-host>
|
||||||
|
|
||||||
|
For example, if your mirror is serving on `http://10.0.0.2:5000`, you would run:
|
||||||
|
|
||||||
|
docker daemon --registry-mirror=http://10.0.0.2:5000
|
||||||
|
|
||||||
|
**NOTE:**
|
||||||
|
Depending on your local host setup, you may be able to add the
|
||||||
|
`--registry-mirror` options to the `DOCKER_OPTS` variable in
|
||||||
|
`/etc/default/docker`.
|
||||||
|
|
||||||
|
### Step 2: Run the local registry mirror
|
||||||
|
|
||||||
|
You will need to start a local registry mirror service. The
|
||||||
|
[`registry` image](https://registry.hub.docker.com/_/registry/) provides this
|
||||||
|
functionality. For example, to run a local registry mirror that serves on
|
||||||
|
port `5000` and mirrors the content at `registry-1.docker.io`:
|
||||||
|
|
||||||
|
docker run -p 5000:5000 \
|
||||||
|
-e STANDALONE=false \
|
||||||
|
-e MIRROR_SOURCE=https://registry-1.docker.io \
|
||||||
|
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
|
||||||
|
registry
|
||||||
|
|
||||||
|
## Test it out
|
||||||
|
|
||||||
|
With your mirror running, pull an image that you haven't pulled before (using
|
||||||
|
`time` to time it):
|
||||||
|
|
||||||
|
$ time docker pull node:latest
|
||||||
|
Pulling repository node
|
||||||
|
[...]
|
||||||
|
|
||||||
|
real 1m14.078s
|
||||||
|
user 0m0.176s
|
||||||
|
sys 0m0.120s
|
||||||
|
|
||||||
|
Now, remove the image from your local machine:
|
||||||
|
|
||||||
|
$ docker rmi node:latest
|
||||||
|
|
||||||
|
Finally, re-pull the image:
|
||||||
|
|
||||||
|
$ time docker pull node:latest
|
||||||
|
Pulling repository node
|
||||||
|
[...]
|
||||||
|
|
||||||
|
real 0m51.376s
|
||||||
|
user 0m0.120s
|
||||||
|
sys 0m0.116s
|
||||||
|
|
||||||
|
The second time around, the local registry mirror served the image from storage,
|
||||||
|
avoiding a trip out to the internet to refetch it.
|
||||||
|
|||||||
@@ -33,33 +33,17 @@ If you want Docker to start at boot, you should also:
|
|||||||
There are a number of ways to configure the daemon flags and environment variables
|
There are a number of ways to configure the daemon flags and environment variables
|
||||||
for your Docker daemon.
|
for your Docker daemon.
|
||||||
|
|
||||||
The recommended way is to use a systemd drop-in file. These are local files in
|
If the `docker.service` file is set to use an `EnvironmentFile`
|
||||||
the `/etc/systemd/system/docker.service.d` directory. This could also be
|
(often pointing to `/etc/sysconfig/docker`) then you can modify the
|
||||||
`/etc/systemd/system/docker.service`, which also works for overriding the
|
referenced file.
|
||||||
defaults from `/lib/systemd/system/docker.service`.
|
|
||||||
|
|
||||||
However, if you had previously used a package which had an `EnvironmentFile`
|
Check if the `docker.service` uses an `EnvironmentFile`:
|
||||||
(often pointing to `/etc/sysconfig/docker`) then for backwards compatibility,
|
|
||||||
you drop a file in the `/etc/systemd/system/docker.service.d`
|
|
||||||
directory including the following:
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
EnvironmentFile=-/etc/sysconfig/docker
|
|
||||||
EnvironmentFile=-/etc/sysconfig/docker-storage
|
|
||||||
EnvironmentFile=-/etc/sysconfig/docker-network
|
|
||||||
ExecStart=
|
|
||||||
ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS \
|
|
||||||
$DOCKER_STORAGE_OPTIONS \
|
|
||||||
$DOCKER_NETWORK_OPTIONS \
|
|
||||||
$BLOCK_REGISTRY \
|
|
||||||
$INSECURE_REGISTRY
|
|
||||||
|
|
||||||
To check if the `docker.service` uses an `EnvironmentFile`:
|
|
||||||
|
|
||||||
$ sudo systemctl show docker | grep EnvironmentFile
|
$ sudo systemctl show docker | grep EnvironmentFile
|
||||||
EnvironmentFile=-/etc/sysconfig/docker (ignore_errors=yes)
|
EnvironmentFile=-/etc/sysconfig/docker (ignore_errors=yes)
|
||||||
|
|
||||||
Alternatively, find out where the service file is located:
|
Alternatively, find out where the service file is located, and look for the
|
||||||
|
property:
|
||||||
|
|
||||||
$ sudo systemctl status docker | grep Loaded
|
$ sudo systemctl status docker | grep Loaded
|
||||||
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
|
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
|
||||||
@@ -85,20 +69,18 @@ In this example, we'll assume that your `docker.service` file looks something li
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=notify
|
||||||
ExecStart=/usr/bin/docker daemon -H fd://
|
EnvironmentFile=-/etc/sysconfig/docker
|
||||||
|
ExecStart=/usr/bin/docker daemon -H fd:// $OPTIONS
|
||||||
LimitNOFILE=1048576
|
LimitNOFILE=1048576
|
||||||
LimitNPROC=1048576
|
LimitNPROC=1048576
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
Also=docker.socket
|
Also=docker.socket
|
||||||
|
|
||||||
This will allow us to add extra flags via a drop-in file (mentioned above) by
|
This will allow us to add extra flags to the `/etc/sysconfig/docker` file by
|
||||||
placing a file containing the following in the `/etc/systemd/system/docker.service.d`
|
setting `OPTIONS`:
|
||||||
directory:
|
|
||||||
|
|
||||||
[Service]
|
OPTIONS="--graph /mnt/docker-data --storage-driver btrfs"
|
||||||
ExecStart=
|
|
||||||
ExecStart=/usr/bin/docker daemon -H fd:// --graph /mnt/docker-data --storage-driver btrfs
|
|
||||||
|
|
||||||
You can also set other environment variables in this file, for example, the
|
You can also set other environment variables in this file, for example, the
|
||||||
`HTTP_PROXY` environment variables described below.
|
`HTTP_PROXY` environment variables described below.
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<!--[metadata]>
|
||||||
|
+++
|
||||||
|
title = "Accounts on Docker Hub"
|
||||||
|
description = "Docker Hub accounts"
|
||||||
|
keywords = ["Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, documentation"]
|
||||||
|
[menu.main]
|
||||||
|
parent = "smn_pubhub"
|
||||||
|
weight = 1
|
||||||
|
+++
|
||||||
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
# Accounts on Docker Hub
|
||||||
|
|
||||||
|
## Docker Hub accounts
|
||||||
|
|
||||||
|
You can `search` for Docker images and `pull` them from [Docker
|
||||||
|
Hub](https://hub.docker.com) without signing in or even having an
|
||||||
|
account. However, in order to `push` images, leave comments or to *star*
|
||||||
|
a repository, you are going to need a [Docker
|
||||||
|
Hub](https://hub.docker.com) account.
|
||||||
|
|
||||||
|
### Registration for a Docker Hub account
|
||||||
|
|
||||||
|
You can get a [Docker Hub](https://hub.docker.com) account by
|
||||||
|
[signing up for one here](https://hub.docker.com/account/signup/). A valid
|
||||||
|
email address is required to register, which you will need to verify for
|
||||||
|
account activation.
|
||||||
|
|
||||||
|
### Email activation process
|
||||||
|
|
||||||
|
You need to have at least one verified email address to be able to use your
|
||||||
|
[Docker Hub](https://hub.docker.com) account. If you can't find the validation email,
|
||||||
|
you can request another by visiting the [Resend Email Confirmation](
|
||||||
|
https://hub.docker.com/account/resend-email-confirmation/) page.
|
||||||
|
|
||||||
|
### Password reset process
|
||||||
|
|
||||||
|
If you can't access your account for some reason, you can reset your password
|
||||||
|
from the [*Password Reset*](https://hub.docker.com/account/forgot-password/)
|
||||||
|
page.
|
||||||
|
|
||||||
|
## Organizations and groups
|
||||||
|
|
||||||
|
A Docker Hub organization contains public and private repositories just like
|
||||||
|
a user account. Access to push, pull or create these organisation owned repositories
|
||||||
|
is allocated by defining groups of users and then assigning group rights to
|
||||||
|
specific repositories. This allows you to distribute limited access
|
||||||
|
Docker images, and to select which Docker Hub users can publish new images.
|
||||||
|
|
||||||
|
### Creating and viewing organizations
|
||||||
|
|
||||||
|
You can see what organizations [you belong to and add new organizations](
|
||||||
|
https://hub.docker.com/account/organizations/) from the Account Settings
|
||||||
|
tab. They are also listed below your user name on your repositories page
|
||||||
|
and in your account profile.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Organization groups
|
||||||
|
|
||||||
|
Users in the `Owners` group of an organization can create and modify the
|
||||||
|
membership of groups.
|
||||||
|
|
||||||
|
Unless they are the organization's `Owner`, users can only see groups of which they
|
||||||
|
are members.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Repository group permissions
|
||||||
|
|
||||||
|
Use organization groups to manage the users that can interact with your repositories.
|
||||||
|
|
||||||
|
You must be in an organization's `Owners` group to create a new group, Hub
|
||||||
|
repository, or automated build. As an `Owner`, you then delegate the following
|
||||||
|
repository access rights to groups:
|
||||||
|
|
||||||
|
| Access Right | Description |
|
||||||
|
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `Read` | Users with this right can view, search, and pull a private repository. |
|
||||||
|
| `Write` | Users with this right can push to non-automated repositories on the Docker Hub. |
|
||||||
|
| `Admin` | Users with this right can modify a repository's "Description", "Collaborators" rights. They can also mark a repository as unlisted, change its "Public/Private" status and "Delete" the repository. Finally, `Admin` rights are required to read the build log on a repo. |
|
||||||
|
| | |
|
||||||
|
|
||||||
|
Regardless of their actual access rights, users with unverified email addresses
|
||||||
|
have `Read` access to the repository. Once they have verified their address,
|
||||||
|
they have their full access rights as granted on the organization.
|
||||||
@@ -0,0 +1,465 @@
|
|||||||
|
<!--[metadata]>
|
||||||
|
+++
|
||||||
|
title = "Automated Builds on Docker Hub"
|
||||||
|
description = "Docker Hub Automated Builds"
|
||||||
|
keywords = ["Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, documentation, trusted, builds, trusted builds, automated builds"]
|
||||||
|
[menu.main]
|
||||||
|
parent = "smn_pubhub"
|
||||||
|
weight = 3
|
||||||
|
+++
|
||||||
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
# Automated Builds on Docker Hub
|
||||||
|
|
||||||
|
## About Automated Builds
|
||||||
|
|
||||||
|
*Automated Builds* are a special feature of Docker Hub which allow you to
|
||||||
|
use [Docker Hub's](https://hub.docker.com) build clusters to automatically
|
||||||
|
create images from a GitHub or Bitbucket repository containing a `Dockerfile`
|
||||||
|
The system will clone your repository and build the image described by the
|
||||||
|
`Dockerfile` using the directory the `Dockerfile` is in (and subdirectories)
|
||||||
|
as the build context. The resulting automated image will then be uploaded
|
||||||
|
to the Docker Hub registry and marked as an *Automated Build*.
|
||||||
|
|
||||||
|
Automated Builds have several advantages:
|
||||||
|
|
||||||
|
* Users of *your* Automated Build can trust that the resulting
|
||||||
|
image was built exactly as specified.
|
||||||
|
* The `Dockerfile` will be available to anyone with access to
|
||||||
|
your repository on the Docker Hub registry.
|
||||||
|
* Because the process is automated, Automated Builds help to
|
||||||
|
make sure that your repository is always up to date.
|
||||||
|
* Not having to push local Docker images to Docker Hub saves
|
||||||
|
you both network bandwidth and time.
|
||||||
|
|
||||||
|
Automated Builds are supported for both public and private repositories
|
||||||
|
on both [GitHub](http://github.com) and [Bitbucket](https://bitbucket.org/).
|
||||||
|
|
||||||
|
To use Automated Builds, you must have an [account on Docker Hub](
|
||||||
|
https://docs.docker.com/userguide/dockerhub/#creating-a-docker-hub-account)
|
||||||
|
and on GitHub and/or Bitbucket. In either case, the account needs
|
||||||
|
to be properly validated and activated before you can link to it.
|
||||||
|
|
||||||
|
The first time you to set up an Automated Build, your
|
||||||
|
[Docker Hub](https://hub.docker.com) account will need to be linked to
|
||||||
|
a GitHub or Bitbucket account.
|
||||||
|
This will allow the registry to see your repositories.
|
||||||
|
|
||||||
|
If you have previously linked your Docker Hub account, and want to view or modify
|
||||||
|
that link, click on the "Manage - Settings" link in the sidebar, and then
|
||||||
|
"Linked Accounts" in your Settings sidebar.
|
||||||
|
|
||||||
|
## Automated Builds from GitHub
|
||||||
|
|
||||||
|
If you've previously linked your Docker Hub account to your GitHub account,
|
||||||
|
you'll be able to skip to the [Creating an Automated Build](#creating-an-automated-build).
|
||||||
|
|
||||||
|
### Linking your Docker Hub account to a GitHub account
|
||||||
|
|
||||||
|
> *Note:*
|
||||||
|
> Automated Builds currently require *read* and *write* access since
|
||||||
|
> [Docker Hub](https://hub.docker.com) needs to setup a GitHub service
|
||||||
|
> hook. We have no choice here, this is how GitHub manages permissions, sorry!
|
||||||
|
> We do guarantee nothing else will be touched in your account.
|
||||||
|
|
||||||
|
To get started, log into your Docker Hub account and click the
|
||||||
|
"+ Add Repository" button at the upper right of the screen. Then select
|
||||||
|
[Automated Build](https://registry.hub.docker.com/builds/add/).
|
||||||
|
|
||||||
|
Select the [GitHub service](https://registry.hub.docker.com/associate/github/).
|
||||||
|
|
||||||
|
When linking to GitHub, you'll need to select either "Public and Private",
|
||||||
|
or "Limited" linking.
|
||||||
|
|
||||||
|
The "Public and Private" option is the easiest to use,
|
||||||
|
as it grants the Docker Hub full access to all of your repositories. GitHub
|
||||||
|
also allows you to grant access to repositories belonging to your GitHub
|
||||||
|
organizations.
|
||||||
|
|
||||||
|
By choosing the "Limited" linking, your Docker Hub account only gets permission
|
||||||
|
to access your public data and public repositories.
|
||||||
|
|
||||||
|
Follow the onscreen instructions to authorize and link your
|
||||||
|
GitHub account to Docker Hub. Once it is linked, you'll be able to
|
||||||
|
choose a source repository from which to create the Automatic Build.
|
||||||
|
|
||||||
|
You will be able to review and revoke Docker Hub's access by visiting the
|
||||||
|
[GitHub User's Applications settings](https://github.com/settings/applications).
|
||||||
|
|
||||||
|
> **Note**: If you delete the GitHub account linkage that is used for one of your
|
||||||
|
> automated build repositories, the previously built images will still be available.
|
||||||
|
> If you re-link to that GitHub account later, the automated build can be started
|
||||||
|
> using the "Start Build" button on the Hub, or if the webhook on the GitHub repository
|
||||||
|
> still exists, will be triggered by any subsequent commits.
|
||||||
|
|
||||||
|
### Auto builds and limited linked GitHub accounts.
|
||||||
|
|
||||||
|
If you selected to link your GitHub account with only a "Limited" link, then
|
||||||
|
after creating your automated build, you will need to either manually trigger a
|
||||||
|
Docker Hub build using the "Start a Build" button, or add the GitHub webhook
|
||||||
|
manually, as described in [GitHub Service Hooks](#github-service-hooks).
|
||||||
|
|
||||||
|
### Changing the GitHub user link
|
||||||
|
|
||||||
|
If you want to remove, or change the level of linking between your GitHub account
|
||||||
|
and the Docker Hub, you need to do this in two places.
|
||||||
|
|
||||||
|
First, remove the "Linked Account" from your Docker Hub "Settings".
|
||||||
|
Then go to your GitHub account's Personal settings, and in the "Applications"
|
||||||
|
section, "Revoke access".
|
||||||
|
|
||||||
|
You can now re-link your account at any time.
|
||||||
|
|
||||||
|
### GitHub organizations
|
||||||
|
|
||||||
|
GitHub organizations and private repositories forked from organizations will be
|
||||||
|
made available to auto build using the "Docker Hub Registry" application, which
|
||||||
|
needs to be added to the organization - and then will apply to all users.
|
||||||
|
|
||||||
|
To check, or request access, go to your GitHub user's "Setting" page, select the
|
||||||
|
"Applications" section from the left side bar, then click the "View" button for
|
||||||
|
"Docker Hub Registry".
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The organization's administrators may need to go to the Organization's "Third
|
||||||
|
party access" screen in "Settings" to Grant or Deny access to the Docker Hub
|
||||||
|
Registry application. This change will apply to all organization members.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
More detailed access controls to specific users and GitHub repositories would be
|
||||||
|
managed using the GitHub People and Teams interfaces.
|
||||||
|
|
||||||
|
### Creating an Automated Build
|
||||||
|
|
||||||
|
You can [create an Automated Build](
|
||||||
|
https://registry.hub.docker.com/builds/github/select/) from any of your
|
||||||
|
public or private GitHub repositories that have a `Dockerfile`.
|
||||||
|
|
||||||
|
Once you've selected the source repository, you can then configure:
|
||||||
|
|
||||||
|
- The Hub user/org the repository is built to - either your Hub account name,
|
||||||
|
or the name of any Hub organizations your account is in
|
||||||
|
- The Docker repository name the image is built to
|
||||||
|
- If the Docker repository should be "Public" or "Private"
|
||||||
|
You can change the accessibility options after the repository has been created.
|
||||||
|
If you add a Private repository to a Hub user, then you can only add other users
|
||||||
|
as collaborators, and those users will be able to view and pull all images in that
|
||||||
|
repository. To configure more granular access permissions, such as using groups of
|
||||||
|
users or allow different users access to different image tags, then you need
|
||||||
|
to add the Private repository to a Hub organization that your user has Administrator
|
||||||
|
privilege on.
|
||||||
|
- If you want the GitHub to notify the Docker Hub when a commit is made, and thus trigger
|
||||||
|
a rebuild of all the images in this automated build.
|
||||||
|
|
||||||
|
You can also select one or more
|
||||||
|
- The git branch/tag, which repository sub-directory to use as the context
|
||||||
|
- The Docker image tag name
|
||||||
|
|
||||||
|
You can set a description for the repository by clicking "Description" link in the righthand side bar after the automated build - note that the "Full Description" will be over-written next build from the README.md file.
|
||||||
|
has been created.
|
||||||
|
|
||||||
|
### GitHub private submodules
|
||||||
|
|
||||||
|
If your GitHub repository contains links to private submodules, you'll get an
|
||||||
|
error message in your build.
|
||||||
|
|
||||||
|
Normally, the Docker Hub sets up a deploy key in your GitHub repository.
|
||||||
|
Unfortunately, GitHub only allows a repository deploy key to access a single repository.
|
||||||
|
|
||||||
|
To work around this, you need to create a dedicated user account in GitHub and attach
|
||||||
|
the automated build's deploy key that account. This dedicated build account
|
||||||
|
can be limited to read-only access to just the repositories required to build.
|
||||||
|
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Step</th>
|
||||||
|
<th>Screenshot</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>1.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_org_members.png"></td>
|
||||||
|
<td>First, create the new account in GitHub. It should be given read-only
|
||||||
|
access to the main repository and all submodules that are needed.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>2.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_team_members.png"></td>
|
||||||
|
<td>This can be accomplished by adding the account to a read-only team in
|
||||||
|
the organization(s) where the main GitHub repository and all submodule
|
||||||
|
repositories are kept.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>3.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_repo_deploy_key.png"></td>
|
||||||
|
<td>Next, remove the deploy key from the main GitHub repository. This can be done in the GitHub repository's "Deploy keys" Settings section.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>4.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/deploy_key.png"></td>
|
||||||
|
<td>Your automated build's deploy key is in the "Build Details" menu
|
||||||
|
under "Deploy keys".</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>5.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_add_ssh_user_key.png"></td>
|
||||||
|
<td>In your dedicated GitHub User account, add the deploy key from your
|
||||||
|
Docker Hub Automated Build.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### GitHub service hooks
|
||||||
|
|
||||||
|
The GitHub Service hook allows GitHub to notify the Docker Hub when something has
|
||||||
|
been committed to that git repository. You will need to add the Service Hook manually
|
||||||
|
if your GitHub account is "Limited" linked to the Docker Hub.
|
||||||
|
|
||||||
|
Follow the steps below to configure the GitHub Service hooks for your Automated Build:
|
||||||
|
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Step</th>
|
||||||
|
<th>Screenshot</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>1.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_settings.png"></td>
|
||||||
|
<td>Log in to GitHub.com, and go to your Repository page. Click on "Settings" on
|
||||||
|
the right side of the page. You must have admin privileges to the repository in order to do this.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>2.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_menu.png" alt="Webhooks & Services"></td>
|
||||||
|
<td>Click on "Webhooks & Services" on the left side of the page.</td></tr>
|
||||||
|
<tr><td>3.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_service_hook.png" alt="Find the service labeled Docker"></td>
|
||||||
|
<td>Find the service labeled "Docker" (or click on "Add service") and click on it.</td></tr>
|
||||||
|
<tr><td>4.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/gh_docker-service.png" alt="Activate Service Hooks"></td>
|
||||||
|
<td>Make sure the "Active" checkbox is selected and click the "Update service" button to save your changes.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## Automated Builds with Bitbucket
|
||||||
|
|
||||||
|
In order to setup an Automated Build, you need to first link your
|
||||||
|
[Docker Hub](https://hub.docker.com) account with a Bitbucket account.
|
||||||
|
This will allow the registry to see your repositories.
|
||||||
|
|
||||||
|
To get started, log into your Docker Hub account and click the
|
||||||
|
"+ Add Repository" button at the upper right of the screen. Then
|
||||||
|
select [Automated Build](https://registry.hub.docker.com/builds/add/).
|
||||||
|
|
||||||
|
Select the [Bitbucket source](
|
||||||
|
https://registry.hub.docker.com/associate/bitbucket/).
|
||||||
|
|
||||||
|
Then follow the onscreen instructions to authorize and link your
|
||||||
|
Bitbucket account to Docker Hub. Once it is linked, you'll be able
|
||||||
|
to choose a repository from which to create the Automatic Build.
|
||||||
|
|
||||||
|
### Creating an Automated Build
|
||||||
|
|
||||||
|
You can [create an Automated Build](
|
||||||
|
https://registry.hub.docker.com/builds/bitbucket/select/) from any of your
|
||||||
|
public or private Bitbucket repositories with a `Dockerfile`.
|
||||||
|
|
||||||
|
### Adding a Hook
|
||||||
|
|
||||||
|
When you link your Docker Hub account, a `POST` hook should get automatically
|
||||||
|
added to your Bitbucket repository. Follow the steps below to confirm or modify the
|
||||||
|
Bitbucket hooks for your Automated Build:
|
||||||
|
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Step</th>
|
||||||
|
<th>Screenshot</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>1.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/bb_menu.png" alt="Settings" width="180"></td>
|
||||||
|
<td>Log in to Bitbucket.org and go to your Repository page. Click on "Settings" on
|
||||||
|
the far left side of the page, under "Navigation". You must have admin privileges
|
||||||
|
to the repository in order to do this.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>2.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/bb_hooks.png" alt="Hooks" width="180"></td>
|
||||||
|
<td>Click on "Hooks" on the near left side of the page, under "Settings".</td></tr>
|
||||||
|
<tr>
|
||||||
|
<td>3.</td>
|
||||||
|
<td><img src="/docker-hub/hub-images/bb_post-hook.png" alt="Docker Post Hook"></td><td>You should now see a list of hooks associated with the repo, including a <code>POST</code> hook that points at
|
||||||
|
registry.hub.docker.com/hooks/bitbucket.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
## The Dockerfile and Automated Builds
|
||||||
|
|
||||||
|
During the build process, Docker will copy the contents of your `Dockerfile`.
|
||||||
|
It will also add it to the [Docker Hub](https://hub.docker.com) for the Docker
|
||||||
|
community (for public repositories) or approved team members/orgs (for private
|
||||||
|
repositories) to see on the repository page.
|
||||||
|
|
||||||
|
### README.md
|
||||||
|
|
||||||
|
If you have a `README.md` file in your repository, it will be used as the
|
||||||
|
repository's full description.The build process will look for a
|
||||||
|
`README.md` in the same directory as your `Dockerfile`.
|
||||||
|
|
||||||
|
> **Warning:**
|
||||||
|
> If you change the full description after a build, it will be
|
||||||
|
> rewritten the next time the Automated Build has been built. To make changes,
|
||||||
|
> modify the `README.md` from the Git repository.
|
||||||
|
|
||||||
|
## Remote Build triggers
|
||||||
|
|
||||||
|
If you need a way to trigger Automated Builds outside of GitHub or Bitbucket,
|
||||||
|
you can set up a build trigger. When you turn on the build trigger for an
|
||||||
|
Automated Build, it will give you a URL to which you can send POST requests.
|
||||||
|
This will trigger the Automated Build, much as with a GitHub webhook.
|
||||||
|
|
||||||
|
Build triggers are available under the Settings menu of each Automated Build
|
||||||
|
repository on the Docker Hub.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can use `curl` to trigger a build:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ curl --data "build=true" -X POST https://registry.hub.docker.com/u/svendowideit/testhook/trigger/be579c
|
||||||
|
82-7c0e-11e4-81c4-0242ac110020/
|
||||||
|
OK
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> You can only trigger one build at a time and no more than one
|
||||||
|
> every five minutes. If you already have a build pending, or if you
|
||||||
|
> recently submitted a build request, those requests *will be ignored*.
|
||||||
|
> To verify everything is working correctly, check the logs of last
|
||||||
|
> ten triggers on the settings page .
|
||||||
|
|
||||||
|
## Webhooks
|
||||||
|
|
||||||
|
Automated Builds also include a Webhooks feature. Webhooks can be called
|
||||||
|
after a successful repository push is made. This includes when a new tag is added
|
||||||
|
to an existing image.
|
||||||
|
|
||||||
|
The webhook call will generate a HTTP POST with the following JSON
|
||||||
|
payload:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"callback_url": "https://registry.hub.docker.com/u/svendowideit/testhook/hook/2141b5bi5i5b02bec211i4eeih0242eg11000a/",
|
||||||
|
"push_data": {
|
||||||
|
"images": [
|
||||||
|
"27d47432a69bca5f2700e4dff7de0388ed65f9d3fb1ec645e2bc24c223dc1cc3",
|
||||||
|
"51a9c7c1f8bb2fa19bcd09789a34e63f35abb80044bc10196e304f6634cc582c",
|
||||||
|
...
|
||||||
|
],
|
||||||
|
"pushed_at": 1.417566161e+09,
|
||||||
|
"pusher": "trustedbuilder"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"comment_count": 0,
|
||||||
|
"date_created": 1.417494799e+09,
|
||||||
|
"description": "",
|
||||||
|
"dockerfile": "#\n# BUILD\u0009\u0009docker build -t svendowideit/apt-cacher .\n# RUN\u0009\u0009docker run -d -p 3142:3142 -name apt-cacher-run apt-cacher\n#\n# and then you can run containers with:\n# \u0009\u0009docker run -t -i -rm -e http_proxy http://192.168.1.2:3142/ debian bash\n#\nFROM\u0009\u0009ubuntu\nMAINTAINER\u0009SvenDowideit@home.org.au\n\n\nVOLUME\u0009\u0009[\"/var/cache/apt-cacher-ng\"]\nRUN\u0009\u0009apt-get update ; apt-get install -yq apt-cacher-ng\n\nEXPOSE \u0009\u00093142\nCMD\u0009\u0009chmod 777 /var/cache/apt-cacher-ng ; /etc/init.d/apt-cacher-ng start ; tail -f /var/log/apt-cacher-ng/*\n",
|
||||||
|
"full_description": "Docker Hub based automated build from a GitHub repo",
|
||||||
|
"is_official": false,
|
||||||
|
"is_private": true,
|
||||||
|
"is_trusted": true,
|
||||||
|
"name": "testhook",
|
||||||
|
"namespace": "svendowideit",
|
||||||
|
"owner": "svendowideit",
|
||||||
|
"repo_name": "svendowideit/testhook",
|
||||||
|
"repo_url": "https://registry.hub.docker.com/u/svendowideit/testhook/",
|
||||||
|
"star_count": 0,
|
||||||
|
"status": "Active"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Webhooks are available under the Settings menu of each Repository.
|
||||||
|
Use a tool like [requestb.in](http://requestb.in/) to test your webhook.
|
||||||
|
|
||||||
|
> **Note**: The Docker Hub servers use an elastic IP range, so you can't
|
||||||
|
> filter requests by IP.
|
||||||
|
|
||||||
|
### Webhook chains
|
||||||
|
|
||||||
|
Webhook chains allow you to chain calls to multiple services. For example,
|
||||||
|
you can use this to trigger a deployment of your container only after
|
||||||
|
it has been successfully tested, then update a separate Changelog once the
|
||||||
|
deployment is complete.
|
||||||
|
After clicking the "Add webhook" button, simply add as many URLs as necessary
|
||||||
|
in your chain.
|
||||||
|
|
||||||
|
The first webhook in a chain will be called after a successful push. Subsequent
|
||||||
|
URLs will be contacted after the callback has been validated.
|
||||||
|
|
||||||
|
### Validating a callback
|
||||||
|
|
||||||
|
In order to validate a callback in a webhook chain, you need to
|
||||||
|
|
||||||
|
1. Retrieve the `callback_url` value in the request's JSON payload.
|
||||||
|
1. Send a POST request to this URL containing a valid JSON body.
|
||||||
|
|
||||||
|
> **Note**: A chain request will only be considered complete once the last
|
||||||
|
> callback has been validated.
|
||||||
|
|
||||||
|
To help you debug or simply view the results of your webhook(s),
|
||||||
|
view the "History" of the webhook available on its settings page.
|
||||||
|
|
||||||
|
### Callback JSON data
|
||||||
|
|
||||||
|
The following parameters are recognized in callback data:
|
||||||
|
|
||||||
|
* `state` (required): Accepted values are `success`, `failure` and `error`.
|
||||||
|
If the state isn't `success`, the webhook chain will be interrupted.
|
||||||
|
* `description`: A string containing miscellaneous information that will be
|
||||||
|
available on the Docker Hub. Maximum 255 characters.
|
||||||
|
* `context`: A string containing the context of the operation. Can be retrieved
|
||||||
|
from the Docker Hub. Maximum 100 characters.
|
||||||
|
* `target_url`: The URL where the results of the operation can be found. Can be
|
||||||
|
retrieved on the Docker Hub.
|
||||||
|
|
||||||
|
*Example callback payload:*
|
||||||
|
|
||||||
|
{
|
||||||
|
"state": "success",
|
||||||
|
"description": "387 tests PASSED",
|
||||||
|
"context": "Continuous integration by Acme CI",
|
||||||
|
"target_url": "http://ci.acme.com/results/afd339c1c3d27"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Repository links
|
||||||
|
|
||||||
|
Repository links are a way to associate one Automated Build with
|
||||||
|
another. If one gets updated, the linking system triggers a rebuild
|
||||||
|
for the other Automated Build. This makes it easy to keep all your
|
||||||
|
Automated Builds up to date.
|
||||||
|
|
||||||
|
To add a link, go to the repository for the Automated Build you want to
|
||||||
|
link to and click on *Repository Links* under the Settings menu at
|
||||||
|
right. Then, enter the name of the repository that you want have linked.
|
||||||
|
|
||||||
|
> **Warning:**
|
||||||
|
> You can add more than one repository link, however, you should
|
||||||
|
> do so very carefully. Creating a two way relationship between Automated Builds will
|
||||||
|
> cause an endless build loop.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<!--[metadata]>
|
||||||
|
+++
|
||||||
|
draft = true
|
||||||
|
title = "The Docker Hub Registry help"
|
||||||
|
description = "The Docker Registry help documentation home"
|
||||||
|
keywords = ["Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, documentation"]
|
||||||
|
[menu.main]
|
||||||
|
parent = "smn_pubhub"
|
||||||
|
+++
|
||||||
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
# The Docker Hub Registry help
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
For your questions about the [Docker Hub](https://hub.docker.com) registry you
|
||||||
|
can use [this documentation](docs.md).
|
||||||
|
|
||||||
|
If you can not find something you are looking for, please feel free to
|
||||||
|
[contact us](https://docker.com/resources/support/).
|
||||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,38 @@
|
|||||||
|
<!--[metadata]>
|
||||||
|
+++
|
||||||
|
title = "The Docker Hub"
|
||||||
|
description = "The Docker Help documentation home"
|
||||||
|
keywords = ["Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, documentation, accounts, organizations, repositories, groups"]
|
||||||
|
[menu.main]
|
||||||
|
parent = "smn_pubhub"
|
||||||
|
+++
|
||||||
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
# Docker Hub
|
||||||
|
|
||||||
|
The [Docker Hub](https://hub.docker.com) provides a cloud-based platform service
|
||||||
|
for distributed applications, including container image distribution and change
|
||||||
|
management, user and team collaboration, and lifecycle workflow automation.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## [Finding and pulling images](./userguide.md)
|
||||||
|
|
||||||
|
Find out how to [use the Docker Hub](./userguide.md) to find and pull Docker
|
||||||
|
images to run or build upon.
|
||||||
|
|
||||||
|
## [Accounts](./accounts.md)
|
||||||
|
|
||||||
|
[Learn how to create](./accounts.md) a Docker Hub
|
||||||
|
account and manage your organizations and groups.
|
||||||
|
|
||||||
|
## [Your Repositories](./repos.md)
|
||||||
|
|
||||||
|
Find out how to share your Docker images in [Docker Hub
|
||||||
|
repositories](./repos.md) and how to store and manage private images.
|
||||||
|
|
||||||
|
## [Automated builds](./builds.md)
|
||||||
|
|
||||||
|
Learn how to automate your build and deploy pipeline with [Automated
|
||||||
|
Builds](./builds.md)
|
||||||
|
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
<!--[metadata]>
|
||||||
|
+++
|
||||||
|
title = "Official Repositories on Docker Hub"
|
||||||
|
description = "Guidelines for Official Repositories on Docker Hub"
|
||||||
|
keywords = ["Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, official, image, documentation"]
|
||||||
|
[menu.main]
|
||||||
|
parent = "smn_pubhub"
|
||||||
|
weight = 4
|
||||||
|
+++
|
||||||
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
# Official Repositories on Docker Hub
|
||||||
|
|
||||||
|
The Docker [Official Repositories](http://registry.hub.docker.com/official) are
|
||||||
|
a curated set of Docker repositories that are promoted on Docker Hub. They are
|
||||||
|
designed to:
|
||||||
|
|
||||||
|
* Provide essential base OS repositories (for example,
|
||||||
|
[`ubuntu`](https://registry.hub.docker.com/_/ubuntu/),
|
||||||
|
[`centos`](https://registry.hub.docker.com/_/centos/)) that serve as the
|
||||||
|
starting point for the majority of users.
|
||||||
|
|
||||||
|
* Provide drop-in solutions for popular programming language runtimes, data
|
||||||
|
stores, and other services, similar to what a Platform-as-a-Service (PAAS)
|
||||||
|
would offer.
|
||||||
|
|
||||||
|
* Exemplify [`Dockerfile` best practices](/articles/dockerfile_best-practices)
|
||||||
|
and provide clear documentation to serve as a reference for other `Dockerfile`
|
||||||
|
authors.
|
||||||
|
|
||||||
|
* Ensure that security updates are applied in a timely manner. This is
|
||||||
|
particularly important as many Official Repositories are some of the most
|
||||||
|
popular on Docker Hub.
|
||||||
|
|
||||||
|
* Provide a channel for software vendors to redistribute up-to-date and
|
||||||
|
supported versions of their products. Organization accounts on Docker Hub can
|
||||||
|
also serve this purpose, without the careful review or restrictions on what
|
||||||
|
can be published.
|
||||||
|
|
||||||
|
Docker, Inc. sponsors a dedicated team that is responsible for reviewing and
|
||||||
|
publishing all Official Repositories content. This team works in collaboration
|
||||||
|
with upstream software maintainers, security experts, and the broader Docker
|
||||||
|
community.
|
||||||
|
|
||||||
|
While it is preferable to have upstream software authors maintaining their
|
||||||
|
corresponding Official Repositories, this is not a strict requirement. Creating
|
||||||
|
and maintaining images for Official Repositories is a public process. It takes
|
||||||
|
place openly on GitHub where participation is encouraged. Anyone can provide
|
||||||
|
feedback, contribute code, suggest process changes, or even propose a new
|
||||||
|
Official Repository.
|
||||||
|
|
||||||
|
## Should I use Official Repositories?
|
||||||
|
|
||||||
|
New Docker users are encouraged to use the Official Repositories in their
|
||||||
|
projects. These repositories have clear documentation, promote best practices,
|
||||||
|
and are designed for the most common use cases. Advanced users are encouraged to
|
||||||
|
review the Official Repositories as part of their `Dockerfile` learning process.
|
||||||
|
|
||||||
|
A common rationale for diverging from Official Repositories is to optimize for
|
||||||
|
image size. For instance, many of the programming language stack images contain
|
||||||
|
a complete build toolchain to support installation of modules that depend on
|
||||||
|
optimized code. An advanced user could build a custom image with just the
|
||||||
|
necessary pre-compiled libraries to save space.
|
||||||
|
|
||||||
|
A number of language stacks such as
|
||||||
|
[`python`](https://registry.hub.docker.com/_/python/) and
|
||||||
|
[`ruby`](https://registry.hub.docker.com/_/ruby/) have `-slim` tag variants
|
||||||
|
designed to fill the need for optimization. Even when these "slim" variants are
|
||||||
|
insufficient, it is still recommended to inherit from an Official Repository
|
||||||
|
base OS image to leverage the ongoing maintenance work, rather than duplicating
|
||||||
|
these efforts.
|
||||||
|
|
||||||
|
## How can I get involved?
|
||||||
|
|
||||||
|
All Official Repositories contain a **User Feedback** section in their
|
||||||
|
documentation which covers the details for that specific repository. In most
|
||||||
|
cases, the GitHub repository which contains the Dockerfiles for an Official
|
||||||
|
Repository also has an active issue tracker. General feedback and support
|
||||||
|
questions should be directed to `#docker-library` on Freenode IRC.
|
||||||
|
|
||||||
|
## How do I create a new Official Repository?
|
||||||
|
|
||||||
|
From a high level, an Official Repository starts out as a proposal in the form
|
||||||
|
of a set of GitHub pull requests. You'll find detailed and objective proposal
|
||||||
|
requirements in the following GitHub repositories:
|
||||||
|
|
||||||
|
* [docker-library/official-images](https://github.com/docker-library/official-images)
|
||||||
|
|
||||||
|
* [docker-library/docs](https://github.com/docker-library/docs)
|
||||||
|
|
||||||
|
The Official Repositories team, with help from community contributors, formally
|
||||||
|
review each proposal and provide feedback to the author. This initial review
|
||||||
|
process may require a bit of back and forth before the proposal is accepted.
|
||||||
|
|
||||||
|
There are also subjective considerations during the review process. These
|
||||||
|
subjective concerns boil down to the basic question: "is this image generally
|
||||||
|
useful?" For example, the [`python`](https://registry.hub.docker.com/_/python/)
|
||||||
|
Official Repository is "generally useful" to the large Python developer
|
||||||
|
community, whereas an obscure text adventure game written in Python last week is
|
||||||
|
not.
|
||||||
|
|
||||||
|
When a new proposal is accepted, the author becomes responsible for keeping
|
||||||
|
their images up-to-date and responding to user feedback. The Official
|
||||||
|
Repositories team becomes responsible for publishing the images and
|
||||||
|
documentation on Docker Hub. Updates to the Official Repository follow the same
|
||||||
|
pull request process, though with less review. The Official Repositories team
|
||||||
|
ultimately acts as a gatekeeper for all changes, which helps mitigate the risk
|
||||||
|
of quality and security issues from being introduced.
|
||||||
|
|
||||||
|
> **Note**: If you are interested in proposing an Official Repository, but would
|
||||||
|
> like to discuss it with Docker, Inc. privately first, please send your
|
||||||
|
> inquiries to partners@docker.com. There is no fast-track or pay-for-status
|
||||||
|
> option.
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
<!--[metadata]>
|
||||||
|
+++
|
||||||
|
title = "Your Repositories on Docker Hub"
|
||||||
|
description = "Your Repositories on Docker Hub"
|
||||||
|
keywords = ["Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, webhooks, docs, documentation"]
|
||||||
|
[menu.main]
|
||||||
|
parent = "smn_pubhub"
|
||||||
|
weight = 2
|
||||||
|
+++
|
||||||
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
# Your Hub repositories
|
||||||
|
|
||||||
|
Docker Hub repositories make it possible for you to share images with co-workers,
|
||||||
|
customers or the Docker community at large. If you're building your images internally,
|
||||||
|
either on your own Docker daemon, or using your own Continuous integration services,
|
||||||
|
you can push them to a Docker Hub repository that you add to your Docker Hub user or
|
||||||
|
organization account.
|
||||||
|
|
||||||
|
Alternatively, if the source code for your Docker image is on GitHub or Bitbucket,
|
||||||
|
you can use an "Automated build" repository, which is built by the Docker Hub
|
||||||
|
services. See the [automated builds documentation](./builds.md) to read about
|
||||||
|
the extra functionality provided by those services.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Your Docker Hub repositories have a number of useful features.
|
||||||
|
|
||||||
|
## Stars
|
||||||
|
|
||||||
|
Your repositories can be starred and you can star repositories in
|
||||||
|
return. Stars are a way to show that you like a repository. They are
|
||||||
|
also an easy way of bookmarking your favorites.
|
||||||
|
|
||||||
|
## Comments
|
||||||
|
|
||||||
|
You can interact with other members of the Docker community and maintainers by
|
||||||
|
leaving comments on repositories. If you find any comments that are not
|
||||||
|
appropriate, you can flag them for review.
|
||||||
|
|
||||||
|
## Collaborators and their role
|
||||||
|
|
||||||
|
A collaborator is someone you want to give access to a private
|
||||||
|
repository. Once designated, they can `push` and `pull` to your
|
||||||
|
repositories. They will not be allowed to perform any administrative
|
||||||
|
tasks such as deleting the repository or changing its status from
|
||||||
|
private to public.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> A collaborator cannot add other collaborators. Only the owner of
|
||||||
|
> the repository has administrative access.
|
||||||
|
|
||||||
|
You can also assign more granular collaborator rights ("Read", "Write", or "Admin")
|
||||||
|
on Docker Hub by using organizations and groups. For more information
|
||||||
|
see the [accounts documentation](accounts/).
|
||||||
|
|
||||||
|
## Private repositories
|
||||||
|
|
||||||
|
Private repositories allow you to have repositories that contain images
|
||||||
|
that you want to keep private, either to your own account or within an
|
||||||
|
organization or group.
|
||||||
|
|
||||||
|
To work with a private repository on [Docker
|
||||||
|
Hub](https://hub.docker.com), you will need to add one via the [Add
|
||||||
|
Repository](https://registry.hub.docker.com/account/repositories/add/)
|
||||||
|
link. You get one private repository for free with your Docker Hub
|
||||||
|
account. If you need more accounts you can upgrade your [Docker
|
||||||
|
Hub](https://registry.hub.docker.com/plans/) plan.
|
||||||
|
|
||||||
|
Once the private repository is created, you can `push` and `pull` images
|
||||||
|
to and from it using Docker.
|
||||||
|
|
||||||
|
> *Note:* You need to be signed in and have access to work with a
|
||||||
|
> private repository.
|
||||||
|
|
||||||
|
Private repositories are just like public ones. However, it isn't
|
||||||
|
possible to browse them or search their content on the public registry.
|
||||||
|
They do not get cached the same way as a public repository either.
|
||||||
|
|
||||||
|
It is possible to give access to a private repository to those whom you
|
||||||
|
designate (i.e., collaborators) from its Settings page. From there, you
|
||||||
|
can also switch repository status (*public* to *private*, or
|
||||||
|
vice-versa). You will need to have an available private repository slot
|
||||||
|
open before you can do such a switch. If you don't have any available,
|
||||||
|
you can always upgrade your [Docker
|
||||||
|
Hub](https://registry.hub.docker.com/plans/) plan.
|
||||||
|
|
||||||
|
## Webhooks
|
||||||
|
|
||||||
|
A webhook is an HTTP call-back triggered by a specific event.
|
||||||
|
You can use a Hub repository webhook to notify people, services, and other
|
||||||
|
applications after a new image is pushed to your repository (this also happens
|
||||||
|
for Automated builds). For example, you can trigger an automated test or
|
||||||
|
deployment to happen as soon as the image is available.
|
||||||
|
|
||||||
|
To get started adding webhooks, go to the desired repository in the Hub,
|
||||||
|
and click "Webhooks" under the "Settings" box.
|
||||||
|
A webhook is called only after a successful `push` is
|
||||||
|
made. The webhook calls are HTTP POST requests with a JSON payload
|
||||||
|
similar to the example shown below.
|
||||||
|
|
||||||
|
*Example webhook JSON payload:*
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"callback_url": "https://registry.hub.docker.com/u/svendowideit/busybox/hook/2141bc0cdec4hebec411i4c1g40242eg110020/",
|
||||||
|
"push_data": {
|
||||||
|
"images": [
|
||||||
|
"27d47432a69bca5f2700e4dff7de0388ed65f9d3fb1ec645e2bc24c223dc1cc3",
|
||||||
|
"51a9c7c1f8bb2fa19bcd09789a34e63f35abb80044bc10196e304f6634cc582c",
|
||||||
|
...
|
||||||
|
],
|
||||||
|
"pushed_at": 1.417566822e+09,
|
||||||
|
"pusher": "svendowideit"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"comment_count": 0,
|
||||||
|
"date_created": 1.417566665e+09,
|
||||||
|
"description": "",
|
||||||
|
"full_description": "webhook triggered from a 'docker push'",
|
||||||
|
"is_official": false,
|
||||||
|
"is_private": false,
|
||||||
|
"is_trusted": false,
|
||||||
|
"name": "busybox",
|
||||||
|
"namespace": "svendowideit",
|
||||||
|
"owner": "svendowideit",
|
||||||
|
"repo_name": "svendowideit/busybox",
|
||||||
|
"repo_url": "https://registry.hub.docker.com/u/svendowideit/busybox/",
|
||||||
|
"star_count": 0,
|
||||||
|
"status": "Active"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<TODO: does it tell you what tag was updated?>
|
||||||
|
|
||||||
|
For testing, you can try an HTTP request tool like [requestb.in](http://requestb.in/).
|
||||||
|
|
||||||
|
> **Note**: The Docker Hub servers use an elastic IP range, so you can't
|
||||||
|
> filter requests by IP.
|
||||||
|
|
||||||
|
### Webhook chains
|
||||||
|
|
||||||
|
Webhook chains allow you to chain calls to multiple services. For example,
|
||||||
|
you can use this to trigger a deployment of your container only after
|
||||||
|
it has been successfully tested, then update a separate Changelog once the
|
||||||
|
deployment is complete.
|
||||||
|
After clicking the "Add webhook" button, simply add as many URLs as necessary
|
||||||
|
in your chain.
|
||||||
|
|
||||||
|
The first webhook in a chain will be called after a successful push. Subsequent
|
||||||
|
URLs will be contacted after the callback has been validated.
|
||||||
|
|
||||||
|
### Validating a callback
|
||||||
|
|
||||||
|
In order to validate a callback in a webhook chain, you need to
|
||||||
|
|
||||||
|
1. Retrieve the `callback_url` value in the request's JSON payload.
|
||||||
|
1. Send a POST request to this URL containing a valid JSON body.
|
||||||
|
|
||||||
|
> **Note**: A chain request will only be considered complete once the last
|
||||||
|
> callback has been validated.
|
||||||
|
|
||||||
|
To help you debug or simply view the results of your webhook(s),
|
||||||
|
view the "History" of the webhook available on its settings page.
|
||||||
|
|
||||||
|
#### Callback JSON data
|
||||||
|
|
||||||
|
The following parameters are recognized in callback data:
|
||||||
|
|
||||||
|
* `state` (required): Accepted values are `success`, `failure` and `error`.
|
||||||
|
If the state isn't `success`, the webhook chain will be interrupted.
|
||||||
|
* `description`: A string containing miscellaneous information that will be
|
||||||
|
available on the Docker Hub. Maximum 255 characters.
|
||||||
|
* `context`: A string containing the context of the operation. Can be retrieved
|
||||||
|
from the Docker Hub. Maximum 100 characters.
|
||||||
|
* `target_url`: The URL where the results of the operation can be found. Can be
|
||||||
|
retrieved on the Docker Hub.
|
||||||
|
|
||||||
|
*Example callback payload:*
|
||||||
|
|
||||||
|
{
|
||||||
|
"state": "success",
|
||||||
|
"description": "387 tests PASSED",
|
||||||
|
"context": "Continuous integration by Acme CI",
|
||||||
|
"target_url": "http://ci.acme.com/results/afd339c1c3d27"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Mark as unlisted
|
||||||
|
|
||||||
|
By marking a repository as unlisted, you can create a publicly pullable repository
|
||||||
|
which will not be in the Hub or commandline search. This allows you to have a limited
|
||||||
|
release, but does not restrict access to anyone that is told, or guesses the repository
|
||||||
|
name.
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<!--[metadata]>
|
||||||
|
+++
|
||||||
|
title = "Docker Hub user guide"
|
||||||
|
description = "Docker Hub user guide"
|
||||||
|
keywords = ["Docker, docker, registry, Docker Hub, docs, documentation"]
|
||||||
|
[menu.main]
|
||||||
|
parent = "smn_pubhub"
|
||||||
|
+++
|
||||||
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
# Using the Docker Hub
|
||||||
|
|
||||||
|
Docker Hub is used to find and pull Docker images to run or build upon, and to
|
||||||
|
distribute and build images for other users to use.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Finding repositories and images
|
||||||
|
|
||||||
|
There are two ways you can search for public repositories and images available
|
||||||
|
on the Docker Hub. You can use the "Search" tool on the Docker Hub website, or
|
||||||
|
you can `search` for all the repositories and images using the Docker commandline
|
||||||
|
tool:
|
||||||
|
|
||||||
|
$ docker search ubuntu
|
||||||
|
|
||||||
|
Both will show you a list of the currently available public repositories on the
|
||||||
|
Docker Hub which match the provided keyword.
|
||||||
|
|
||||||
|
If a repository is private or marked as unlisted, it won't be in the repository
|
||||||
|
search results. To see all the repositories you have access to and their statuses,
|
||||||
|
you can look at your profile page on [Docker Hub](https://hub.docker.com).
|
||||||
|
|
||||||
|
## Pulling, running and building images
|
||||||
|
|
||||||
|
You can find more information on [working with Docker images](../userguide/dockerimages.md).
|
||||||
|
|
||||||
|
## Official Repositories
|
||||||
|
|
||||||
|
The Docker Hub contains a number of [Official
|
||||||
|
Repositories](http://registry.hub.docker.com/official). These are
|
||||||
|
certified repositories from vendors and contributors to Docker. They
|
||||||
|
contain Docker images from vendors like Canonical, Oracle, and Red Hat
|
||||||
|
that you can use to build applications and services.
|
||||||
|
|
||||||
|
If you use Official Repositories you know you're using an optimized and
|
||||||
|
up-to-date image to power your applications.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> If you would like to contribute an Official Repository for your
|
||||||
|
> organization, see [Official Repositories on Docker
|
||||||
|
> Hub](/docker-hub/official_repos) for more information.
|
||||||
|
|
||||||
|
## Building and shipping your own repositories and images
|
||||||
|
|
||||||
|
The Docker Hub provides you and your team with a place to build and ship Docker images.
|
||||||
|
|
||||||
|
Collections of Docker images are managed using repositories -
|
||||||
|
|
||||||
|
You can configure two types of repositories to manage on the Docker Hub:
|
||||||
|
[Repositories](./repos.md), which allow you to push images to the Hub from your local Docker daemon,
|
||||||
|
and [Automated Builds](./builds.md), which allow you to configure GitHub or Bitbucket to
|
||||||
|
trigger the Hub to rebuild repositories when changes are made to the repository.
|
||||||
@@ -96,7 +96,7 @@ which is officially supported by Docker.
|
|||||||
>command fails for the Docker repo during installation. To work around this,
|
>command fails for the Docker repo during installation. To work around this,
|
||||||
>add the key directly using the following:
|
>add the key directly using the following:
|
||||||
>
|
>
|
||||||
> $ curl -sSL https://get.docker.com/gpg | sudo apt-key add -
|
> $ wget -qO- https://get.docker.com/gpg | sudo apt-key add -
|
||||||
|
|
||||||
### Uninstallation
|
### Uninstallation
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ installation mechanisms. Using these packages ensures you get the latest release
|
|||||||
of Docker. If you wish to install using Fedora-managed packages, consult your
|
of Docker. If you wish to install using Fedora-managed packages, consult your
|
||||||
Fedora release documentation for information on Fedora's Docker support.
|
Fedora release documentation for information on Fedora's Docker support.
|
||||||
|
|
||||||
## Prerequisites
|
##Prerequisites
|
||||||
|
|
||||||
Docker requires a 64-bit installation regardless of your Fedora version. Also, your kernel must be 3.10 at minimum. To check your current kernel
|
Docker requires a 64-bit installation regardless of your Fedora version. Also, your kernel must be 3.10 at minimum. To check your current kernel
|
||||||
version, open a terminal and use `uname -r` to display your kernel version:
|
version, open a terminal and use `uname -r` to display your kernel version:
|
||||||
@@ -206,24 +206,6 @@ If you need to add an HTTP Proxy, set a different directory or partition for the
|
|||||||
Docker runtime files, or make other customizations, read our Systemd article to
|
Docker runtime files, or make other customizations, read our Systemd article to
|
||||||
learn how to [customize your Systemd Docker daemon options](/articles/systemd/).
|
learn how to [customize your Systemd Docker daemon options](/articles/systemd/).
|
||||||
|
|
||||||
## Running Docker with a manually-defined network
|
|
||||||
|
|
||||||
If you manually configure your network using `systemd-network` with `systemd` version 219 or higher, containers you start with Docker may be unable to access your network.
|
|
||||||
Beginning with version 220, the forwarding setting for a given network (`net.ipv4.conf.<interface>.forwarding`) defaults to *off*. This setting prevents IP forwarding. It also conflicts with Docker which enables the `net.ipv4.conf.all.forwarding` setting within a container.
|
|
||||||
|
|
||||||
To work around this, edit the `<interface>.network` file in
|
|
||||||
`/usr/lib/systemd/network/` on your Docker host (ex: `/usr/lib/systemd/network/80-container-host0.network`) add the following block:
|
|
||||||
|
|
||||||
```
|
|
||||||
[Network]
|
|
||||||
...
|
|
||||||
IPForward=kernel
|
|
||||||
# OR
|
|
||||||
IPForward=true
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
This configuration allows IP forwarding from the container as expected.
|
|
||||||
|
|
||||||
## Uninstall
|
## Uninstall
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 68 KiB |
@@ -10,34 +10,37 @@ parent = "smn_engine"
|
|||||||
|
|
||||||
# Mac OS X
|
# Mac OS X
|
||||||
|
|
||||||
> **Note**: This release of Docker deprecates the Boot2Docker command line in
|
You can install Docker using Boot2Docker to run `docker` commands at your command-line.
|
||||||
> favor of Docker Machine. Use the Docker Toolbox to install Docker Machine as
|
Choose this installation if you are familiar with the command-line or plan to
|
||||||
> well as the other Docker tools.
|
contribute to the Docker project on GitHub.
|
||||||
|
|
||||||
You install Docker using Docker Toolbox. Docker Toolbox includes the following Docker tools:
|
[<img src="/installation/images/kitematic.png" alt="Download Kitematic"
|
||||||
|
style="float:right;">](https://kitematic.com/download)
|
||||||
|
|
||||||
* Docker Machine for running the `docker-machine` binary
|
Alternatively, you may want to try <a id="inlinelink" href="https://kitematic.com/"
|
||||||
* Docker Engine for running the `docker` binary
|
target="_blank">Kitematic</a>, an application that lets you set up Docker and
|
||||||
* Docker Compose for running the `docker-compose` binary
|
run containers using a graphical user interface (GUI).
|
||||||
* Kitematic, the Docker GUI
|
|
||||||
* a shell preconfigured for a Docker command-line environment
|
## Command-line Docker with Boot2Docker
|
||||||
* Oracle VM VirtualBox
|
|
||||||
|
|
||||||
Because the Docker daemon uses Linux-specific kernel features, you can't run
|
Because the Docker daemon uses Linux-specific kernel features, you can't run
|
||||||
Docker natively in OS X. Instead, you must use `docker-machine` to create and
|
Docker natively in OS X. Instead, you must install the Boot2Docker application.
|
||||||
attach to a virtual machine (VM). This machine is a Linux VM that hosts Docker
|
The application includes a VirtualBox Virtual Machine (VM), Docker itself, and the
|
||||||
for you on your Mac.
|
Boot2Docker management tool.
|
||||||
|
|
||||||
|
The Boot2Docker management tool is a lightweight Linux virtual machine made
|
||||||
|
specifically to run the Docker daemon on Mac OS X. The VirtualBox VM runs
|
||||||
|
completely from RAM, is a small ~24MB download, and boots in approximately 5s.
|
||||||
|
|
||||||
**Requirements**
|
**Requirements**
|
||||||
|
|
||||||
Your Mac must be running OS X 10.8 "Mountain Lion" or newer to install the
|
Your Mac must be running OS X 10.6 "Snow Leopard" or newer to run Boot2Docker.
|
||||||
Docker Toolbox.
|
|
||||||
|
|
||||||
### Learn the key concepts before installing
|
### Learn the key concepts before installing
|
||||||
|
|
||||||
In a Docker installation on Linux, your physical machine is both the localhost
|
In a Docker installation on Linux, your machine is both the localhost and the
|
||||||
and the Docker host. In networking, localhost means your computer. The Docker
|
Docker host. In networking, localhost means your computer. The Docker host is
|
||||||
host is the computer on which the containers run.
|
the machine on which the containers run.
|
||||||
|
|
||||||
On a typical Linux installation, the Docker client, the Docker daemon, and any
|
On a typical Linux installation, the Docker client, the Docker daemon, and any
|
||||||
containers run directly on your localhost. This means you can address ports on a
|
containers run directly on your localhost. This means you can address ports on a
|
||||||
@@ -46,243 +49,135 @@ Docker container using standard localhost addressing such as `localhost:8000` or
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
In an OS X installation, the `docker` daemon is running inside a Linux VM called
|
In an OS X installation, the `docker` daemon is running inside a Linux virtual
|
||||||
`default`. The `default` is a lightweight Linux VM made specifically to run
|
machine provided by Boot2Docker.
|
||||||
the Docker daemon on Mac OS X. The VM runs completely from RAM, is a small ~24MB
|
|
||||||
download, and boots in approximately 5s.
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
In OS X, the Docker host address is the address of the Linux VM. When you start
|
In OS X, the Docker host address is the address of the Linux VM.
|
||||||
the VM with `docker-machine` it is assigned an IP address. When you start a
|
When you start the `boot2docker` process, the VM is assigned an IP address. Under
|
||||||
container, the ports on a container map to ports on the VM. To see this in
|
`boot2docker` ports on a container map to ports on the VM. To see this in
|
||||||
practice, work through the exercises on this page.
|
practice, work through the exercises on this page.
|
||||||
|
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
If you have VirtualBox running, you must shut it down before running the
|
1. Go to the [boot2docker/osx-installer ](
|
||||||
installer.
|
https://github.com/boot2docker/osx-installer/releases/latest) release page.
|
||||||
|
|
||||||
1. Go to the [Docker Toolbox](https://www.docker.com/toolbox) page.
|
4. Download Boot2Docker by clicking `Boot2Docker-x.x.x.pkg` in the "Downloads"
|
||||||
|
section.
|
||||||
|
|
||||||
2. Click the installer link to download.
|
3. Install Boot2Docker by double-clicking the package.
|
||||||
|
|
||||||
3. Install Docker Toolbox by double-clicking the package or by right-clicking
|
The installer places Boot2Docker and VirtualBox in your "Applications" folder.
|
||||||
and choosing "Open" from the pop-up menu.
|
|
||||||
|
|
||||||
The installer launches the "Install Docker Toolbox" dialog.
|
The installation places the `docker` and `boot2docker` binaries in your
|
||||||
|
`/usr/local/bin` directory.
|
||||||

|
|
||||||
|
|
||||||
4. Press "Continue" to install the toolbox.
|
|
||||||
|
|
||||||
The installer presents you with options to customize the standard
|
|
||||||
installation.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
By default, the standard Docker Toolbox installation:
|
|
||||||
|
|
||||||
* installs binaries for the Docker tools in `/usr/local/bin`
|
|
||||||
* makes these binaries available to all users
|
|
||||||
* updates any existing VirtualBox installation
|
|
||||||
|
|
||||||
Change these defaults by pressing "Customize" or "Change
|
|
||||||
Install Location."
|
|
||||||
|
|
||||||
5. Press "Install" to perform the standard installation.
|
|
||||||
|
|
||||||
The system prompts you for your password.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
6. Provide your password to continue with the installation.
|
|
||||||
|
|
||||||
When it completes, the installer provides you with some information you can
|
|
||||||
use to complete some common tasks.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
7. Press "Close" to exit.
|
|
||||||
|
|
||||||
|
|
||||||
## Running a Docker Container
|
## Start the Boot2Docker Application
|
||||||
|
|
||||||
To run a Docker container, you:
|
To run a Docker container, you first start the `boot2docker` VM and then issue
|
||||||
|
`docker` commands to create, load, and manage containers. You can launch
|
||||||
|
`boot2docker` from your Applications folder or from the command line.
|
||||||
|
|
||||||
* create a new (or start an existing) Docker virtual machine
|
> **NOTE**: Boot2Docker is designed as a development tool. You should not use
|
||||||
* switch your environment to your new VM
|
> it in production environments.
|
||||||
* use the `docker` client to create, load, and manage containers
|
|
||||||
|
|
||||||
Once you create a machine, you can reuse it as often as you like. Like any
|
### From the Applications folder
|
||||||
VirtualBox VM, it maintains its configuration between uses.
|
|
||||||
|
|
||||||
There are two ways to use the installed tools, from the Docker Quickstart Terminal or
|
When you launch the "Boot2Docker" application from your "Applications" folder, the
|
||||||
[from your shell](#from-your-shell).
|
application:
|
||||||
|
|
||||||
### From the Docker Quickstart Terminal
|
* opens a terminal window
|
||||||
|
|
||||||
1. Open the "Applications" folder or the "Launchpad".
|
* creates a $HOME/.boot2docker directory
|
||||||
|
|
||||||
2. Find the Docker Quickstart Terminal and double-click to launch it.
|
* creates a VirtualBox ISO and certs
|
||||||
|
|
||||||
The application:
|
* starts a VirtualBox VM running the `docker` daemon
|
||||||
|
|
||||||
* opens a terminal window
|
Once the launch completes, you can run `docker` commands. A good way to verify
|
||||||
* creates a VM called `default` if it doesn't exists, starts the VM if it does
|
your setup succeeded is to run the `hello-world` container.
|
||||||
* points the terminal environment to this VM
|
|
||||||
|
|
||||||
Once the launch completes, the Docker Quickstart Terminal reports:
|
$ docker run hello-world
|
||||||
|
Unable to find image 'hello-world:latest' locally
|
||||||

|
511136ea3c5a: Pull complete
|
||||||
|
31cbccb51277: Pull complete
|
||||||
Now, you can run `docker` commands.
|
e45a5af57b00: Pull complete
|
||||||
|
hello-world:latest: The image you are pulling has been verified.
|
||||||
|
Important: image verification is a tech preview feature and should not be
|
||||||
|
relied on to provide security.
|
||||||
|
Status: Downloaded newer image for hello-world:latest
|
||||||
|
Hello from Docker.
|
||||||
|
This message shows that your installation appears to be working correctly.
|
||||||
|
|
||||||
3. Verify your setup succeeded by running the `hello-world` container.
|
To generate this message, Docker took the following steps:
|
||||||
|
1. The Docker client contacted the Docker daemon.
|
||||||
|
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
|
||||||
|
(Assuming it was not already locally available.)
|
||||||
|
3. The Docker daemon created a new container from that image which runs the
|
||||||
|
executable that produces the output you are currently reading.
|
||||||
|
4. The Docker daemon streamed that output to the Docker client, which sent it
|
||||||
|
to your terminal.
|
||||||
|
|
||||||
$ docker run hello-world
|
To try something more ambitious, you can run an Ubuntu container with:
|
||||||
Unable to find image 'hello-world:latest' locally
|
$ docker run -it ubuntu bash
|
||||||
511136ea3c5a: Pull complete
|
|
||||||
31cbccb51277: Pull complete
|
|
||||||
e45a5af57b00: Pull complete
|
|
||||||
hello-world:latest: The image you are pulling has been verified.
|
|
||||||
Important: image verification is a tech preview feature and should not be
|
|
||||||
relied on to provide security.
|
|
||||||
Status: Downloaded newer image for hello-world:latest
|
|
||||||
Hello from Docker.
|
|
||||||
This message shows that your installation appears to be working correctly.
|
|
||||||
|
|
||||||
To generate this message, Docker took the following steps:
|
For more examples and ideas, visit:
|
||||||
1. The Docker client contacted the Docker daemon.
|
http://docs.docker.com/userguide/
|
||||||
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
|
|
||||||
(Assuming it was not already locally available.)
|
|
||||||
3. The Docker daemon created a new container from that image which runs the
|
|
||||||
executable that produces the output you are currently reading.
|
|
||||||
4. The Docker daemon streamed that output to the Docker client, which sent it
|
|
||||||
to your terminal.
|
|
||||||
|
|
||||||
To try something more ambitious, you can run an Ubuntu container with:
|
|
||||||
$ docker run -it ubuntu bash
|
|
||||||
|
|
||||||
For more examples and ideas, visit:
|
|
||||||
http://docs.docker.com/userguide/
|
|
||||||
|
|
||||||
|
|
||||||
A more typical way to interact with the Docker tools is from your regular shell command line.
|
A more typical way to start and stop `boot2docker` is using the command line.
|
||||||
|
|
||||||
### From your shell
|
### From your command line
|
||||||
|
|
||||||
This section assumes you are running a Bash shell. You may be running a
|
Initialize and run `boot2docker` from the command line, do the following:
|
||||||
different shell such as C Shell but the commands are the same.
|
|
||||||
|
|
||||||
1. Create a new Docker VM.
|
1. Create a new Boot2Docker VM.
|
||||||
|
|
||||||
$ docker-machine create --driver virtualbox default
|
$ boot2docker init
|
||||||
Creating VirtualBox VM...
|
|
||||||
Creating SSH key...
|
|
||||||
Starting VirtualBox VM...
|
|
||||||
Starting VM...
|
|
||||||
To see how to connect Docker to this machine, run: docker-machine env default
|
|
||||||
|
|
||||||
This creates a new `default` in VirtualBox.
|
This creates a new virtual machine. You only need to run this command once.
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The command also creates a machine configuration in the
|
2. Start the `boot2docker` VM.
|
||||||
`~/.docker/machine/machines/default` directory. You only need to run the
|
|
||||||
`create` command once. Then, you can use `docker-machine` to start, stop,
|
|
||||||
query, and otherwise manage the VM from the command line.
|
|
||||||
|
|
||||||
2. List your available machines.
|
|
||||||
|
|
||||||
$ docker-machine ls
|
$ boot2docker start
|
||||||
NAME ACTIVE DRIVER STATE URL SWARM
|
|
||||||
default * virtualbox Running tcp://192.168.99.101:2376
|
|
||||||
|
|
||||||
If you have previously installed the deprecated Boot2Docker application or
|
|
||||||
run the Docker Quickstart Terminal, you may have a `dev` VM as well. When you
|
|
||||||
created `default`, the `docker-machine` command provided instructions
|
|
||||||
for learning how to connect the VM.
|
|
||||||
|
|
||||||
3. Get the environment commands for your new VM.
|
3. Display the environment variables for the Docker client.
|
||||||
|
|
||||||
$ docker-machine env default
|
$ boot2docker shellinit
|
||||||
export DOCKER_TLS_VERIFY="1"
|
Writing /Users/mary/.boot2docker/certs/boot2docker-vm/ca.pem
|
||||||
export DOCKER_HOST="tcp://192.168.99.101:2376"
|
Writing /Users/mary/.boot2docker/certs/boot2docker-vm/cert.pem
|
||||||
export DOCKER_CERT_PATH="/Users/mary/.docker/machine/machines/default"
|
Writing /Users/mary/.boot2docker/certs/boot2docker-vm/key.pem
|
||||||
export DOCKER_MACHINE_NAME="default"
|
export DOCKER_HOST=tcp://192.168.59.103:2376
|
||||||
# Run this command to configure your shell:
|
export DOCKER_CERT_PATH=/Users/mary/.boot2docker/certs/boot2docker-vm
|
||||||
# eval "$(docker-machine env default)"
|
export DOCKER_TLS_VERIFY=1
|
||||||
|
|
||||||
4. Connect your shell to the `default` machine.
|
|
||||||
|
|
||||||
$ eval "$(docker-machine env default)"
|
The specific paths and address on your machine will be different.
|
||||||
|
|
||||||
|
4. To set the environment variables in your shell do the following:
|
||||||
|
|
||||||
|
$ eval "$(boot2docker shellinit)"
|
||||||
|
|
||||||
|
You can also set them manually by using the `export` commands `boot2docker`
|
||||||
|
returns.
|
||||||
|
|
||||||
5. Run the `hello-world` container to verify your setup.
|
5. Run the `hello-world` container to verify your setup.
|
||||||
|
|
||||||
$ docker run hello-world
|
$ docker run hello-world
|
||||||
|
|
||||||
|
|
||||||
## Learn about your Toolbox installation
|
## Basic Boot2Docker exercises
|
||||||
|
|
||||||
Toolbox installs the Docker Engine binary, the Docker binary on your system. When you
|
At this point, you should have `boot2docker` running and the `docker` client
|
||||||
use the Docker Quickstart Terminal or create a `default` manually, Docker
|
environment initialized. To verify this, run the following commands:
|
||||||
Machine updates the `~/.docker/machine/machines/default` folder to your
|
|
||||||
system. This folder contains the configuration for the VM.
|
|
||||||
|
|
||||||
You can create multiple VMs on your system with Docker Machine. So, you may have
|
$ boot2docker status
|
||||||
more than one VM folder if you have more than one VM. To remove a VM, use the
|
$ docker version
|
||||||
`docker-machine rm <machine-name>` command.
|
|
||||||
|
|
||||||
## Migrate from Boot2Docker
|
Work through this section to try some practical container tasks using `boot2docker` VM.
|
||||||
|
|
||||||
If you were using Boot2Docker previously, you have a pre-existing Docker
|
|
||||||
`boot2docker-vm` VM on your local system. To allow Docker Machine to manage
|
|
||||||
this older VM, you can migrate it.
|
|
||||||
|
|
||||||
1. Open a terminal or the Docker CLI on your system.
|
|
||||||
|
|
||||||
2. Type the following command.
|
|
||||||
|
|
||||||
$ docker-machine create -d virtualbox --virtualbox-import-boot2docker-vm boot2docker-vm docker-vm
|
|
||||||
|
|
||||||
3. Use the `docker-machine` command to interact with the migrated VM.
|
|
||||||
|
|
||||||
The `docker-machine` subcommands are slightly different than the `boot2docker`
|
|
||||||
subcommands. The table below lists the equivalent `docker-machine` subcommand
|
|
||||||
and what it does:
|
|
||||||
|
|
||||||
| `boot2docker` | `docker-machine` | `docker-machine` description |
|
|
||||||
|----------------|------------------|----------------------------------------------------------|
|
|
||||||
| init | create | Creates a new docker host. |
|
|
||||||
| up | start | Starts a stopped machine. |
|
|
||||||
| ssh | ssh | Runs a command or interactive ssh session on the machine.|
|
|
||||||
| save | - | Not applicable. |
|
|
||||||
| down | stop | Stops a running machine. |
|
|
||||||
| poweroff | stop | Stops a running machine. |
|
|
||||||
| reset | restart | Restarts a running machine. |
|
|
||||||
| config | inspect | Prints machine configuration details. |
|
|
||||||
| status | ls | Lists all machines and their status. |
|
|
||||||
| info | inspect | Displays a machine's details. |
|
|
||||||
| ip | ip | Displays the machine's ip address. |
|
|
||||||
| shellinit | env | Displays shell commands needed to configure your shell to interact with a machine |
|
|
||||||
| delete | rm | Removes a machine. |
|
|
||||||
| download | - | Not applicable. |
|
|
||||||
| upgrade | upgrade | Upgrades a machine's Docker client to the latest stable release. |
|
|
||||||
|
|
||||||
|
|
||||||
## Example of Docker on Mac OS X
|
|
||||||
|
|
||||||
Work through this section to try some practical container tasks on a VM. At this
|
|
||||||
point, you should have a VM running and be connected to it through your shell.
|
|
||||||
To verify this, run the following commands:
|
|
||||||
|
|
||||||
$ docker-machine ls
|
|
||||||
NAME ACTIVE DRIVER STATE URL SWARM
|
|
||||||
default * virtualbox Running tcp://192.168.99.100:2376
|
|
||||||
|
|
||||||
The `ACTIVE` machine, in this case `default`, is the one your environment is pointing to.
|
|
||||||
|
|
||||||
### Access container ports
|
### Access container ports
|
||||||
|
|
||||||
@@ -317,11 +212,11 @@ The `ACTIVE` machine, in this case `default`, is the one your environment is poi
|
|||||||
|
|
||||||
This didn't work. The reason it doesn't work is your `DOCKER_HOST` address is
|
This didn't work. The reason it doesn't work is your `DOCKER_HOST` address is
|
||||||
not the localhost address (0.0.0.0) but is instead the address of the
|
not the localhost address (0.0.0.0) but is instead the address of the
|
||||||
your Docker VM.
|
`boot2docker` VM.
|
||||||
|
|
||||||
5. Get the address of the `default` VM.
|
5. Get the address of the `boot2docker` VM.
|
||||||
|
|
||||||
$ docker-machine ip default
|
$ boot2docker ip
|
||||||
192.168.59.103
|
192.168.59.103
|
||||||
|
|
||||||
6. Enter the `http://192.168.59.103:49157` address in your browser:
|
6. Enter the `http://192.168.59.103:49157` address in your browser:
|
||||||
@@ -337,7 +232,7 @@ The `ACTIVE` machine, in this case `default`, is the one your environment is poi
|
|||||||
|
|
||||||
### Mount a volume on the container
|
### Mount a volume on the container
|
||||||
|
|
||||||
When you start a container it automatically shares your `/Users/username` directory
|
When you start `boot2docker`, it automatically shares your `/Users` directory
|
||||||
with the VM. You can use this share point to mount directories onto your container.
|
with the VM. You can use this share point to mount directories onto your container.
|
||||||
The next exercise demonstrates how to do this.
|
The next exercise demonstrates how to do this.
|
||||||
|
|
||||||
@@ -359,8 +254,7 @@ The next exercise demonstrates how to do this.
|
|||||||
|
|
||||||
5. Start a new `nginx` container and replace the `html` folder with your `site` directory.
|
5. Start a new `nginx` container and replace the `html` folder with your `site` directory.
|
||||||
|
|
||||||
$ docker run -d -P -v $HOME/site:/usr/share/nginx/html \
|
$ docker run -d -P -v $HOME/site:/usr/share/nginx/html --name mysite nginx
|
||||||
--name mysite nginx
|
|
||||||
|
|
||||||
6. Get the `mysite` container's port.
|
6. Get the `mysite` container's port.
|
||||||
|
|
||||||
@@ -380,53 +274,85 @@ The next exercise demonstrates how to do this.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
10. Stop and then remove your running `mysite` container.
|
9. Stop and then remove your running `mysite` container.
|
||||||
|
|
||||||
$ docker stop mysite
|
$ docker stop mysite
|
||||||
$ docker rm mysite
|
$ docker rm mysite
|
||||||
|
|
||||||
|
## Upgrade Boot2Docker
|
||||||
|
|
||||||
## Upgrade Docker Toolbox
|
If you running Boot2Docker 1.4.1 or greater, you can upgrade Boot2Docker from
|
||||||
|
the command line. If you are running an older version, you should use the
|
||||||
|
package provided by the `boot2docker` repository.
|
||||||
|
|
||||||
To upgrade Docker Toolbox, download an re-run [the Docker Toolbox
|
### From the command line
|
||||||
installer](https://docker.com/toolbox/).
|
|
||||||
|
To upgrade from 1.4.1 or greater, you can do this:
|
||||||
|
|
||||||
|
1. Open a terminal on your local machine.
|
||||||
|
|
||||||
|
2. Stop the `boot2docker` application.
|
||||||
|
|
||||||
|
$ boot2docker stop
|
||||||
|
|
||||||
|
3. Run the upgrade command.
|
||||||
|
|
||||||
|
$ boot2docker upgrade
|
||||||
|
|
||||||
|
|
||||||
## Uninstall Docker Toolbox
|
### Use the installer
|
||||||
|
|
||||||
To uninstall, do the following:
|
To upgrade any version of Boot2Docker, do this:
|
||||||
|
|
||||||
1. List your machines.
|
1. Open a terminal on your local machine.
|
||||||
|
|
||||||
$ docker-machine ls
|
2. Stop the `boot2docker` application.
|
||||||
NAME ACTIVE DRIVER STATE URL SWARM
|
|
||||||
dev * virtualbox Running tcp://192.168.99.100:2376
|
|
||||||
my-docker-machine virtualbox Stopped
|
|
||||||
default virtualbox Stopped
|
|
||||||
|
|
||||||
2. Remove each machine.
|
$ boot2docker stop
|
||||||
|
|
||||||
$ docker-machine rm dev
|
3. Go to the [boot2docker/osx-installer ](
|
||||||
Successfully removed dev
|
https://github.com/boot2docker/osx-installer/releases/latest) release page.
|
||||||
|
|
||||||
Removing a machine deletes its VM from VirtualBox and from the
|
|
||||||
`~/.docker/machine/machines` directory.
|
|
||||||
|
|
||||||
3. Remove the Docker Quickstart Terminal and Kitematic from your "Applications" folder.
|
4. Download Boot2Docker by clicking `Boot2Docker-x.x.x.pkg` in the "Downloads"
|
||||||
|
section.
|
||||||
|
|
||||||
4. Remove the `docker`, `docker-compose`, and `docker-machine` commands from the `/usr/local/bin` folder.
|
2. Install Boot2Docker by double-clicking the package.
|
||||||
|
|
||||||
$ rm /usr/local/bin/docker
|
The installer places Boot2Docker in your "Applications" folder.
|
||||||
|
|
||||||
5. Delete the `~/.docker` folder from your system.
|
|
||||||
|
|
||||||
|
|
||||||
## Learning more
|
## Uninstallation
|
||||||
|
|
||||||
Use `docker-machine help` to list the full command line reference for Docker Machine. For more
|
1. Go to the [boot2docker/osx-installer ](
|
||||||
information about using SSH or SCP to access a VM, see [the Docker Machine
|
https://github.com/boot2docker/osx-installer/releases/latest) release page.
|
||||||
documentation](https://docs.docker.com/machine/).
|
|
||||||
|
|
||||||
You can continue with the [Docker User Guide](/userguide). If you are
|
2. Download the source code by clicking `Source code (zip)` or
|
||||||
interested in using the Kitematic GUI, see the [Kitermatic user
|
`Source code (tar.gz)` in the "Downloads" section.
|
||||||
guide](/kitematic/userguide/).
|
|
||||||
|
3. Extract the source code.
|
||||||
|
|
||||||
|
4. Open a terminal on your local machine.
|
||||||
|
|
||||||
|
5. Change to the directory where you extracted the source code:
|
||||||
|
|
||||||
|
$ cd <path to extracted source code>
|
||||||
|
|
||||||
|
6. Make sure the uninstall.sh script is executable:
|
||||||
|
|
||||||
|
$ chmod +x uninstall.sh
|
||||||
|
|
||||||
|
7. Run the uninstall.sh script:
|
||||||
|
|
||||||
|
$ ./uninstall.sh
|
||||||
|
|
||||||
|
|
||||||
|
## Learning more and acknowledgement
|
||||||
|
|
||||||
|
Use `boot2docker help` to list the full command line reference. For more
|
||||||
|
information about using SSH or SCP to access the Boot2Docker VM, see the README
|
||||||
|
at [Boot2Docker repository](https://github.com/boot2docker/boot2docker).
|
||||||
|
|
||||||
|
Thanks to Chris Jones whose [blog](http://viget.com/extend/how-to-use-docker-on-os-x-the-missing-guide)
|
||||||
|
inspired me to redo this page.
|
||||||
|
|
||||||
|
Continue with the [Docker User Guide](/userguide).
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ To upgrade your kernel and install the additional packages, do the following:
|
|||||||
|
|
||||||
$ sudo reboot
|
$ sudo reboot
|
||||||
|
|
||||||
5. After your system reboots, go ahead and [install Docker](#installation).
|
5. After your system reboots, go ahead and [install Docker](#installing-docker-on-ubuntu).
|
||||||
|
|
||||||
|
|
||||||
### For Saucy 13.10 (64 bit)
|
### For Saucy 13.10 (64 bit)
|
||||||
@@ -111,18 +111,18 @@ install Docker using the following:
|
|||||||
|
|
||||||
1. Log into your Ubuntu installation as a user with `sudo` privileges.
|
1. Log into your Ubuntu installation as a user with `sudo` privileges.
|
||||||
|
|
||||||
2. Verify that you have `curl` installed.
|
2. Verify that you have `wget` installed.
|
||||||
|
|
||||||
$ which curl
|
$ which wget
|
||||||
|
|
||||||
If `curl` isn't installed, install it after updating your manager:
|
If `wget` isn't installed, install it after updating your manager:
|
||||||
|
|
||||||
$ sudo apt-get update
|
$ sudo apt-get update
|
||||||
$ sudo apt-get install curl
|
$ sudo apt-get install wget
|
||||||
|
|
||||||
3. Get the latest Docker package.
|
3. Get the latest Docker package.
|
||||||
|
|
||||||
$ curl -sSL https://get.docker.com/ | sh
|
$ wget -qO- https://get.docker.com/ | sh
|
||||||
|
|
||||||
The system prompts you for your `sudo` password. Then, it downloads and
|
The system prompts you for your `sudo` password. Then, it downloads and
|
||||||
installs Docker and its dependencies.
|
installs Docker and its dependencies.
|
||||||
@@ -132,7 +132,7 @@ install Docker using the following:
|
|||||||
>command fails for the Docker repo during installation. To work around this,
|
>command fails for the Docker repo during installation. To work around this,
|
||||||
>add the key directly using the following:
|
>add the key directly using the following:
|
||||||
>
|
>
|
||||||
> $ curl -sSL https://get.docker.com/gpg | sudo apt-key add -
|
> $ wget -qO- https://get.docker.com/gpg | sudo apt-key add -
|
||||||
|
|
||||||
4. Verify `docker` is installed correctly.
|
4. Verify `docker` is installed correctly.
|
||||||
|
|
||||||
@@ -197,14 +197,9 @@ When users run Docker, they may see these messages when working with an image:
|
|||||||
WARNING: Your kernel does not support cgroup swap limit. WARNING: Your
|
WARNING: Your kernel does not support cgroup swap limit. WARNING: Your
|
||||||
kernel does not support swap limit capabilities. Limitation discarded.
|
kernel does not support swap limit capabilities. Limitation discarded.
|
||||||
|
|
||||||
To prevent these messages, enable memory and swap accounting on your
|
To prevent these messages, enable memory and swap accounting on your system. To
|
||||||
system. Enabling memory and swap accounting does induce both a memory
|
enable these on system using GNU GRUB (GNU GRand Unified Bootloader), do the
|
||||||
overhead and a performance degradation even when Docker is not in
|
following.
|
||||||
use. The memory overhead is about 1% of the total available
|
|
||||||
memory. The performance degradation is roughly 10%.
|
|
||||||
|
|
||||||
To enable memory and swap on system using GNU GRUB (GNU GRand Unified
|
|
||||||
Bootloader), do the following:
|
|
||||||
|
|
||||||
1. Log into Ubuntu as a user with `sudo` privileges.
|
1. Log into Ubuntu as a user with `sudo` privileges.
|
||||||
|
|
||||||
@@ -344,9 +339,9 @@ to start the docker daemon on boot
|
|||||||
|
|
||||||
## Upgrade Docker
|
## Upgrade Docker
|
||||||
|
|
||||||
To install the latest version of Docker with `curl`:
|
To install the latest version of Docker with `wget`:
|
||||||
|
|
||||||
$ curl -sSL https://get.docker.com/ | sh
|
$ wget -qO- https://get.docker.com/ | sh
|
||||||
|
|
||||||
## Uninstallation
|
## Uninstallation
|
||||||
|
|
||||||
|
|||||||
@@ -9,357 +9,165 @@ parent = "smn_engine"
|
|||||||
<![end-metadata]-->
|
<![end-metadata]-->
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
|
> **Note:**
|
||||||
|
> Docker has been tested on Windows 7 and 8.1; it may also run on older versions.
|
||||||
|
> Your processor needs to support hardware virtualization.
|
||||||
|
|
||||||
> **Note**: This release of Docker deprecates the Boot2Docker command line in
|
The Docker Engine uses Linux-specific kernel features, so to run it on Windows
|
||||||
> favor of Docker Machine. Use the Docker Toolbox to install Docker Machine as
|
we need to use a lightweight virtual machine (VM). You use the **Windows Docker
|
||||||
> well as the other Docker tools.
|
Client** to control the virtualized Docker Engine to build, run, and manage
|
||||||
|
Docker containers.
|
||||||
|
|
||||||
You install Docker using Docker Toolbox. Docker Toolbox includes the following Docker tools:
|
To make this process easier, we've designed a helper application called
|
||||||
|
[Boot2Docker](https://github.com/boot2docker/boot2docker) which creates a Linux virtual
|
||||||
|
machine on Windows to run Docker on a Linux operating system.
|
||||||
|
|
||||||
* Docker Machine for running the `docker-machine` binary
|
Although you will be using Windows Docker client, the docker engine hosting the
|
||||||
* Docker Engine for running the `docker` binary
|
containers will still be running on Linux. Until the Docker engine for Windows
|
||||||
* Kitematic, the Docker GUI
|
is developed, you can launch only Linux containers from your Windows machine.
|
||||||
* a shell preconfigured for a Docker command-line environment
|
|
||||||
* Oracle VM VirtualBox
|
|
||||||
|
|
||||||
Because the Docker daemon uses Linux-specific kernel features, you can't run
|
|
||||||
Docker natively in Windows. Instead, you must use `docker-machine` to create and attach to a Docker VM on your machine. This VM hosts Docker for you on your Windows system.
|
|
||||||
|
|
||||||
The Docker VM is lightweight Linux virtual machine made specifically to run the
|
|
||||||
Docker daemon on Windows. The VirtualBox VM runs completely from RAM, is a
|
|
||||||
small ~24MB download, and boots in approximately 5s.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
Your machine must be running Windows 7.1, 8/8.1 or newer to run Docker. Windows 10 is not currently supported. To find out what version of Windows you have:
|
|
||||||
|
|
||||||
1. Right click the Windows message and choose **System**.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
If you aren't using a supported version, you could consider upgrading your
|
|
||||||
operating system.
|
|
||||||
|
|
||||||
2. Make sure your Windows system supports Hardware Virtualization Technology and that virtualization is enabled.
|
|
||||||
|
|
||||||
#### For Windows 8 or 8.1
|
|
||||||
|
|
||||||
Choose **Start > Task Manager** and navigate to the **Performance** tab.
|
|
||||||
Under **CPU** you should see the following:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
If virtualization is not enabled on your system, follow the manufacturer's instructions for enabling it.
|
|
||||||
|
|
||||||
### For Windows 7
|
|
||||||
|
|
||||||
Run the <a
|
|
||||||
href="http://www.microsoft.com/en-us/download/details.aspx?id=592"
|
|
||||||
target="_blank"> Microsoft® Hardware-Assisted Virtualization Detection
|
|
||||||
Tool</a> and follow the on-screen instructions.
|
|
||||||
|
|
||||||
|
|
||||||
> **Note**: If you have Docker hosts running and you don't wish to do a Docker Toolbox
|
|
||||||
installation, you can install the `docker.exe` using the *unofficial* Windows package
|
|
||||||
manager Chocolately. For information on how to do this, see [Docker package on
|
|
||||||
Chocolatey](http://chocolatey.org/packages/docker).
|
|
||||||
|
|
||||||
### Learn the key concepts before installing
|
|
||||||
|
|
||||||
In a Docker installation on Linux, your machine is both the localhost and the
|
|
||||||
Docker host. In networking, localhost means your computer. The Docker host is
|
|
||||||
the machine on which the containers run.
|
|
||||||
|
|
||||||
On a typical Linux installation, the Docker client, the Docker daemon, and any
|
|
||||||
containers run directly on your localhost. This means you can address ports on a
|
|
||||||
Docker container using standard localhost addressing such as `localhost:8000` or
|
|
||||||
`0.0.0.0:8376`.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
In an Windows installation, the `docker` daemon is running inside a Linux virtual
|
|
||||||
machine. You use the Windows Docker client to talk to the Docker host VM. Your
|
|
||||||
Docker containers run inside this host.
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
In Windows, the Docker host address is the address of the Linux VM. When you
|
## Demonstration
|
||||||
start the VM with `docker-machine` it is assigned an IP address. When you start
|
|
||||||
a container, the ports on a container map to ports on the VM. To see this in
|
|
||||||
practice, work through the exercises on this page.
|
|
||||||
|
|
||||||
|
<iframe width="640" height="480" src="//www.youtube.com/embed/TjMU3bDX4vo?rel=0" frameborder="0" allowfullscreen></iframe>
|
||||||
|
|
||||||
### Installation
|
## Installation
|
||||||
|
|
||||||
If you have VirtualBox running, you must shut it down before running the
|
1. Download the latest release of the
|
||||||
installer.
|
[Docker for Windows Installer](https://github.com/boot2docker/windows-installer/releases/latest).
|
||||||
|
2. Run the installer, which will install Docker Client for Windows, VirtualBox,
|
||||||
|
Git for Windows (MSYS-git), the boot2docker Linux ISO, and the Boot2Docker
|
||||||
|
management tool.
|
||||||
|

|
||||||
|
3. Run the **Boot2Docker Start** shortcut from your Desktop or “Program Files →
|
||||||
|
Boot2Docker for Windows”.
|
||||||
|
The Start script will ask you to enter an ssh key passphrase - the simplest
|
||||||
|
(but least secure) is to just hit [Enter].
|
||||||
|
|
||||||
1. Go to the [Docker Toolbox](https://www.docker.com/toolbox) page.
|
4. The **Boot2Docker Start** will start a unix shell already configured to manage
|
||||||
|
Docker running inside the virtual machine. Run `docker version` to see
|
||||||
|
if it is working correctly:
|
||||||
|
|
||||||
2. Click the installer link to download.
|

|
||||||
|
|
||||||
3. Install Docker Toolbox by double-clicking the installer.
|
## Running Docker
|
||||||
|
|
||||||
The installer launches the "Setup - Docker Toolbox" dialog.
|
> **Note:** if you are using a remote Docker daemon, such as Boot2Docker,
|
||||||
|
> then _do not_ type the `sudo` before the `docker` commands shown in the
|
||||||

|
> documentation's examples.
|
||||||
|
|
||||||
4. Press "Next" to install the toolbox.
|
**Boot2Docker Start** will automatically start a shell with environment variables
|
||||||
|
correctly set so you can start using Docker right away:
|
||||||
|
|
||||||
The installer presents you with options to customize the standard
|
Let's try the `hello-world` example image. Run
|
||||||
installation. By default, the standard Docker Toolbox installation:
|
|
||||||
|
|
||||||
* installs executables for the Docker tools in `C:\Program Files\Docker Toolbox`
|
|
||||||
* updates any existing VirtualBox installation
|
|
||||||
* adds a Docker Inc. folder to your program shortcuts
|
|
||||||
* updates your `PATH` environment variable
|
|
||||||
* adds desktop icons for the Docker Quickstart Terminal and Kitematic
|
|
||||||
|
|
||||||
This installation assumes the defaults are acceptable.
|
$ docker run hello-world
|
||||||
|
|
||||||
5. Press "Next" until you reach the "Ready to Install" page.
|
|
||||||
|
|
||||||
The system prompts you for your password.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
6. Press "Install" to continue with the installation.
|
|
||||||
|
|
||||||
When it completes, the installer provides you with some information you can
|
|
||||||
use to complete some common tasks.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
7. Press "Close" to exit.
|
|
||||||
|
|
||||||
## Running a Docker Container
|
|
||||||
|
|
||||||
To run a Docker container, you:
|
|
||||||
|
|
||||||
* create a new (or start an existing) Docker virtual machine
|
|
||||||
* switch your environment to your new VM
|
|
||||||
* use the `docker` client to create, load, and manage containers
|
|
||||||
|
|
||||||
Once you create a machine, you can reuse it as often as you like. Like any
|
|
||||||
VirtualBox VM, it maintains its configuration between uses.
|
|
||||||
|
|
||||||
There are several ways to use the installed tools, from the Docker Quickstart Terminal or
|
|
||||||
[from your shell](#from-your-shell).
|
|
||||||
|
|
||||||
### From the Docker Quickstart Terminal
|
|
||||||
|
|
||||||
1. Find the Docker Quickstart Terminal icon on your Desktop and double-click to launch it.
|
|
||||||
|
|
||||||
The application:
|
|
||||||
|
|
||||||
* opens a terminal window
|
|
||||||
* creates a `default` if it doesn't exist, starts the VM if it does
|
|
||||||
* points the terminal environment to this VM
|
|
||||||
|
|
||||||
Once the launch completes, you can run `docker` commands.
|
|
||||||
|
|
||||||
3. Verify your setup succeeded by running the `hello-world` container.
|
|
||||||
|
|
||||||
$ docker run hello-world
|
|
||||||
Unable to find image 'hello-world:latest' locally
|
|
||||||
511136ea3c5a: Pull complete
|
|
||||||
31cbccb51277: Pull complete
|
|
||||||
e45a5af57b00: Pull complete
|
|
||||||
hello-world:latest: The image you are pulling has been verified.
|
|
||||||
Important: image verification is a tech preview feature and should not be
|
|
||||||
relied on to provide security.
|
|
||||||
Status: Downloaded newer image for hello-world:latest
|
|
||||||
Hello from Docker.
|
|
||||||
This message shows that your installation appears to be working correctly.
|
|
||||||
|
|
||||||
To generate this message, Docker took the following steps:
|
|
||||||
1. The Docker client contacted the Docker daemon.
|
|
||||||
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
|
|
||||||
(Assuming it was not already locally available.)
|
|
||||||
3. The Docker daemon created a new container from that image which runs the
|
|
||||||
executable that produces the output you are currently reading.
|
|
||||||
4. The Docker daemon streamed that output to the Docker client, which sent it
|
|
||||||
to your terminal.
|
|
||||||
|
|
||||||
To try something more ambitious, you can run an Ubuntu container with:
|
|
||||||
$ docker run -it ubuntu bash
|
|
||||||
|
|
||||||
For more examples and ideas, visit:
|
|
||||||
http://docs.docker.com/userguide/
|
|
||||||
|
|
||||||
|
This should download the very small `hello-world` image and print a
|
||||||
|
`Hello from Docker.` message.
|
||||||
|
|
||||||
## Using Docker from Windows Command Line Prompt (cmd.exe)
|
## Using Docker from Windows Command Line Prompt (cmd.exe)
|
||||||
|
|
||||||
1. Launch a Windows Command Line Prompt (cmd.exe).
|
Launch a Windows Command Line Prompt (cmd.exe).
|
||||||
|
|
||||||
The `docker-machine` command requires `ssh.exe` in your `PATH` environment
|
Boot2Docker command requires `ssh.exe` to be in the PATH, therefore we need to
|
||||||
variable. This `.exe` is in the MsysGit `bin` folder.
|
include `bin` folder of the Git installation (which has ssh.exe) to the `%PATH%`
|
||||||
|
environment variable by running:
|
||||||
|
|
||||||
2. Add this to the `%PATH%` environment variable by running:
|
set PATH=%PATH%;"c:\Program Files (x86)\Git\bin"
|
||||||
|
|
||||||
set PATH=%PATH%;"c:\Program Files (x86)\Git\bin"
|
and then we can run the `boot2docker start` command to start the Boot2Docker VM.
|
||||||
|
(Run `boot2docker init` command if you get an error saying machine does not
|
||||||
3. Create a new Docker VM.
|
exist.) Then copy the instructions for cmd.exe to set the environment variables
|
||||||
|
to your console window and you are ready to run docker commands such as
|
||||||
|
`docker ps`:
|
||||||
|
|
||||||
docker-machine create --driver virtualbox my-default
|

|
||||||
Creating VirtualBox VM...
|
|
||||||
Creating SSH key...
|
|
||||||
Starting VirtualBox VM...
|
|
||||||
Starting VM...
|
|
||||||
To see how to connect Docker to this machine, run: docker-machine env my-default
|
|
||||||
|
|
||||||
The command also creates a machine configuration in the
|
|
||||||
`C:\USERS\USERNAME\.docker\machine\machines` directory. You only need to run the `create`
|
|
||||||
command once. Then, you can use `docker-machine` to start, stop, query, and
|
|
||||||
otherwise manage the VM from the command line.
|
|
||||||
|
|
||||||
4. List your available machines.
|
|
||||||
|
|
||||||
C:\Users\mary> docker-machine ls
|
|
||||||
NAME ACTIVE DRIVER STATE URL SWARM
|
|
||||||
my-default * virtualbox Running tcp://192.168.99.101:2376
|
|
||||||
|
|
||||||
If you have previously installed the deprecated Boot2Docker application or
|
|
||||||
run the Docker Quickstart Terminal, you may have a `dev` VM as well.
|
|
||||||
|
|
||||||
5. Get the environment commands for your new VM.
|
|
||||||
|
|
||||||
C:\Users\mary> docker-machine env --shell cmd my-default
|
|
||||||
|
|
||||||
6. Connect your shell to the `my-default` machine.
|
|
||||||
|
|
||||||
C:\Users\mary> eval "$(docker-machine env my-default)"
|
|
||||||
|
|
||||||
7. Run the `hello-world` container to verify your setup.
|
|
||||||
|
|
||||||
C:\Users\mary> docker run hello-world
|
|
||||||
|
|
||||||
## Using Docker from PowerShell
|
## Using Docker from PowerShell
|
||||||
|
|
||||||
1. Launch a Windows PowerShell window.
|
Launch a PowerShell window, then add `ssh.exe` to your PATH:
|
||||||
|
|
||||||
2. Add `ssh.exe` to your PATH:
|
$Env:Path = "${Env:Path};c:\Program Files (x86)\Git\bin"
|
||||||
|
|
||||||
PS C:\Users\mary> $Env:Path = "${Env:Path};c:\Program Files (x86)\Git\bin"
|
and after running the `boot2docker start` command it will print PowerShell
|
||||||
|
commands to set the environment variables to connect to the Docker daemon
|
||||||
3. Create a new Docker VM.
|
running inside the VM. Run these commands and you are ready to run docker
|
||||||
|
commands such as `docker ps`:
|
||||||
|
|
||||||
PS C:\Users\mary> docker-machine create --driver virtualbox my-default
|

|
||||||
|
|
||||||
4. List your available machines.
|
|
||||||
|
|
||||||
C:\Users\mary> docker-machine ls
|
> NOTE: You can alternatively run `boot2docker shellinit | Invoke-Expression`
|
||||||
NAME ACTIVE DRIVER STATE URL SWARM
|
> command to set the environment variables instead of copying and pasting on
|
||||||
my-default * virtualbox Running tcp://192.168.99.101:2376
|
> PowerShell.
|
||||||
|
|
||||||
5. Get the environment commands for your new VM.
|
|
||||||
|
|
||||||
C:\Users\mary> docker-machine env --shell powershell my-default
|
# Further Details
|
||||||
|
|
||||||
6. Connect your shell to the `my-default` machine.
|
|
||||||
|
|
||||||
C:\Users\mary> eval "$(docker-machine env my-default)"
|
The Boot2Docker management tool provides several commands:
|
||||||
|
|
||||||
7. Run the `hello-world` container to verify your setup.
|
$ boot2docker
|
||||||
|
Usage: boot2docker.exe [<options>] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|shellinit|delete|download|upgrade|version} [<args>]
|
||||||
|
|
||||||
C:\Users\mary> docker run hello-world
|
## Upgrading
|
||||||
|
|
||||||
|
1. Download the latest release of the [Docker for Windows Installer](
|
||||||
|
https://github.com/boot2docker/windows-installer/releases/latest)
|
||||||
|
|
||||||
## Learn about your Toolbox installation
|
2. Run the installer, which will update the Boot2Docker management tool.
|
||||||
|
|
||||||
Toolbox installs the Docker Engine binary in the `C:\Program Files\Docker
|
3. To upgrade your existing virtual machine, open a terminal and run:
|
||||||
Toolbox` directory. When you use the Docker Quickstart Terminal or create a
|
|
||||||
`default` manually, Docker Machine updates the
|
|
||||||
`C:\USERS\USERNAME\.docker\machine\machines\default` folder to your
|
|
||||||
system. This folder contains the configuration for the VM.
|
|
||||||
|
|
||||||
You can create multiple VMs on your system with Docker Machine. So, you may have
|
boot2docker stop
|
||||||
more than one VM folder if you have more than one VM. To remove a VM, use the
|
boot2docker download
|
||||||
`docker-machine rm <machine-name>` command.
|
boot2docker start
|
||||||
|
|
||||||
## Migrate from Boot2Docker
|
|
||||||
|
|
||||||
If you were using Boot2Docker previously, you have a pre-existing Docker
|
|
||||||
`boot2docker-vm` VM on your local system. To allow Docker Machine to manage
|
|
||||||
this older VM, you can migrate it.
|
|
||||||
|
|
||||||
1. Open a terminal or the Docker CLI on your system.
|
|
||||||
|
|
||||||
2. Type the following command.
|
|
||||||
|
|
||||||
$ docker-machine create -d virtualbox --virtualbox-import-boot2docker-vm boot2docker-vm docker-vm
|
|
||||||
|
|
||||||
3. Use the `docker-machine` command to interact with the migrated VM.
|
|
||||||
|
|
||||||
The `docker-machine` subcommands are slightly different than the `boot2docker`
|
|
||||||
subcommands. The table below lists the equivalent `docker-machine` subcommand
|
|
||||||
and what it does:
|
|
||||||
|
|
||||||
| `boot2docker` | `docker-machine` | `docker-machine` description |
|
|
||||||
|----------------|------------------|----------------------------------------------------------|
|
|
||||||
| init | create | Creates a new docker host. |
|
|
||||||
| up | start | Starts a stopped machine. |
|
|
||||||
| ssh | ssh | Runs a command or interactive ssh session on the machine.|
|
|
||||||
| save | - | Not applicable. |
|
|
||||||
| down | stop | Stops a running machine. |
|
|
||||||
| poweroff | stop | Stops a running machine. |
|
|
||||||
| reset | restart | Restarts a running machine. |
|
|
||||||
| config | inspect | Prints machine configuration details. |
|
|
||||||
| status | ls | Lists all machines and their status. |
|
|
||||||
| info | inspect | Displays a machine's details. |
|
|
||||||
| ip | ip | Displays the machine's ip address. |
|
|
||||||
| shellinit | env | Displays shell commands needed to configure your shell to interact with a machine |
|
|
||||||
| delete | rm | Removes a machine. |
|
|
||||||
| download | - | Not applicable. |
|
|
||||||
| upgrade | upgrade | Upgrades a machine's Docker client to the latest stable release. |
|
|
||||||
|
|
||||||
|
|
||||||
## Upgrade Docker Toolbox
|
|
||||||
|
|
||||||
To upgrade Docker Toolbox, download an re-run [the Docker Toolbox
|
|
||||||
installer](https://www.docker.com/toolbox).
|
|
||||||
|
|
||||||
## Container port redirection
|
## Container port redirection
|
||||||
|
|
||||||
If you are curious, the username for the Docker default user is `docker` and the
|
If you are curious, the username for the boot2docker default user is `docker`
|
||||||
password is `tcuser`. The latest version of `docker-machine` sets up a host only
|
and the password is `tcuser`.
|
||||||
network adaptor which provides access to the container's ports.
|
|
||||||
|
|
||||||
If you run a container with a published port:
|
The latest version of `boot2docker` sets up a host only network adaptor which
|
||||||
|
provides access to the container's ports.
|
||||||
|
|
||||||
$ docker run --rm -i -t -p 80:80 nginx
|
If you run a container with an exposed port:
|
||||||
|
|
||||||
Then you should be able to access that nginx server using the IP address
|
docker run --rm -i -t -p 80:80 nginx
|
||||||
reported to you using:
|
|
||||||
|
|
||||||
$ docker-machine ip
|
Then you should be able to access that nginx server using the IP address reported
|
||||||
|
to you using:
|
||||||
|
|
||||||
Typically, the IP is 192.168.59.103, but it could get changed by VirtualBox's
|
boot2docker ip
|
||||||
DHCP implementation.
|
|
||||||
|
Typically, it is 192.168.59.103, but it could get changed by VirtualBox's DHCP
|
||||||
|
implementation.
|
||||||
|
|
||||||
|
For further information or to report issues, please see the [Boot2Docker site](http://boot2docker.io)
|
||||||
|
|
||||||
## Login with PUTTY instead of using the CMD
|
## Login with PUTTY instead of using the CMD
|
||||||
|
|
||||||
Docker Machine generates and uses the public/private key pair in your
|
Boot2Docker generates and uses the public/private key pair in your `%USERPROFILE%\.ssh`
|
||||||
`%USERPROFILE%\.ssh` directory so to log in you need to use the private key from
|
directory so to log in you need to use the private key from this same directory.
|
||||||
this same directory. The private key needs to be converted into the format PuTTY
|
|
||||||
uses. You can do this with
|
The private key needs to be converted into the format PuTTY uses.
|
||||||
|
|
||||||
|
You can do this with
|
||||||
[puttygen](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html):
|
[puttygen](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html):
|
||||||
|
|
||||||
1. Open `puttygen.exe` and load ("File"->"Load" menu) the private key from
|
- Open `puttygen.exe` and load ("File"->"Load" menu) the private key from
|
||||||
`%USERPROFILE%\.ssh\id_boot2docker`
|
`%USERPROFILE%\.ssh\id_boot2docker`
|
||||||
|
- then click: "Save Private Key".
|
||||||
2. Click "Save Private Key".
|
- Then use the saved file to login with PuTTY using `docker@127.0.0.1:2022`.
|
||||||
|
|
||||||
3. Use the saved file to login with PuTTY using `docker@127.0.0.1:2022`.
|
|
||||||
|
|
||||||
## Uninstallation
|
## Uninstallation
|
||||||
|
|
||||||
You can uninstall Docker Toolbox using Window's standard process for removing
|
You can uninstall Boot2Docker using Window's standard process for removing programs.
|
||||||
programs. This process does not remove the `docker-install.exe` file. You must
|
This process does not remove the `docker-install.exe` file. You must delete that file
|
||||||
delete that file yourself.
|
yourself.
|
||||||
|
|
||||||
## Learn more
|
## References
|
||||||
|
|
||||||
You can continue with the [Docker User Guide](/userguide). If you are
|
If you have Docker hosts running and if you don't wish to do a
|
||||||
interested in using the Kitematic GUI, see the [Kitermatic user
|
Boot2Docker installation, you can install the docker.exe using
|
||||||
guide](/kitematic/userguide/).
|
unofficial Windows package manager Chocolately. For information
|
||||||
|
on how to do this, see [Docker package on Chocolatey](http://chocolatey.org/packages/docker).
|
||||||
|
|||||||
@@ -116,11 +116,11 @@ images, or you can download Docker images that other people have already created
|
|||||||
Docker images are the **build** component of Docker.
|
Docker images are the **build** component of Docker.
|
||||||
|
|
||||||
#### Docker registries
|
#### Docker registries
|
||||||
Docker registries hold images. These are public or private stores from which you
|
Docker registries hold images. These are public or private stores from which you upload
|
||||||
upload or download images. The public Docker registry is provided with the
|
or download images. The public Docker registry is called
|
||||||
[Docker Hub](http://hub.docker.com). It serves a huge collection of existing
|
[Docker Hub](http://hub.docker.com). It provides a huge collection of existing
|
||||||
images for your use. These can be images you create yourself or you can use
|
images for your use. These can be images you create yourself or you
|
||||||
images that others have previously created. Docker registries are the
|
can use images that others have previously created. Docker registries are the
|
||||||
**distribution** component of Docker.
|
**distribution** component of Docker.
|
||||||
|
|
||||||
#### Docker containers
|
#### Docker containers
|
||||||
@@ -179,9 +179,8 @@ returns a final image.
|
|||||||
|
|
||||||
### How does a Docker registry work?
|
### How does a Docker registry work?
|
||||||
The Docker registry is the store for your Docker images. Once you build a Docker
|
The Docker registry is the store for your Docker images. Once you build a Docker
|
||||||
image you can *push* it to a public registry such as the one provided by [Docker
|
image you can *push* it to a public registry [Docker Hub](https://hub.docker.com) or to
|
||||||
Hub](https://hub.docker.com) or to your own registry running behind your
|
your own registry running behind your firewall.
|
||||||
firewall.
|
|
||||||
|
|
||||||
Using the Docker client, you can search for already published images and then
|
Using the Docker client, you can search for already published images and then
|
||||||
pull them down to your Docker host to build containers from them.
|
pull them down to your Docker host to build containers from them.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Docker currently runs only on Linux, but you can use VirtualBox to run Docker in
|
|||||||
a virtual machine on your box, and get the best of both worlds. Check out the
|
a virtual machine on your box, and get the best of both worlds. Check out the
|
||||||
[*Mac OS X*](../installation/mac/#macosx) and [*Microsoft
|
[*Mac OS X*](../installation/mac/#macosx) and [*Microsoft
|
||||||
Windows*](../installation/windows/#windows) installation guides. The small Linux
|
Windows*](../installation/windows/#windows) installation guides. The small Linux
|
||||||
distribution Docker Machine can be run inside virtual machines on these two
|
distribution boot2docker can be run inside virtual machines on these two
|
||||||
operating systems.
|
operating systems.
|
||||||
|
|
||||||
> **Note:** if you are using a remote Docker daemon, such as Boot2Docker,
|
> **Note:** if you are using a remote Docker daemon, such as Boot2Docker,
|
||||||
@@ -97,7 +97,7 @@ with several powerful functionalities:
|
|||||||
applications. Your ideal Postgresql setup can be re-used for all your future
|
applications. Your ideal Postgresql setup can be re-used for all your future
|
||||||
projects. And so on.
|
projects. And so on.
|
||||||
|
|
||||||
- *Sharing.* Docker has access to a public registry [on Docker Hub](https://registry.hub.docker.com/)
|
- *Sharing.* Docker has access to a [public registry](https://hub.docker.com)
|
||||||
where thousands of people have uploaded useful containers: anything from Redis,
|
where thousands of people have uploaded useful containers: anything from Redis,
|
||||||
CouchDB, Postgres to IRC bouncers to Rails app servers to Hadoop to base images
|
CouchDB, Postgres to IRC bouncers to Rails app servers to Hadoop to base images
|
||||||
for various Linux distros. The
|
for various Linux distros. The
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
#!/bin/bash -ex
|
|
||||||
|
|
||||||
# Populate an array with just docker dirs and one with content dirs
|
|
||||||
content_dir=(`ls -d /docs/content/*`)
|
|
||||||
|
|
||||||
# Loop content not of docker/
|
|
||||||
#
|
|
||||||
# Sed to process GitHub Markdown
|
|
||||||
# 1-2 Remove comment code from metadata block
|
|
||||||
# 3 Remove .md extension from link text
|
|
||||||
# 4 Change ](/ to ](/project/ in links
|
|
||||||
# 5 Change ](word) to ](/project/word)
|
|
||||||
# 6 Change ](../../ to ](/project/
|
|
||||||
# 7 Change ](../ to ](/project/word)
|
|
||||||
#
|
|
||||||
for i in "${content_dir[@]}"
|
|
||||||
do
|
|
||||||
:
|
|
||||||
case $i in
|
|
||||||
"/docs/content/docker-trusted-registry")
|
|
||||||
;;
|
|
||||||
"/docs/content/docker-hub")
|
|
||||||
;;
|
|
||||||
"/docs/content/windows")
|
|
||||||
;;
|
|
||||||
"/docs/content/mac")
|
|
||||||
;;
|
|
||||||
"/docs/content/linux")
|
|
||||||
;;
|
|
||||||
"/docs/content/registry")
|
|
||||||
y=${i##*/}
|
|
||||||
find $i -type f -name "*.md" -not -name "*.compare.md" -exec sed -i.old \
|
|
||||||
-e '/^<!\(--\)\{0,1\}\[\(end-\)\{0,1\}metadata\]\(--\)\{0,1\}>/g' \
|
|
||||||
-e 's/\(\][(]\)\(\.*\/\)*/\1/g' \
|
|
||||||
-e 's/\(\][(]\)\([A-Za-z0-9_/-]\{1,\}\)\(\.md\)\{0,1\}\(#\{0,1\}\(#[A-Za-z0-9_-]*\)\{0,1\}\)[)]/\1\/'$y'\/\2\4)/g' \
|
|
||||||
{} \;
|
|
||||||
;;
|
|
||||||
"/docs/content/compose")
|
|
||||||
y=${i##*/}
|
|
||||||
find $i -type f -name "*.md" -exec sed -i.old \
|
|
||||||
-e '/^<!.*metadata]>/g' \
|
|
||||||
-e '/^<!.*end-metadata.*>/g' \
|
|
||||||
-e 's/\(\]\)\([(]\)\(\/\)/\1\2\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\([A-z].*\)\(\.md\)/\1\/'$y'\/\2/g' \
|
|
||||||
-e 's/\([(]\)\(.*\)\(\.md\)/\1\2/g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\.\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\)/\1\/'$y'\//g' {} \;
|
|
||||||
;;
|
|
||||||
"/docs/content/swarm")
|
|
||||||
y=${i##*/}
|
|
||||||
find $i -type f -name "*.md" -exec sed -i.old \
|
|
||||||
-e '/^<!.*metadata]>/g' \
|
|
||||||
-e '/^<!.*end-metadata.*>/g' \
|
|
||||||
-e 's/\(\]\)\([(]\)\(\/\)/\1\2\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\([A-z].*\)\(\.md\)/\1\/'$y'\/\2/g' \
|
|
||||||
-e 's/\([(]\)\(.*\)\(\.md\)/\1\2/g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\.\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\)/\1\/'$y'\//g' {} \;
|
|
||||||
;;
|
|
||||||
"/docs/content/machine")
|
|
||||||
y=${i##*/}
|
|
||||||
find $i -type f -name "*.md" -exec sed -i.old \
|
|
||||||
-e '/^<!.*metadata]>/g' \
|
|
||||||
-e '/^<!.*end-metadata.*>/g' \
|
|
||||||
-e 's/\(\]\)\([(]\)\(\/\)/\1\2\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\([A-z].*\)\(\.md\)/\1\/'$y'\/\2/g' \
|
|
||||||
-e 's/\([(]\)\(.*\)\(\.md\)/\1\2/g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\.\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\)/\1\/'$y'\//g' {} \;
|
|
||||||
;;
|
|
||||||
"/docs/content/kitematic")
|
|
||||||
y=${i##*/}
|
|
||||||
find $i -type f -name "*.md" -exec sed -i.old \
|
|
||||||
-e '/^<!.*metadata]>/g' \
|
|
||||||
-e '/^<!.*end-metadata.*>/g' \
|
|
||||||
-e 's/\(\]\)\([(]\)\(\/\)/\1\2\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\([A-z].*\)\(\.md\)/\1\/'$y'\/\2/g' \
|
|
||||||
-e 's/\([(]\)\(.*\)\(\.md\)/\1\2/g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\.\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\)/\1\/'$y'\//g' {} \;
|
|
||||||
;;
|
|
||||||
"/docs/content/opensource")
|
|
||||||
y=${i##*/}
|
|
||||||
find $i -type f -name "*.md" -exec sed -i.old \
|
|
||||||
-e '/^<!.*metadata]>/g' \
|
|
||||||
-e '/^<!.*end-metadata.*>/g' \
|
|
||||||
-e 's/\(\]\)\([(]\)\(\/\)/\1\2\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\([A-z].*\)\(\.md\)/\1\/'$y'\/\2/g' \
|
|
||||||
-e 's/\([(]\)\(.*\)\(\.md\)/\1\2/g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\.\.\/\)/\1\/'$y'\//g' \
|
|
||||||
-e 's/\(\][(]\)\(\.\.\/\)/\1\/'$y'\//g' {} \;
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
y=${i##*/}
|
|
||||||
find $i -type f -name "*.md" -exec sed -i.old \
|
|
||||||
-e '/^<!.*metadata]>/g' \
|
|
||||||
-e '/^<!.*end-metadata.*>/g' {} \;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
@@ -26,9 +26,6 @@ program code and documentation code.
|
|||||||
* Run `gofmt -s -w file.go` on each changed file before
|
* Run `gofmt -s -w file.go` on each changed file before
|
||||||
committing your changes. Most editors have plug-ins that do this automatically.
|
committing your changes. Most editors have plug-ins that do this automatically.
|
||||||
|
|
||||||
* Run `golint` on each changed file before
|
|
||||||
committing your changes.
|
|
||||||
|
|
||||||
* Update the documentation when creating or modifying features.
|
* Update the documentation when creating or modifying features.
|
||||||
|
|
||||||
* Commits that fix or close an issue should reference them in the commit message
|
* Commits that fix or close an issue should reference them in the commit message
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ you continue working with your fork on this branch.
|
|||||||
|
|
||||||
## Clean your host of Docker artifacts
|
## Clean your host of Docker artifacts
|
||||||
|
|
||||||
Docker developers run the latest stable release of the Docker software (with Docker Machine if their machine is Mac OS X). They clean their local
|
Docker developers run the latest stable release of the Docker software (with Boot2Docker if their machine is Mac OS X). They clean their local
|
||||||
hosts of unnecessary Docker artifacts such as stopped containers or unused
|
hosts of unnecessary Docker artifacts such as stopped containers or unused
|
||||||
images. Cleaning unnecessary artifacts isn't strictly necessary, but it is
|
images. Cleaning unnecessary artifacts isn't strictly necessary, but it is
|
||||||
good practice, so it is included here.
|
good practice, so it is included here.
|
||||||
@@ -96,9 +96,9 @@ environment.
|
|||||||
|
|
||||||
1. Open a terminal.
|
1. Open a terminal.
|
||||||
|
|
||||||
Mac users, use `docker-machine status your_vm_name` to make sure your VM is
|
Mac users, use `boot2docker status` to make sure Boot2Docker is running. You
|
||||||
running. You may need to run `eval "$(docker-machine env your_vm_name)"` to
|
may need to run `eval "$(boot2docker shellinit)"` to initialize your shell
|
||||||
initialize your shell environment.
|
environment.
|
||||||
|
|
||||||
3. Change into the root of your forked repository.
|
3. Change into the root of your forked repository.
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ environment.
|
|||||||
Keeping the ancestor images improves the build performance. When you rebuild
|
Keeping the ancestor images improves the build performance. When you rebuild
|
||||||
the child image, the build process uses the local ancestors rather than
|
the child image, the build process uses the local ancestors rather than
|
||||||
retrieving them from the Hub. The build process gets new ancestors only if
|
retrieving them from the Hub. The build process gets new ancestors only if
|
||||||
Docker Hub has updated versions.
|
DockerHub has updated versions.
|
||||||
|
|
||||||
## Start a container and run a test
|
## Start a container and run a test
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ target="_blank">docker/docker repository</a>.
|
|||||||
|
|
||||||
$ cd ~
|
$ cd ~
|
||||||
|
|
||||||
In Windows, you'll work in your Docker Quickstart Terminal window instead of
|
In Windows, you'll work in your Boot2Docker window instead of Powershell or
|
||||||
Powershell or a `cmd` window.
|
a `cmd` window.
|
||||||
|
|
||||||
6. Create a `repos` directory.
|
6. Create a `repos` directory.
|
||||||
|
|
||||||
|
|||||||
@@ -317,9 +317,9 @@ can browse the docs.
|
|||||||
|
|
||||||
4. Enter the URL in your browser.
|
4. Enter the URL in your browser.
|
||||||
|
|
||||||
If you are using Docker Machine, replace the default localhost address
|
If you are running Boot2Docker, replace the default localhost address
|
||||||
(0.0.0.0) with your DOCKERHOST value. You can get this value at any time by
|
(0.0.0.0) with your DOCKERHOST value. You can get this value at any time by
|
||||||
entering `docker-machine ip <machine-name>` at the command line.
|
entering `boot2docker ip` at the command line.
|
||||||
|
|
||||||
5. Once in the documentation, look for the red notice to verify you are seeing the correct build.
|
5. Once in the documentation, look for the red notice to verify you are seeing the correct build.
|
||||||
|
|
||||||
|
|||||||
@@ -10,5 +10,502 @@ parent = "smn_remoteapi"
|
|||||||
|
|
||||||
# Docker Hub API
|
# Docker Hub API
|
||||||
|
|
||||||
This API is deprecated as of 1.7. To view the old version, see the [Docker Hub API](https://docs.docker.com/v1.7/reference/api/docker-io_api/) in the 1.7 documentation.
|
- This is the REST API for [Docker Hub](https://hub.docker.com).
|
||||||
|
- Authorization is done with basic auth over SSL
|
||||||
|
- Not all commands require authentication, only those noted as such.
|
||||||
|
|
||||||
|
# Repositories
|
||||||
|
|
||||||
|
## User repository
|
||||||
|
|
||||||
|
### Create a user repository
|
||||||
|
|
||||||
|
`PUT /v1/repositories/(namespace)/(repo_name)/`
|
||||||
|
|
||||||
|
Create a user repository with the given `namespace` and `repo_name`.
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
PUT /v1/repositories/foo/bar/ HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
X-Docker-Token: true
|
||||||
|
|
||||||
|
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}]
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **namespace** – the namespace for the repo
|
||||||
|
- **repo_name** – the name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 200
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
WWW-Authenticate: Token signature=123abc,repository="foo/bar",access=write
|
||||||
|
X-Docker-Token: signature=123abc,repository="foo/bar",access=write
|
||||||
|
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – Created
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active
|
||||||
|
|
||||||
|
### Delete a user repository
|
||||||
|
|
||||||
|
`DELETE /v1/repositories/(namespace)/(repo_name)/`
|
||||||
|
|
||||||
|
Delete a user repository with the given `namespace` and `repo_name`.
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
DELETE /v1/repositories/foo/bar/ HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
X-Docker-Token: true
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **namespace** – the namespace for the repo
|
||||||
|
- **repo_name** – the name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 202
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
WWW-Authenticate: Token signature=123abc,repository="foo/bar",access=delete
|
||||||
|
X-Docker-Token: signature=123abc,repository="foo/bar",access=delete
|
||||||
|
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – Deleted
|
||||||
|
- **202** – Accepted
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active
|
||||||
|
|
||||||
|
## Library repository
|
||||||
|
|
||||||
|
### Create a library repository
|
||||||
|
|
||||||
|
`PUT /v1/repositories/(repo_name)/`
|
||||||
|
|
||||||
|
Create a library repository with the given `repo_name`.
|
||||||
|
This is a restricted feature only available to docker admins.
|
||||||
|
|
||||||
|
> When namespace is missing, it is assumed to be `library`
|
||||||
|
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
PUT /v1/repositories/foobar/ HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
X-Docker-Token: true
|
||||||
|
|
||||||
|
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}]
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **repo_name** – the library name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 200
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
WWW-Authenticate: Token signature=123abc,repository="library/foobar",access=write
|
||||||
|
X-Docker-Token: signature=123abc,repository="foo/bar",access=write
|
||||||
|
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – Created
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active
|
||||||
|
|
||||||
|
### Delete a library repository
|
||||||
|
|
||||||
|
`DELETE /v1/repositories/(repo_name)/`
|
||||||
|
|
||||||
|
Delete a library repository with the given `repo_name`.
|
||||||
|
This is a restricted feature only available to docker admins.
|
||||||
|
|
||||||
|
> When namespace is missing, it is assumed to be `library`
|
||||||
|
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
DELETE /v1/repositories/foobar/ HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
X-Docker-Token: true
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **repo_name** – the library name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 202
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
WWW-Authenticate: Token signature=123abc,repository="library/foobar",access=delete
|
||||||
|
X-Docker-Token: signature=123abc,repository="foo/bar",access=delete
|
||||||
|
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – Deleted
|
||||||
|
- **202** – Accepted
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active
|
||||||
|
|
||||||
|
# Repository images
|
||||||
|
|
||||||
|
## User repository images
|
||||||
|
|
||||||
|
### Update user repository images
|
||||||
|
|
||||||
|
`PUT /v1/repositories/(namespace)/(repo_name)/images`
|
||||||
|
|
||||||
|
Update the images for a user repo.
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
PUT /v1/repositories/foo/bar/images HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
|
||||||
|
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
|
||||||
|
"checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}]
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **namespace** – the namespace for the repo
|
||||||
|
- **repo_name** – the name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 204
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **204** – Created
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active or permission denied
|
||||||
|
|
||||||
|
### List user repository images
|
||||||
|
|
||||||
|
`GET /v1/repositories/(namespace)/(repo_name)/images`
|
||||||
|
|
||||||
|
Get the images for a user repo.
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
GET /v1/repositories/foo/bar/images HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **namespace** – the namespace for the repo
|
||||||
|
- **repo_name** – the name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 200
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
|
||||||
|
"checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"},
|
||||||
|
{"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds",
|
||||||
|
"checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}]
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – OK
|
||||||
|
- **404** – Not found
|
||||||
|
|
||||||
|
## Library repository images
|
||||||
|
|
||||||
|
### Update library repository images
|
||||||
|
|
||||||
|
`PUT /v1/repositories/(repo_name)/images`
|
||||||
|
|
||||||
|
Update the images for a library repo.
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
PUT /v1/repositories/foobar/images HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
|
||||||
|
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
|
||||||
|
"checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}]
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **repo_name** – the library name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 204
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **204** – Created
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active or permission denied
|
||||||
|
|
||||||
|
### List library repository images
|
||||||
|
|
||||||
|
`GET /v1/repositories/(repo_name)/images`
|
||||||
|
|
||||||
|
Get the images for a library repo.
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
GET /v1/repositories/foobar/images HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **repo_name** – the library name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 200
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
|
||||||
|
"checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"},
|
||||||
|
{"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds",
|
||||||
|
"checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}]
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – OK
|
||||||
|
- **404** – Not found
|
||||||
|
|
||||||
|
# Repository authorization
|
||||||
|
|
||||||
|
## Library repository
|
||||||
|
|
||||||
|
### Authorize a token for a library
|
||||||
|
|
||||||
|
`PUT /v1/repositories/(repo_name)/auth`
|
||||||
|
|
||||||
|
Authorize a token for a library repo
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
PUT /v1/repositories/foobar/auth HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Authorization: Token signature=123abc,repository="library/foobar",access=write
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **repo_name** – the library name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 200
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
"OK"
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – OK
|
||||||
|
- **403** – Permission denied
|
||||||
|
- **404** – Not found
|
||||||
|
|
||||||
|
## User repository
|
||||||
|
|
||||||
|
### Authorize a token for a user repository
|
||||||
|
|
||||||
|
`PUT /v1/repositories/(namespace)/(repo_name)/auth`
|
||||||
|
|
||||||
|
Authorize a token for a user repo
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
PUT /v1/repositories/foo/bar/auth HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Authorization: Token signature=123abc,repository="foo/bar",access=write
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **namespace** – the namespace for the repo
|
||||||
|
- **repo_name** – the name for the repo
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 200
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
"OK"
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – OK
|
||||||
|
- **403** – Permission denied
|
||||||
|
- **404** – Not found
|
||||||
|
|
||||||
|
## Users
|
||||||
|
|
||||||
|
### User login
|
||||||
|
|
||||||
|
`GET /v1/users/`
|
||||||
|
|
||||||
|
If you want to check your login, you can try this endpoint
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
GET /v1/users/ HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **200** – no error
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active
|
||||||
|
|
||||||
|
### User register
|
||||||
|
|
||||||
|
`POST /v1/users/`
|
||||||
|
|
||||||
|
Registering a new account.
|
||||||
|
|
||||||
|
**Example request**:
|
||||||
|
|
||||||
|
POST /v1/users/ HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{"email": "sam@docker.com",
|
||||||
|
"password": "toto42",
|
||||||
|
"username": "foobar"}
|
||||||
|
|
||||||
|
Json Parameters:
|
||||||
|
|
||||||
|
- **email** – valid email address, that needs to be confirmed
|
||||||
|
- **username** – min 4 character, max 30 characters, must match
|
||||||
|
the regular expression [a-z0-9_].
|
||||||
|
- **password** – min 5 characters
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 201 OK
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
"User Created"
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **201** – User Created
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
|
||||||
|
### Update user
|
||||||
|
|
||||||
|
`PUT /v1/users/(username)/`
|
||||||
|
|
||||||
|
Change a password or email address for given user. If you pass in an
|
||||||
|
email, it will add it to your account, it will not remove the old
|
||||||
|
one. Passwords will be updated.
|
||||||
|
|
||||||
|
It is up to the client to verify that that password that is sent is
|
||||||
|
the one that they want. Common approach is to have them type it
|
||||||
|
twice.
|
||||||
|
|
||||||
|
**Example Request**:
|
||||||
|
|
||||||
|
PUT /v1/users/fakeuser/ HTTP/1.1
|
||||||
|
Host: index.docker.io
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic akmklmasadalkm==
|
||||||
|
|
||||||
|
{"email": "sam@docker.com",
|
||||||
|
"password": "toto42"}
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- **username** – username for the person you want to update
|
||||||
|
|
||||||
|
**Example Response**:
|
||||||
|
|
||||||
|
HTTP/1.1 204
|
||||||
|
Vary: Accept
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
""
|
||||||
|
|
||||||
|
Status Codes:
|
||||||
|
|
||||||
|
- **204** – User Updated
|
||||||
|
- **400** – Errors (invalid json, missing or invalid fields, etc)
|
||||||
|
- **401** – Unauthorized
|
||||||
|
- **403** – Account is not Active
|
||||||
|
- **404** – User not found
|
||||||
|
|||||||
@@ -298,4 +298,429 @@ The `fromImage` and `repo` parameters now supports the `repo:tag` format.
|
|||||||
Consequently, the `tag` parameter is now obsolete. Using the new format and
|
Consequently, the `tag` parameter is now obsolete. Using the new format and
|
||||||
the `tag` parameter at the same time will return an error.
|
the `tag` parameter at the same time will return an error.
|
||||||
|
|
||||||
|
## v1.13
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.13*](/reference/api/docker_remote_api_v1.13/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`GET /containers/(name)/json`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
The `HostConfig.Links` field is now filled correctly
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
`Sockets` parameter added to the `/info` endpoint listing all the sockets the
|
||||||
|
daemon is configured to listen on.
|
||||||
|
|
||||||
|
`POST /containers/(name)/start`
|
||||||
|
`POST /containers/(name)/stop`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
`start` and `stop` will now return 304 if the container's status is not modified
|
||||||
|
|
||||||
|
`POST /commit`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
Added a `pause` parameter (default `true`) to pause the container during commit
|
||||||
|
|
||||||
|
## v1.12
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.12*](/reference/api/docker_remote_api_v1.12/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`POST /build`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
Build now has support for the `forcerm` parameter to always remove containers
|
||||||
|
|
||||||
|
`GET /containers/(name)/json`
|
||||||
|
`GET /images/(name)/json`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
All the JSON keys are now in CamelCase
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
Trusted builds are now Automated Builds - `is_trusted` is now `is_automated`.
|
||||||
|
|
||||||
|
**Removed Insert Endpoint**
|
||||||
|
The `insert` endpoint has been removed.
|
||||||
|
|
||||||
|
## v1.11
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.11*](/reference/api/docker_remote_api_v1.11/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`GET /_ping`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
You can now ping the server via the `_ping` endpoint.
|
||||||
|
|
||||||
|
`GET /events`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
You can now use the `-until` parameter to close connection
|
||||||
|
after timestamp.
|
||||||
|
|
||||||
|
`GET /containers/(id)/logs`
|
||||||
|
|
||||||
|
This url is preferred method for getting container logs now.
|
||||||
|
|
||||||
|
## v1.10
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.10*](/reference/api/docker_remote_api_v1.10/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`DELETE /images/(name)`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
You can now use the force parameter to force delete of an
|
||||||
|
image, even if it's tagged in multiple repositories. **New!**
|
||||||
|
You
|
||||||
|
can now use the noprune parameter to prevent the deletion of parent
|
||||||
|
images
|
||||||
|
|
||||||
|
`DELETE /containers/(id)`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
You can now use the force parameter to force delete a
|
||||||
|
container, even if it is currently running
|
||||||
|
|
||||||
|
## v1.9
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.9*](/reference/api/docker_remote_api_v1.9/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`POST /build`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
This endpoint now takes a serialized ConfigFile which it
|
||||||
|
uses to resolve the proper registry auth credentials for pulling the
|
||||||
|
base image. Clients which previously implemented the version
|
||||||
|
accepting an AuthConfig object must be updated.
|
||||||
|
|
||||||
|
## v1.8
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.8*](/reference/api/docker_remote_api_v1.8/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`POST /build`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
This endpoint now returns build status as json stream. In
|
||||||
|
case of a build error, it returns the exit status of the failed
|
||||||
|
command.
|
||||||
|
|
||||||
|
`GET /containers/(id)/json`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
This endpoint now returns the host config for the
|
||||||
|
container.
|
||||||
|
|
||||||
|
`POST /images/create`
|
||||||
|
|
||||||
|
`POST /images/(name)/insert`
|
||||||
|
|
||||||
|
`POST /images/(name)/push`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
progressDetail object was added in the JSON. It's now
|
||||||
|
possible to get the current value and the total of the progress
|
||||||
|
without having to parse the string.
|
||||||
|
|
||||||
|
## v1.7
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.7*](/reference/api/docker_remote_api_v1.7/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`GET /images/json`
|
||||||
|
|
||||||
|
The format of the json returned from this uri changed. Instead of an
|
||||||
|
entry for each repo/tag on an image, each image is only represented
|
||||||
|
once, with a nested attribute indicating the repo/tags that apply to
|
||||||
|
that image.
|
||||||
|
|
||||||
|
Instead of:
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"VirtualSize": 131506275,
|
||||||
|
"Size": 131506275,
|
||||||
|
"Created": 1365714795,
|
||||||
|
"Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
|
||||||
|
"Tag": "12.04",
|
||||||
|
"Repository": "ubuntu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"VirtualSize": 131506275,
|
||||||
|
"Size": 131506275,
|
||||||
|
"Created": 1365714795,
|
||||||
|
"Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
|
||||||
|
"Tag": "latest",
|
||||||
|
"Repository": "ubuntu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"VirtualSize": 131506275,
|
||||||
|
"Size": 131506275,
|
||||||
|
"Created": 1365714795,
|
||||||
|
"Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
|
||||||
|
"Tag": "precise",
|
||||||
|
"Repository": "ubuntu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"VirtualSize": 180116135,
|
||||||
|
"Size": 24653,
|
||||||
|
"Created": 1364102658,
|
||||||
|
"Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
|
||||||
|
"Tag": "12.10",
|
||||||
|
"Repository": "ubuntu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"VirtualSize": 180116135,
|
||||||
|
"Size": 24653,
|
||||||
|
"Created": 1364102658,
|
||||||
|
"Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
|
||||||
|
"Tag": "quantal",
|
||||||
|
"Repository": "ubuntu"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
The returned json looks like this:
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"RepoTags": [
|
||||||
|
"ubuntu:12.04",
|
||||||
|
"ubuntu:precise",
|
||||||
|
"ubuntu:latest"
|
||||||
|
],
|
||||||
|
"Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
|
||||||
|
"Created": 1365714795,
|
||||||
|
"Size": 131506275,
|
||||||
|
"VirtualSize": 131506275
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RepoTags": [
|
||||||
|
"ubuntu:12.10",
|
||||||
|
"ubuntu:quantal"
|
||||||
|
],
|
||||||
|
"ParentId": "27cf784147099545",
|
||||||
|
"Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
|
||||||
|
"Created": 1364102658,
|
||||||
|
"Size": 24653,
|
||||||
|
"VirtualSize": 180116135
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
`GET /images/viz`
|
||||||
|
|
||||||
|
This URI no longer exists. The `images --viz`
|
||||||
|
output is now generated in the client, using the
|
||||||
|
`/images/json` data.
|
||||||
|
|
||||||
|
## v1.6
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.6*](/reference/api/docker_remote_api_v1.6/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`POST /containers/(id)/attach`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
You can now split stderr from stdout. This is done by
|
||||||
|
prefixing a header to each transmission. See
|
||||||
|
[`POST /containers/(id)/attach`](
|
||||||
|
/reference/api/docker_remote_api_v1.9/#attach-to-a-container "POST /containers/(id)/attach").
|
||||||
|
The WebSocket attach is unchanged. Note that attach calls on the
|
||||||
|
previous API version didn't change. Stdout and stderr are merged.
|
||||||
|
|
||||||
|
## v1.5
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.5*](/reference/api/docker_remote_api_v1.5/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`POST /images/create`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
You can now pass registry credentials (via an AuthConfig
|
||||||
|
object) through the X-Registry-Auth header
|
||||||
|
|
||||||
|
`POST /images/(name)/push`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
The AuthConfig object now needs to be passed through the
|
||||||
|
X-Registry-Auth header
|
||||||
|
|
||||||
|
`GET /containers/json`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
The format of the Ports entry has been changed to a list of
|
||||||
|
dicts each containing PublicPort, PrivatePort and Type describing a
|
||||||
|
port mapping.
|
||||||
|
|
||||||
|
## v1.4
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.4*](/reference/api/docker_remote_api_v1.4/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`POST /images/create`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
When pulling a repo, all images are now downloaded in parallel.
|
||||||
|
|
||||||
|
`GET /containers/(id)/top`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
You can now use ps args with docker top, like docker top
|
||||||
|
<container_id> aux
|
||||||
|
|
||||||
|
`GET /events`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
Image's name added in the events
|
||||||
|
|
||||||
|
## v1.3
|
||||||
|
|
||||||
|
docker v0.5.0
|
||||||
|
[51f6c4a](https://github.com/docker/docker/commit/51f6c4a7372450d164c61e0054daf0223ddbd909)
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.3*](/reference/api/docker_remote_api_v1.3/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`GET /containers/(id)/top`
|
||||||
|
|
||||||
|
List the processes running inside a container.
|
||||||
|
|
||||||
|
`GET /events`
|
||||||
|
|
||||||
|
**New!**
|
||||||
|
Monitor docker's events via streaming or via polling
|
||||||
|
|
||||||
|
Builder (/build):
|
||||||
|
|
||||||
|
- Simplify the upload of the build context
|
||||||
|
- Simply stream a tarball instead of multipart upload with 4
|
||||||
|
intermediary buffers
|
||||||
|
- Simpler, less memory usage, less disk usage and faster
|
||||||
|
|
||||||
|
> **Warning**:
|
||||||
|
> The /build improvements are not reverse-compatible. Pre 1.3 clients will
|
||||||
|
> break on /build.
|
||||||
|
|
||||||
|
List containers (/containers/json):
|
||||||
|
|
||||||
|
- You can use size=1 to get the size of the containers
|
||||||
|
|
||||||
|
Start containers (/containers/<id>/start):
|
||||||
|
|
||||||
|
- You can now pass host-specific configuration (e.g., bind mounts) in
|
||||||
|
the POST body for start calls
|
||||||
|
|
||||||
|
## v1.2
|
||||||
|
|
||||||
|
docker v0.4.2
|
||||||
|
[2e7649b](https://github.com/docker/docker/commit/2e7649beda7c820793bd46766cbc2cfeace7b168)
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.2*](/reference/api/docker_remote_api_v1.2/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
The auth configuration is now handled by the client.
|
||||||
|
|
||||||
|
The client should send it's authConfig as POST on each call of
|
||||||
|
`/images/(name)/push`
|
||||||
|
|
||||||
|
`GET /auth`
|
||||||
|
|
||||||
|
**Deprecated.**
|
||||||
|
|
||||||
|
`POST /auth`
|
||||||
|
|
||||||
|
Only checks the configuration but doesn't store it on the server
|
||||||
|
|
||||||
|
Deleting an image is now improved, will only untag the image if it
|
||||||
|
has children and remove all the untagged parents if has any.
|
||||||
|
|
||||||
|
`POST /images/<name>/delete`
|
||||||
|
|
||||||
|
Now returns a JSON structure with the list of images
|
||||||
|
deleted/untagged.
|
||||||
|
|
||||||
|
## v1.1
|
||||||
|
|
||||||
|
docker v0.4.0
|
||||||
|
[a8ae398](https://github.com/docker/docker/commit/a8ae398bf52e97148ee7bd0d5868de2e15bd297f)
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.1*](/reference/api/docker_remote_api_v1.1/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
`POST /images/create`
|
||||||
|
|
||||||
|
`POST /images/(name)/insert`
|
||||||
|
|
||||||
|
`POST /images/(name)/push`
|
||||||
|
|
||||||
|
Uses json stream instead of HTML hijack, it looks like this:
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{"status":"Pushing..."}
|
||||||
|
{"status":"Pushing", "progress":"1/? (n/a)"}
|
||||||
|
{"error":"Invalid..."}
|
||||||
|
...
|
||||||
|
|
||||||
|
## v1.0
|
||||||
|
|
||||||
|
docker v0.3.4
|
||||||
|
[8d73740](https://github.com/docker/docker/commit/8d73740343778651c09160cde9661f5f387b36f4)
|
||||||
|
|
||||||
|
### Full documentation
|
||||||
|
|
||||||
|
[*Docker Remote API v1.0*](/reference/api/docker_remote_api_v1.0/)
|
||||||
|
|
||||||
|
### What's new
|
||||||
|
|
||||||
|
Initial version
|
||||||
|
|||||||
@@ -49,11 +49,6 @@ List containers
|
|||||||
"Created": 1367854155,
|
"Created": 1367854155,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
|
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
|
||||||
"Labels": {
|
|
||||||
"com.example.vendor": "Acme",
|
|
||||||
"com.example.license": "GPL",
|
|
||||||
"com.example.version": "1.0"
|
|
||||||
},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
},
|
},
|
||||||
@@ -65,7 +60,6 @@ List containers
|
|||||||
"Created": 1367854155,
|
"Created": 1367854155,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [],
|
"Ports": [],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
},
|
},
|
||||||
@@ -77,7 +71,6 @@ List containers
|
|||||||
"Created": 1367854154,
|
"Created": 1367854154,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports":[],
|
"Ports":[],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw":12288,
|
"SizeRw":12288,
|
||||||
"SizeRootFs":0
|
"SizeRootFs":0
|
||||||
},
|
},
|
||||||
@@ -89,7 +82,6 @@ List containers
|
|||||||
"Created": 1367854152,
|
"Created": 1367854152,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [],
|
"Ports": [],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,11 +51,6 @@ List containers
|
|||||||
"Created": 1367854155,
|
"Created": 1367854155,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
|
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
|
||||||
"Labels": {
|
|
||||||
"com.example.vendor": "Acme",
|
|
||||||
"com.example.license": "GPL",
|
|
||||||
"com.example.version": "1.0"
|
|
||||||
},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
},
|
},
|
||||||
@@ -67,7 +62,6 @@ List containers
|
|||||||
"Created": 1367854155,
|
"Created": 1367854155,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [],
|
"Ports": [],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
},
|
},
|
||||||
@@ -79,7 +73,6 @@ List containers
|
|||||||
"Created": 1367854154,
|
"Created": 1367854154,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports":[],
|
"Ports":[],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw":12288,
|
"SizeRw":12288,
|
||||||
"SizeRootFs":0
|
"SizeRootFs":0
|
||||||
},
|
},
|
||||||
@@ -91,7 +84,6 @@ List containers
|
|||||||
"Created": 1367854152,
|
"Created": 1367854152,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [],
|
"Ports": [],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,11 +51,6 @@ List containers
|
|||||||
"Created": 1367854155,
|
"Created": 1367854155,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
|
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
|
||||||
"Labels": {
|
|
||||||
"com.example.vendor": "Acme",
|
|
||||||
"com.example.license": "GPL",
|
|
||||||
"com.example.version": "1.0"
|
|
||||||
},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
},
|
},
|
||||||
@@ -67,7 +62,6 @@ List containers
|
|||||||
"Created": 1367854155,
|
"Created": 1367854155,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [],
|
"Ports": [],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
},
|
},
|
||||||
@@ -79,7 +73,6 @@ List containers
|
|||||||
"Created": 1367854154,
|
"Created": 1367854154,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports":[],
|
"Ports":[],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw":12288,
|
"SizeRw":12288,
|
||||||
"SizeRootFs":0
|
"SizeRootFs":0
|
||||||
},
|
},
|
||||||
@@ -91,7 +84,6 @@ List containers
|
|||||||
"Created": 1367854152,
|
"Created": 1367854152,
|
||||||
"Status": "Exit 0",
|
"Status": "Exit 0",
|
||||||
"Ports": [],
|
"Ports": [],
|
||||||
"Labels": {},
|
|
||||||
"SizeRw": 12288,
|
"SizeRw": 12288,
|
||||||
"SizeRootFs": 0
|
"SizeRootFs": 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,752 @@ parent="smn_hub_ref"
|
|||||||
|
|
||||||
# The Docker Hub and the Registry v1
|
# The Docker Hub and the Registry v1
|
||||||
|
|
||||||
This API is deprecated as of 1.7. To view the old version, see the [go
|
## The three roles
|
||||||
here](http://docs.docker.com/v1.7/reference/api/hub_registry_spec/) in
|
|
||||||
the 1.7 documentation. If you want an overview of the current features in
|
There are three major components playing a role in the Docker ecosystem.
|
||||||
Docker Hub or other image management features see the [image management
|
|
||||||
overview](/userguide/image_management/) in the current documentation set.
|
### Docker Hub
|
||||||
|
|
||||||
|
The Docker Hub is responsible for centralizing information about:
|
||||||
|
|
||||||
|
- User accounts
|
||||||
|
- Checksums of the images
|
||||||
|
- Public namespaces
|
||||||
|
|
||||||
|
The Docker Hub has different components:
|
||||||
|
|
||||||
|
- Web UI
|
||||||
|
- Meta-data store (comments, stars, list public repositories)
|
||||||
|
- Authentication service
|
||||||
|
- Tokenization
|
||||||
|
|
||||||
|
The Docker Hub is authoritative for that information.
|
||||||
|
|
||||||
|
There is only one instance of the Docker Hub, run and
|
||||||
|
managed by Docker Inc.
|
||||||
|
|
||||||
|
### Docker Registry 1.0
|
||||||
|
|
||||||
|
The 1.0 registry has the following characteristics:
|
||||||
|
|
||||||
|
- It stores the images and the graph for a set of repositories
|
||||||
|
- It does not have user accounts data
|
||||||
|
- It has no notion of user accounts or authorization
|
||||||
|
- It delegates authentication and authorization to the Docker Hub Auth
|
||||||
|
service using tokens
|
||||||
|
- It supports different storage backends (S3, cloud files, local FS)
|
||||||
|
- It doesn't have a local database
|
||||||
|
- [Source Code](https://github.com/docker/docker-registry)
|
||||||
|
|
||||||
|
We expect that there will be multiple registries out there. To help you
|
||||||
|
grasp the context, here are some examples of registries:
|
||||||
|
|
||||||
|
- **sponsor registry**: such a registry is provided by a third-party
|
||||||
|
hosting infrastructure as a convenience for their customers and the
|
||||||
|
Docker community as a whole. Its costs are supported by the third
|
||||||
|
party, but the management and operation of the registry are
|
||||||
|
supported by Docker, Inc. It features read/write access, and delegates
|
||||||
|
authentication and authorization to the Docker Hub.
|
||||||
|
- **mirror registry**: such a registry is provided by a third-party
|
||||||
|
hosting infrastructure but is targeted at their customers only. Some
|
||||||
|
mechanism (unspecified to date) ensures that public images are
|
||||||
|
pulled from a sponsor registry to the mirror registry, to make sure
|
||||||
|
that the customers of the third-party provider can `docker pull`
|
||||||
|
those images locally.
|
||||||
|
- **vendor registry**: such a registry is provided by a software
|
||||||
|
vendor who wants to distribute docker images. It would be operated
|
||||||
|
and managed by the vendor. Only users authorized by the vendor would
|
||||||
|
be able to get write access. Some images would be public (accessible
|
||||||
|
for anyone), others private (accessible only for authorized users).
|
||||||
|
Authentication and authorization would be delegated to the Docker Hub.
|
||||||
|
The goal of vendor registries is to let someone do `docker pull
|
||||||
|
basho/riak1.3` and automatically push from the vendor registry
|
||||||
|
(instead of a sponsor registry); i.e., vendors get all the convenience of a
|
||||||
|
sponsor registry, while retaining control on the asset distribution.
|
||||||
|
- **private registry**: such a registry is located behind a firewall,
|
||||||
|
or protected by an additional security layer (HTTP authorization,
|
||||||
|
SSL client-side certificates, IP address authorization...). The
|
||||||
|
registry is operated by a private entity, outside of Docker's
|
||||||
|
control. It can optionally delegate additional authorization to the
|
||||||
|
Docker Hub, but it is not mandatory.
|
||||||
|
|
||||||
|
> **Note:** The latter implies that while HTTP is the protocol
|
||||||
|
> of choice for a registry, multiple schemes are possible (and
|
||||||
|
> in some cases, trivial):
|
||||||
|
>
|
||||||
|
> - HTTP with GET (and PUT for read-write registries);
|
||||||
|
> - local mount point;
|
||||||
|
> - remote docker addressed through SSH.
|
||||||
|
|
||||||
|
The latter would only require two new commands in Docker, e.g.,
|
||||||
|
`registryget` and `registryput`,
|
||||||
|
wrapping access to the local filesystem (and optionally doing
|
||||||
|
consistency checks). Authentication and authorization are then delegated
|
||||||
|
to SSH (e.g., with public keys).
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
On top of being a runtime for LXC, Docker is the Registry client. It
|
||||||
|
supports:
|
||||||
|
|
||||||
|
- Push / Pull on the registry
|
||||||
|
- Client authentication on the Docker Hub
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
### Pull
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
1. Contact the Docker Hub to know where I should download “samalba/busybox”
|
||||||
|
2. Docker Hub replies: a. `samalba/busybox` is on Registry A b. here are the
|
||||||
|
checksums for `samalba/busybox` (for all layers) c. token
|
||||||
|
3. Contact Registry A to receive the layers for `samalba/busybox` (all of
|
||||||
|
them to the base image). Registry A is authoritative for “samalba/busybox”
|
||||||
|
but keeps a copy of all inherited layers and serve them all from the same
|
||||||
|
location.
|
||||||
|
4. registry contacts Docker Hub to verify if token/user is allowed to download images
|
||||||
|
5. Docker Hub returns true/false lettings registry know if it should proceed or error
|
||||||
|
out
|
||||||
|
6. Get the payload for all layers
|
||||||
|
|
||||||
|
It's possible to run:
|
||||||
|
|
||||||
|
$ docker pull https://<registry>/repositories/samalba/busybox
|
||||||
|
|
||||||
|
In this case, Docker bypasses the Docker Hub. However the security is not
|
||||||
|
guaranteed (in case Registry A is corrupted) because there won't be any
|
||||||
|
checksum checks.
|
||||||
|
|
||||||
|
Currently registry redirects to s3 urls for downloads, going forward all
|
||||||
|
downloads need to be streamed through the registry. The Registry will
|
||||||
|
then abstract the calls to S3 by a top-level class which implements
|
||||||
|
sub-classes for S3 and local storage.
|
||||||
|
|
||||||
|
Token is only returned when the `X-Docker-Token`
|
||||||
|
header is sent with request.
|
||||||
|
|
||||||
|
Basic Auth is required to pull private repos. Basic auth isn't required
|
||||||
|
for pulling public repos, but if one is provided, it needs to be valid
|
||||||
|
and for an active account.
|
||||||
|
|
||||||
|
**API (pulling repository foo/bar):**
|
||||||
|
|
||||||
|
1. (Docker -> Docker Hub) GET /v1/repositories/foo/bar/images:
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
|
||||||
|
X-Docker-Token: true
|
||||||
|
|
||||||
|
**Action**:
|
||||||
|
|
||||||
|
(looking up the foo/bar in db and gets images and checksums
|
||||||
|
for that repo (all if no tag is specified, if tag, only
|
||||||
|
checksums for those tags) see part 4.4.1)
|
||||||
|
|
||||||
|
2. (Docker Hub -> Docker) HTTP 200 OK
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=write
|
||||||
|
X-Docker-Endpoints: registry.docker.io [,registry2.docker.io]
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
Jsonified checksums (see part 4.4.1)
|
||||||
|
|
||||||
|
3. (Docker -> Registry) GET /v1/repositories/foo/bar/tags/latest
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=write
|
||||||
|
|
||||||
|
4. (Registry -> Docker Hub) GET /v1/repositories/foo/bar/images
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=read
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
<ids and checksums in payload>
|
||||||
|
|
||||||
|
**Action**:
|
||||||
|
|
||||||
|
(Lookup token see if they have access to pull.)
|
||||||
|
|
||||||
|
If good:
|
||||||
|
HTTP 200 OK Docker Hub will invalidate the token
|
||||||
|
|
||||||
|
If bad:
|
||||||
|
HTTP 401 Unauthorized
|
||||||
|
|
||||||
|
5. (Docker -> Registry) GET /v1/images/928374982374/ancestry
|
||||||
|
|
||||||
|
**Action**:
|
||||||
|
|
||||||
|
(for each image id returned in the registry, fetch /json + /layer)
|
||||||
|
|
||||||
|
> **Note**:
|
||||||
|
> If someone makes a second request, then we will always give a new token,
|
||||||
|
> never reuse tokens.
|
||||||
|
|
||||||
|
### Push
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
1. Contact the Docker Hub to allocate the repository name “samalba/busybox”
|
||||||
|
(authentication required with user credentials)
|
||||||
|
2. If authentication works and namespace available, “samalba/busybox”
|
||||||
|
is allocated and a temporary token is returned (namespace is marked
|
||||||
|
as initialized in Docker Hub)
|
||||||
|
3. Push the image on the registry (along with the token)
|
||||||
|
4. Registry A contacts the Docker Hub to verify the token (token must
|
||||||
|
corresponds to the repository name)
|
||||||
|
5. Docker Hub validates the token. Registry A starts reading the stream
|
||||||
|
pushed by docker and store the repository (with its images)
|
||||||
|
6. docker contacts the Docker Hub to give checksums for upload images
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> **It's possible not to use the Docker Hub at all!** In this case, a deployed
|
||||||
|
> version of the Registry is deployed to store and serve images. Those
|
||||||
|
> images are not authenticated and the security is not guaranteed.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> **Docker Hub can be replaced!** For a private Registry deployed, a custom
|
||||||
|
> Docker Hub can be used to serve and validate token according to different
|
||||||
|
> policies.
|
||||||
|
|
||||||
|
Docker computes the checksums and submit them to the Docker Hub at the end of
|
||||||
|
the push. When a repository name does not have checksums on the Docker Hub,
|
||||||
|
it means that the push is in progress (since checksums are submitted at
|
||||||
|
the end).
|
||||||
|
|
||||||
|
**API (pushing repos foo/bar):**
|
||||||
|
|
||||||
|
1. (Docker -> Docker Hub) PUT /v1/repositories/foo/bar/
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Basic sdkjfskdjfhsdkjfh== X-Docker-Token:
|
||||||
|
true
|
||||||
|
|
||||||
|
**Action**:
|
||||||
|
|
||||||
|
- in Docker Hub, we allocated a new repository, and set to
|
||||||
|
initialized
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
(The body contains the list of images that are going to be
|
||||||
|
pushed, with empty checksums. The checksums will be set at
|
||||||
|
the end of the push):
|
||||||
|
|
||||||
|
[{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”}]
|
||||||
|
|
||||||
|
2. (Docker Hub -> Docker) 200 Created
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
WWW-Authenticate: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=write
|
||||||
|
X-Docker-Endpoints: registry.docker.io [, registry2.docker.io]
|
||||||
|
|
||||||
|
3. (Docker -> Registry) PUT /v1/images/98765432_parent/json
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=write
|
||||||
|
|
||||||
|
4. (Registry->Docker Hub) GET /v1/repositories/foo/bar/images
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=write
|
||||||
|
|
||||||
|
**Action**:
|
||||||
|
|
||||||
|
- Docker Hub:
|
||||||
|
will invalidate the token.
|
||||||
|
- Registry:
|
||||||
|
grants a session (if token is approved) and fetches
|
||||||
|
the images id
|
||||||
|
|
||||||
|
5. (Docker -> Registry) PUT /v1/images/98765432_parent/json
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=write
|
||||||
|
Cookie: (Cookie provided by the Registry)
|
||||||
|
|
||||||
|
6. (Docker -> Registry) PUT /v1/images/98765432/json
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Cookie: (Cookie provided by the Registry)
|
||||||
|
|
||||||
|
7. (Docker -> Registry) PUT /v1/images/98765432_parent/layer
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Cookie: (Cookie provided by the Registry)
|
||||||
|
|
||||||
|
8. (Docker -> Registry) PUT /v1/images/98765432/layer
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
X-Docker-Checksum: sha256:436745873465fdjkhdfjkgh
|
||||||
|
|
||||||
|
9. (Docker -> Registry) PUT /v1/repositories/foo/bar/tags/latest
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Cookie: (Cookie provided by the Registry)
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
“98765432”
|
||||||
|
|
||||||
|
10. (Docker -> Docker Hub) PUT /v1/repositories/foo/bar/images
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Basic 123oislifjsldfj== X-Docker-Endpoints:
|
||||||
|
registry1.docker.io (no validation on this right now)
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
(The image, id`s, tags and checksums)
|
||||||
|
[{“id”:
|
||||||
|
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
|
||||||
|
“checksum”:
|
||||||
|
“b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}]
|
||||||
|
|
||||||
|
**Return**:
|
||||||
|
|
||||||
|
HTTP 204
|
||||||
|
|
||||||
|
> **Note:** If push fails and they need to start again, what happens in the Docker Hub,
|
||||||
|
> there will already be a record for the namespace/name, but it will be
|
||||||
|
> initialized. Should we allow it, or mark as name already used? One edge
|
||||||
|
> case could be if someone pushes the same thing at the same time with two
|
||||||
|
> different shells.
|
||||||
|
|
||||||
|
If it's a retry on the Registry, Docker has a cookie (provided by the
|
||||||
|
registry after token validation). So the Docker Hub won't have to provide a
|
||||||
|
new token.
|
||||||
|
|
||||||
|
### Delete
|
||||||
|
|
||||||
|
If you need to delete something from the Docker Hub or registry, we need a
|
||||||
|
nice clean way to do that. Here is the workflow.
|
||||||
|
|
||||||
|
1. Docker contacts the Docker Hub to request a delete of a repository
|
||||||
|
`samalba/busybox` (authentication required with user credentials)
|
||||||
|
2. If authentication works and repository is valid, `samalba/busybox`
|
||||||
|
is marked as deleted and a temporary token is returned
|
||||||
|
3. Send a delete request to the registry for the repository (along with
|
||||||
|
the token)
|
||||||
|
4. Registry A contacts the Docker Hub to verify the token (token must
|
||||||
|
corresponds to the repository name)
|
||||||
|
5. Docker Hub validates the token. Registry A deletes the repository and
|
||||||
|
everything associated to it.
|
||||||
|
6. docker contacts the Docker Hub to let it know it was removed from the
|
||||||
|
registry, the Docker Hub removes all records from the database.
|
||||||
|
|
||||||
|
> **Note**:
|
||||||
|
> The Docker client should present an "Are you sure?" prompt to confirm
|
||||||
|
> the deletion before starting the process. Once it starts it can't be
|
||||||
|
> undone.
|
||||||
|
|
||||||
|
**API (deleting repository foo/bar):**
|
||||||
|
|
||||||
|
1. (Docker -> Docker Hub) DELETE /v1/repositories/foo/bar/
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Basic sdkjfskdjfhsdkjfh== X-Docker-Token:
|
||||||
|
true
|
||||||
|
|
||||||
|
**Action**:
|
||||||
|
|
||||||
|
- in Docker Hub, we make sure it is a valid repository, and set
|
||||||
|
to deleted (logically)
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
Empty
|
||||||
|
|
||||||
|
2. (Docker Hub -> Docker) 202 Accepted
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
WWW-Authenticate: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=delete
|
||||||
|
X-Docker-Endpoints: registry.docker.io [, registry2.docker.io]
|
||||||
|
# list of endpoints where this repo lives.
|
||||||
|
|
||||||
|
3. (Docker -> Registry) DELETE /v1/repositories/foo/bar/
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=delete
|
||||||
|
|
||||||
|
4. (Registry->Docker Hub) PUT /v1/repositories/foo/bar/auth
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=delete
|
||||||
|
|
||||||
|
**Action**:
|
||||||
|
|
||||||
|
- Docker Hub:
|
||||||
|
will invalidate the token.
|
||||||
|
- Registry:
|
||||||
|
deletes the repository (if token is approved)
|
||||||
|
|
||||||
|
5. (Registry -> Docker) 200 OK
|
||||||
|
|
||||||
|
200 If success 403 if forbidden 400 if bad request 404
|
||||||
|
if repository isn't found
|
||||||
|
|
||||||
|
6. (Docker -> Docker Hub) DELETE /v1/repositories/foo/bar/
|
||||||
|
|
||||||
|
**Headers**:
|
||||||
|
|
||||||
|
Authorization: Basic 123oislifjsldfj== X-Docker-Endpoints:
|
||||||
|
registry-1.docker.io (no validation on this right now)
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
Empty
|
||||||
|
|
||||||
|
**Return**:
|
||||||
|
|
||||||
|
HTTP 200
|
||||||
|
|
||||||
|
## How to use the Registry in standalone mode
|
||||||
|
|
||||||
|
The Docker Hub has two main purposes (along with its fancy social features):
|
||||||
|
|
||||||
|
- Resolve short names (to avoid passing absolute URLs all the time):
|
||||||
|
|
||||||
|
username/projectname ->
|
||||||
|
https://registry.docker.io/users/<username>/repositories/<projectname>/
|
||||||
|
team/projectname ->
|
||||||
|
https://registry.docker.io/team/<team>/repositories/<projectname>/
|
||||||
|
|
||||||
|
- Authenticate a user as a repos owner (for a central referenced
|
||||||
|
repository)
|
||||||
|
|
||||||
|
### Without a Docker Hub
|
||||||
|
|
||||||
|
Using the Registry without the Docker Hub can be useful to store the images
|
||||||
|
on a private network without having to rely on an external entity
|
||||||
|
controlled by Docker Inc.
|
||||||
|
|
||||||
|
In this case, the registry will be launched in a special mode
|
||||||
|
(-standalone? ne? -no-index?). In this mode, the only thing which changes is
|
||||||
|
that Registry will never contact the Docker Hub to verify a token. It will be
|
||||||
|
the Registry owner responsibility to authenticate the user who pushes
|
||||||
|
(or even pulls) an image using any mechanism (HTTP auth, IP based,
|
||||||
|
etc...).
|
||||||
|
|
||||||
|
In this scenario, the Registry is responsible for the security in case
|
||||||
|
of data corruption since the checksums are not delivered by a trusted
|
||||||
|
entity.
|
||||||
|
|
||||||
|
As hinted previously, a standalone registry can also be implemented by
|
||||||
|
any HTTP server handling GET/PUT requests (or even only GET requests if
|
||||||
|
no write access is necessary).
|
||||||
|
|
||||||
|
### With a Docker Hub
|
||||||
|
|
||||||
|
The Docker Hub data needed by the Registry are simple:
|
||||||
|
|
||||||
|
- Serve the checksums
|
||||||
|
- Provide and authorize a Token
|
||||||
|
|
||||||
|
In the scenario of a Registry running on a private network with the need
|
||||||
|
of centralizing and authorizing, it's easy to use a custom Docker Hub.
|
||||||
|
|
||||||
|
The only challenge will be to tell Docker to contact (and trust) this
|
||||||
|
custom Docker Hub. Docker will be configurable at some point to use a
|
||||||
|
specific Docker Hub, it'll be the private entity responsibility (basically
|
||||||
|
the organization who uses Docker in a private environment) to maintain
|
||||||
|
the Docker Hub and the Docker's configuration among its consumers.
|
||||||
|
|
||||||
|
## The API
|
||||||
|
|
||||||
|
The first version of the api is available here:
|
||||||
|
[https://github.com/jpetazzo/docker/blob/acd51ecea8f5d3c02b00a08176171c59442df8b3/docs/images-repositories-push-pull.md](https://github.com/jpetazzo/docker/blob/acd51ecea8f5d3c02b00a08176171c59442df8b3/docs/images-repositories-push-pull.md)
|
||||||
|
|
||||||
|
### Images
|
||||||
|
|
||||||
|
The format returned in the images is not defined here (for layer and
|
||||||
|
JSON), basically because Registry stores exactly the same kind of
|
||||||
|
information as Docker uses to manage them.
|
||||||
|
|
||||||
|
The format of ancestry is a line-separated list of image ids, in age
|
||||||
|
order, i.e. the image's parent is on the last line, the parent of the
|
||||||
|
parent on the next-to-last line, etc.; if the image has no parent, the
|
||||||
|
file is empty.
|
||||||
|
|
||||||
|
GET /v1/images/<image_id>/layer
|
||||||
|
PUT /v1/images/<image_id>/layer
|
||||||
|
GET /v1/images/<image_id>/json
|
||||||
|
PUT /v1/images/<image_id>/json
|
||||||
|
GET /v1/images/<image_id>/ancestry
|
||||||
|
PUT /v1/images/<image_id>/ancestry
|
||||||
|
|
||||||
|
### Users
|
||||||
|
|
||||||
|
### Create a user (Docker Hub)
|
||||||
|
|
||||||
|
POST /v1/users:
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
{"email": "[sam@docker.com](mailto:sam%40docker.com)",
|
||||||
|
"password": "toto42", "username": "foobar"`}
|
||||||
|
|
||||||
|
**Validation**:
|
||||||
|
|
||||||
|
- **username**: min 4 character, max 30 characters, must match the
|
||||||
|
regular expression [a-z0-9_].
|
||||||
|
- **password**: min 5 characters
|
||||||
|
|
||||||
|
**Valid**:
|
||||||
|
|
||||||
|
return HTTP 201
|
||||||
|
|
||||||
|
Errors: HTTP 400 (we should create error codes for possible errors) -
|
||||||
|
invalid json - missing field - wrong format (username, password, email,
|
||||||
|
etc) - forbidden name - name already exists
|
||||||
|
|
||||||
|
> **Note**:
|
||||||
|
> A user account will be valid only if the email has been validated (a
|
||||||
|
> validation link is sent to the email address).
|
||||||
|
|
||||||
|
### Update a user (Docker Hub)
|
||||||
|
|
||||||
|
PUT /v1/users/<username>
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
{"password": "toto"}
|
||||||
|
|
||||||
|
> **Note**:
|
||||||
|
> We can also update email address, if they do, they will need to reverify
|
||||||
|
> their new email address.
|
||||||
|
|
||||||
|
### Login (Docker Hub)
|
||||||
|
|
||||||
|
Does nothing else but asking for a user authentication. Can be used to
|
||||||
|
validate credentials. HTTP Basic Auth for now, maybe change in future.
|
||||||
|
|
||||||
|
GET /v1/users
|
||||||
|
|
||||||
|
**Return**:
|
||||||
|
- Valid: HTTP 200
|
||||||
|
- Invalid login: HTTP 401
|
||||||
|
- Account inactive: HTTP 403 Account is not Active
|
||||||
|
|
||||||
|
### Tags (Registry)
|
||||||
|
|
||||||
|
The Registry does not know anything about users. Even though
|
||||||
|
repositories are under usernames, it's just a namespace for the
|
||||||
|
registry. Allowing us to implement organizations or different namespaces
|
||||||
|
per user later, without modifying the Registry's API.
|
||||||
|
|
||||||
|
The following naming restrictions apply:
|
||||||
|
|
||||||
|
- Namespaces must match the same regular expression as usernames (See
|
||||||
|
4.2.1.)
|
||||||
|
- Repository names must match the regular expression [a-zA-Z0-9-_.]
|
||||||
|
|
||||||
|
### Get all tags:
|
||||||
|
|
||||||
|
GET /v1/repositories/<namespace>/<repository_name>/tags
|
||||||
|
|
||||||
|
**Return**: HTTP 200
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"layer": "9e89cc6f",
|
||||||
|
"name": "latest"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"layer": "b486531f",
|
||||||
|
"name": "0.1.1",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
**4.3.2 Read the content of a tag (resolve the image id):**
|
||||||
|
|
||||||
|
GET /v1/repositories/<namespace>/<repo_name>/tags/<tag>
|
||||||
|
|
||||||
|
**Return**:
|
||||||
|
|
||||||
|
"9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"
|
||||||
|
|
||||||
|
**4.3.3 Delete a tag (registry):**
|
||||||
|
|
||||||
|
DELETE /v1/repositories/<namespace>/<repo_name>/tags/<tag>
|
||||||
|
|
||||||
|
### 4.4 Images (Docker Hub)
|
||||||
|
|
||||||
|
For the Docker Hub to “resolve” the repository name to a Registry location,
|
||||||
|
it uses the X-Docker-Endpoints header. In other terms, this requests
|
||||||
|
always add a `X-Docker-Endpoints` to indicate the
|
||||||
|
location of the registry which hosts this repository.
|
||||||
|
|
||||||
|
**4.4.1 Get the images:**
|
||||||
|
|
||||||
|
GET /v1/repositories/<namespace>/<repo_name>/images
|
||||||
|
|
||||||
|
**Return**: HTTP 200
|
||||||
|
[{“id”:
|
||||||
|
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
|
||||||
|
“checksum”:
|
||||||
|
“[md5:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087](md5:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087)”}]
|
||||||
|
|
||||||
|
### Add/update the images:
|
||||||
|
|
||||||
|
You always add images, you never remove them.
|
||||||
|
|
||||||
|
PUT /v1/repositories/<namespace>/<repo_name>/images
|
||||||
|
|
||||||
|
**Body**:
|
||||||
|
|
||||||
|
[ {“id”:
|
||||||
|
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
|
||||||
|
“checksum”:
|
||||||
|
“sha256:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}
|
||||||
|
]
|
||||||
|
|
||||||
|
**Return**:
|
||||||
|
|
||||||
|
204
|
||||||
|
|
||||||
|
### Repositories
|
||||||
|
|
||||||
|
### Remove a Repository (Registry)
|
||||||
|
|
||||||
|
DELETE /v1/repositories/<namespace>/<repo_name>
|
||||||
|
|
||||||
|
Return 200 OK
|
||||||
|
|
||||||
|
### Remove a Repository (Docker Hub)
|
||||||
|
|
||||||
|
This starts the delete process. see 2.3 for more details.
|
||||||
|
|
||||||
|
DELETE /v1/repositories/<namespace>/<repo_name>
|
||||||
|
|
||||||
|
Return 202 OK
|
||||||
|
|
||||||
|
## Chaining Registries
|
||||||
|
|
||||||
|
It's possible to chain Registries server for several reasons:
|
||||||
|
|
||||||
|
- Load balancing
|
||||||
|
- Delegate the next request to another server
|
||||||
|
|
||||||
|
When a Registry is a reference for a repository, it should host the
|
||||||
|
entire images chain in order to avoid breaking the chain during the
|
||||||
|
download.
|
||||||
|
|
||||||
|
The Docker Hub and Registry use this mechanism to redirect on one or the
|
||||||
|
other.
|
||||||
|
|
||||||
|
Example with an image download:
|
||||||
|
|
||||||
|
On every request, a special header can be returned:
|
||||||
|
|
||||||
|
X-Docker-Endpoints: server1,server2
|
||||||
|
|
||||||
|
On the next request, the client will always pick a server from this
|
||||||
|
list.
|
||||||
|
|
||||||
|
## Authentication and authorization
|
||||||
|
|
||||||
|
### On the Docker Hub
|
||||||
|
|
||||||
|
The Docker Hub supports both “Basic” and “Token” challenges. Usually when
|
||||||
|
there is a `401 Unauthorized`, the Docker Hub replies
|
||||||
|
this:
|
||||||
|
|
||||||
|
401 Unauthorized
|
||||||
|
WWW-Authenticate: Basic realm="auth required",Token
|
||||||
|
|
||||||
|
You have 3 options:
|
||||||
|
|
||||||
|
1. Provide user credentials and ask for a token
|
||||||
|
|
||||||
|
**Header**:
|
||||||
|
|
||||||
|
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
|
||||||
|
X-Docker-Token: true
|
||||||
|
|
||||||
|
In this case, along with the 200 response, you'll get a new token
|
||||||
|
(if user auth is ok): If authorization isn't correct you get a 401
|
||||||
|
response. If account isn't active you will get a 403 response.
|
||||||
|
|
||||||
|
**Response**:
|
||||||
|
|
||||||
|
200 OK
|
||||||
|
X-Docker-Token: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=read
|
||||||
|
|
||||||
|
|
||||||
|
2. Provide user credentials only
|
||||||
|
|
||||||
|
**Header**:
|
||||||
|
|
||||||
|
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
|
||||||
|
|
||||||
|
3. Provide Token
|
||||||
|
|
||||||
|
**Header**:
|
||||||
|
|
||||||
|
Authorization: Token
|
||||||
|
signature=123abc,repository=”foo/bar”,access=read
|
||||||
|
|
||||||
|
### 6.2 On the Registry
|
||||||
|
|
||||||
|
The Registry only supports the Token challenge:
|
||||||
|
|
||||||
|
401 Unauthorized
|
||||||
|
WWW-Authenticate: Token
|
||||||
|
|
||||||
|
The only way is to provide a token on `401 Unauthorized`
|
||||||
|
responses:
|
||||||
|
|
||||||
|
Authorization: Token signature=123abc,repository="foo/bar",access=read
|
||||||
|
|
||||||
|
Usually, the Registry provides a Cookie when a Token verification
|
||||||
|
succeeded. Every time the Registry passes a Cookie, you have to pass it
|
||||||
|
back the same cookie.:
|
||||||
|
|
||||||
|
200 OK
|
||||||
|
Set-Cookie: session="wD/J7LqL5ctqw8haL10vgfhrb2Q=?foo=UydiYXInCnAxCi4=×tamp=RjEzNjYzMTQ5NDcuNDc0NjQzCi4="; Path=/; HttpOnly
|
||||||
|
|
||||||
|
Next request:
|
||||||
|
|
||||||
|
GET /(...)
|
||||||
|
Cookie: session="wD/J7LqL5ctqw8haL10vgfhrb2Q=?foo=UydiYXInCnAxCi4=×tamp=RjEzNjYzMTQ5NDcuNDc0NjQzCi4="
|
||||||
|
|
||||||
|
## Document version
|
||||||
|
|
||||||
|
- 1.0 : May 6th 2013 : initial release
|
||||||
|
- 1.1 : June 1st 2013 : Added Delete Repository and way to handle new
|
||||||
|
source namespace.
|
||||||
|
|
||||||
|
|||||||
@@ -10,50 +10,48 @@ parent = "mn_reference"
|
|||||||
|
|
||||||
# Dockerfile reference
|
# Dockerfile reference
|
||||||
|
|
||||||
Docker can build images automatically by reading the instructions from a
|
**Docker can build images automatically** by reading the instructions
|
||||||
`Dockerfile`. A `Dockerfile` is a text document that contains all the commands a
|
from a `Dockerfile`. A `Dockerfile` is a text document that contains all
|
||||||
user could call on the command line to assemble an image. Using `docker build`
|
the commands you would normally execute manually in order to build a
|
||||||
users can create an automated build that executes several command-line
|
Docker image. By calling `docker build` from your terminal, you can have
|
||||||
instructions in succession.
|
Docker build your image step by step, executing the instructions
|
||||||
|
successively.
|
||||||
|
|
||||||
This page describes the commands you can use in a `Dockerfile`. When you are
|
This page discusses the specifics of all the instructions you can use in your
|
||||||
done reading this page, refer to the [`Dockerfile` Best
|
`Dockerfile`. To further help you write a clear, readable, maintainable
|
||||||
Practices](/articles/dockerfile_best-practices) for a tip-oriented guide.
|
`Dockerfile`, we've also written a [`Dockerfile` Best Practices
|
||||||
|
guide](/articles/dockerfile_best-practices). Lastly, you can test your
|
||||||
|
Dockerfile knowledge with the [Dockerfile tutorial](/userguide/level1).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The [`docker build`](/reference/commandline/build/) command builds an image from
|
To [*build*](/reference/commandline/cli/#build) an image from a source repository,
|
||||||
a `Dockerfile` and a *context*. The build's context is the files at a specified
|
create a description file called `Dockerfile` at the root of your repository.
|
||||||
location `PATH` or `URL`. The `PATH` is a directory on your local filesystem.
|
This file will describe the steps to assemble the image.
|
||||||
The `URL` is a the location of a Git repository.
|
|
||||||
|
|
||||||
A context is processed recursively. So, a `PATH` includes any subdirectories and
|
Then call `docker build` with the path of your source repository as the argument
|
||||||
the `URL` includes the repository and its submodules. A simple build command
|
(for example, `.`):
|
||||||
that uses the current directory as context:
|
|
||||||
|
|
||||||
$ docker build .
|
$ docker build .
|
||||||
Sending build context to Docker daemon 6.51 MB
|
|
||||||
...
|
|
||||||
|
|
||||||
The build is run by the Docker daemon, not by the CLI. The first thing a build
|
The path to the source repository defines where to find the *context* of
|
||||||
process does is send the entire context (recursively) to the daemon. In most
|
the build. The build is run by the Docker daemon, not by the CLI, so the
|
||||||
cases, it's best to start with an empty directory as context and keep your
|
whole context must be transferred to the daemon. The Docker CLI reports
|
||||||
Dockerfile in that directory. Add only the files needed for building the
|
"Sending build context to Docker daemon" when the context is sent to the daemon.
|
||||||
Dockerfile.
|
|
||||||
|
|
||||||
>**Warning**: Do not use your root directory, `/`, as the `PATH` as it causes
|
> **Warning**
|
||||||
>the build to transfer the entire contents of your hard drive to the Docker
|
> Avoid using your root directory, `/`, as the root of the source repository. The
|
||||||
>daemon.
|
> `docker build` command will use whatever directory contains the Dockerfile as the build
|
||||||
|
> context (including all of its subdirectories). The build context will be sent to the
|
||||||
|
> Docker daemon before building the image, which means if you use `/` as the source
|
||||||
|
> repository, the entire contents of your hard drive will get sent to the daemon (and
|
||||||
|
> thus to the machine running the daemon). You probably don't want that.
|
||||||
|
|
||||||
To use a file in the build context, the `Dockerfile` refers to the file with
|
In most cases, it's best to put each Dockerfile in an empty directory. Then,
|
||||||
an instruction, for example, a `COPY` instruction. To increase the build's
|
only add the files needed for building the Dockerfile to the directory. To
|
||||||
performance, exclude files and directories by adding a `.dockerignore` file to
|
increase the build's performance, you can exclude files and directories by
|
||||||
the context directory. For information about how to [create a `.dockerignore`
|
adding a `.dockerignore` file to the directory. For information about how to
|
||||||
file](#dockerignore-file) see the documentation on this page.
|
[create a `.dockerignore` file](#dockerignore-file) on this page.
|
||||||
|
|
||||||
Traditionally, the `Dockerfile` is called `Dockerfile` and located in the root
|
|
||||||
of the context. You use the `-f` flag with `docker build` to point to a Dockerfile
|
|
||||||
anywhere in your file system.
|
|
||||||
|
|
||||||
You can specify a repository and tag at which to save the new image if
|
You can specify a repository and tag at which to save the new image if
|
||||||
the build succeeds:
|
the build succeeds:
|
||||||
@@ -102,7 +100,7 @@ be UPPERCASE in order to distinguish them from arguments more easily.
|
|||||||
|
|
||||||
Docker runs the instructions in a `Dockerfile` in order. **The
|
Docker runs the instructions in a `Dockerfile` in order. **The
|
||||||
first instruction must be \`FROM\`** in order to specify the [*Base
|
first instruction must be \`FROM\`** in order to specify the [*Base
|
||||||
Image*](/reference/glossary/#base-image) from which you are building.
|
Image*](/terms/image/#base-image) from which you are building.
|
||||||
|
|
||||||
Docker will treat lines that *begin* with `#` as a
|
Docker will treat lines that *begin* with `#` as a
|
||||||
comment. A `#` marker anywhere else in the line will
|
comment. A `#` marker anywhere else in the line will
|
||||||
@@ -116,6 +114,12 @@ images.
|
|||||||
|
|
||||||
### Environment replacement
|
### Environment replacement
|
||||||
|
|
||||||
|
> **Note**: prior to 1.3, `Dockerfile` environment variables were handled
|
||||||
|
> similarly, in that they would be replaced as described below. However, there
|
||||||
|
> was no formal definition on as to which instructions handled environment
|
||||||
|
> replacement at the time. After 1.3 this behavior will be preserved and
|
||||||
|
> canonical.
|
||||||
|
|
||||||
Environment variables (declared with [the `ENV` statement](#env)) can also be
|
Environment variables (declared with [the `ENV` statement](#env)) can also be
|
||||||
used in certain instructions as variables to be interpreted by the
|
used in certain instructions as variables to be interpreted by the
|
||||||
`Dockerfile`. Escapes are also handled for including variable-like syntax
|
`Dockerfile`. Escapes are also handled for including variable-like syntax
|
||||||
@@ -162,13 +166,13 @@ The instructions that handle environment variables in the `Dockerfile` are:
|
|||||||
the instructions above.
|
the instructions above.
|
||||||
|
|
||||||
Environment variable substitution will use the same value for each variable
|
Environment variable substitution will use the same value for each variable
|
||||||
throughout the entire command. In other words, in this example:
|
throughout the entire command. In other words, in this example:
|
||||||
|
|
||||||
ENV abc=hello
|
ENV abc=hello
|
||||||
ENV abc=bye def=$abc
|
ENV abc=bye def=$abc
|
||||||
ENV ghi=$abc
|
ENV ghi=$abc
|
||||||
|
|
||||||
will result in `def` having a value of `hello`, not `bye`. However,
|
will result in `def` having a value of `hello`, not `bye`. However,
|
||||||
`ghi` will have a value of `bye` because it is not part of the same command
|
`ghi` will have a value of `bye` because it is not part of the same command
|
||||||
that set `abc` to `bye`.
|
that set `abc` to `bye`.
|
||||||
|
|
||||||
@@ -187,7 +191,7 @@ expansion) is done using Go's
|
|||||||
|
|
||||||
You can specify exceptions to exclusion rules. To do this, simply prefix a
|
You can specify exceptions to exclusion rules. To do this, simply prefix a
|
||||||
pattern with an `!` (exclamation mark) in the same way you would in a
|
pattern with an `!` (exclamation mark) in the same way you would in a
|
||||||
`.gitignore` file. Currently there is no support for regular expressions.
|
`.gitignore` file. Currently there is no support for regular expressions.
|
||||||
Formats like `[^temp*]` are ignored.
|
Formats like `[^temp*]` are ignored.
|
||||||
|
|
||||||
The following is an example `.dockerignore` file:
|
The following is an example `.dockerignore` file:
|
||||||
@@ -247,7 +251,7 @@ Or
|
|||||||
|
|
||||||
FROM <image>@<digest>
|
FROM <image>@<digest>
|
||||||
|
|
||||||
The `FROM` instruction sets the [*Base Image*](/reference/glossary/#base-image)
|
The `FROM` instruction sets the [*Base Image*](/terms/image/#base-image)
|
||||||
for subsequent instructions. As such, a valid `Dockerfile` must have `FROM` as
|
for subsequent instructions. As such, a valid `Dockerfile` must have `FROM` as
|
||||||
its first instruction. The image can be any valid image – it is especially easy
|
its first instruction. The image can be any valid image – it is especially easy
|
||||||
to start by **pulling an image** from the [*Public Repositories*](
|
to start by **pulling an image** from the [*Public Repositories*](
|
||||||
@@ -306,7 +310,7 @@ commands using a base image that does not contain `/bin/sh`.
|
|||||||
|
|
||||||
The cache for `RUN` instructions isn't invalidated automatically during
|
The cache for `RUN` instructions isn't invalidated automatically during
|
||||||
the next build. The cache for an instruction like
|
the next build. The cache for an instruction like
|
||||||
`RUN apt-get dist-upgrade -y` will be reused during the next build. The
|
`RUN apt-get dist-upgrade -y` will be reused during the next build. The
|
||||||
cache for `RUN` instructions can be invalidated by using the `--no-cache`
|
cache for `RUN` instructions can be invalidated by using the `--no-cache`
|
||||||
flag, for example `docker build --no-cache`.
|
flag, for example `docker build --no-cache`.
|
||||||
|
|
||||||
@@ -884,9 +888,9 @@ The `VOLUME` instruction creates a mount point with the specified name
|
|||||||
and marks it as holding externally mounted volumes from native host or other
|
and marks it as holding externally mounted volumes from native host or other
|
||||||
containers. The value can be a JSON array, `VOLUME ["/var/log/"]`, or a plain
|
containers. The value can be a JSON array, `VOLUME ["/var/log/"]`, or a plain
|
||||||
string with multiple arguments, such as `VOLUME /var/log` or `VOLUME /var/log
|
string with multiple arguments, such as `VOLUME /var/log` or `VOLUME /var/log
|
||||||
/var/db`. For more information/examples and mounting instructions via the
|
/var/db`. For more information/examples and mounting instructions via the
|
||||||
Docker client, refer to
|
Docker client, refer to
|
||||||
[*Share Directories via Volumes*](/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume)
|
[*Share Directories via Volumes*](/userguide/dockervolumes/#volume)
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
The `docker run` command initializes the newly created volume with any data
|
The `docker run` command initializes the newly created volume with any data
|
||||||
@@ -902,10 +906,6 @@ This Dockerfile results in an image that causes `docker run`, to
|
|||||||
create a new mount point at `/myvol` and copy the `greeting` file
|
create a new mount point at `/myvol` and copy the `greeting` file
|
||||||
into the newly created volume.
|
into the newly created volume.
|
||||||
|
|
||||||
> **Note**:
|
|
||||||
> If any build steps change the data within the volume after it has been
|
|
||||||
> declared, those changes will be discarded.
|
|
||||||
|
|
||||||
> **Note**:
|
> **Note**:
|
||||||
> The list is parsed as a JSON array, which means that
|
> The list is parsed as a JSON array, which means that
|
||||||
> you must use double-quotes (") around words not single-quotes (').
|
> you must use double-quotes (") around words not single-quotes (').
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ parent = "smn_cli"
|
|||||||
|
|
||||||
# Using the command line
|
# Using the command line
|
||||||
|
|
||||||
|
> **Note:** If you are using a remote Docker daemon, such as Boot2Docker,
|
||||||
|
> then _do not_ type the `sudo` before the `docker` commands shown in the
|
||||||
|
> documentation's examples.
|
||||||
|
|
||||||
To list available commands, either run `docker` with no parameters
|
To list available commands, either run `docker` with no parameters
|
||||||
or execute `docker help`:
|
or execute `docker help`:
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ aufs (advanced multi layered unification filesystem) is a Linux [filesystem](#fi
|
|||||||
Docker supports as a storage backend. It implements the
|
Docker supports as a storage backend. It implements the
|
||||||
[union mount](http://en.wikipedia.org/wiki/Union_mount) for Linux file systems.
|
[union mount](http://en.wikipedia.org/wiki/Union_mount) for Linux file systems.
|
||||||
|
|
||||||
## Base image
|
|
||||||
|
|
||||||
An image that has no parent is a **base image**.
|
|
||||||
|
|
||||||
## boot2docker
|
## boot2docker
|
||||||
|
|
||||||
[boot2docker](http://boot2docker.io/) is a lightweight Linux distribution made
|
[boot2docker](http://boot2docker.io/) is a lightweight Linux distribution made
|
||||||
|
|||||||
@@ -25,16 +25,8 @@ driver sends the following metadata in the structured log message:
|
|||||||
| `container_name` | The container name at the time it was started. If you use `docker rename` to rename a container, the new name is not reflected in the journal entries. |
|
| `container_name` | The container name at the time it was started. If you use `docker rename` to rename a container, the new name is not reflected in the journal entries. |
|
||||||
| `source` | `stdout` or `stderr` |
|
| `source` | `stdout` or `stderr` |
|
||||||
|
|
||||||
The `docker logs` command is not available for this logging driver.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Some options are supported by specifying `--log-opt` as many times as needed:
|
|
||||||
|
|
||||||
- `fluentd-address`: specify `host:port` to connect `localhost:24224`
|
|
||||||
- `fluentd-tag`: specify tag for fluentd message, which interpret some markup, ex `{{.ID}}`, `{{.FullID}}` or `{{.Name}}` `docker.{{.ID}}`
|
|
||||||
|
|
||||||
|
|
||||||
Configure the default logging driver by passing the
|
Configure the default logging driver by passing the
|
||||||
`--log-driver` option to the Docker daemon:
|
`--log-driver` option to the Docker daemon:
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,129 @@
|
|||||||
<!--[metadata]>
|
<!--[metadata]>
|
||||||
+++
|
+++
|
||||||
title = "Logging Drivers"
|
title = "Configure logging drivers"
|
||||||
description = "Logging Drivers"
|
description = "Configure logging driver."
|
||||||
keywords = [" docker, logging, driver"]
|
keywords = ["Fluentd, docker, logging, driver"]
|
||||||
[menu.main]
|
[menu.main]
|
||||||
parent = "smn_administrate"
|
parent = "smn_logging"
|
||||||
identifier = "smn_logging"
|
|
||||||
weight=8
|
|
||||||
+++
|
+++
|
||||||
<![end-metadata]-->
|
<![end-metadata]-->
|
||||||
|
|
||||||
|
|
||||||
# Logging Drivers
|
# Configure logging drivers
|
||||||
|
|
||||||
* [Configuring logging drivers](overview)
|
The container can have a different logging driver than the Docker daemon. Use
|
||||||
* [Fluentd logging driver](fluentd)
|
the `--log-driver=VALUE` with the `docker run` command to configure the
|
||||||
* [Journald logging driver](journald)
|
container's logging driver. The following options are supported:
|
||||||
|
|
||||||
|
| `none` | Disables any logging for the container. `docker logs` won't be available with this driver. |
|
||||||
|
|-------------|-------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `json-file` | Default logging driver for Docker. Writes JSON messages to file. |
|
||||||
|
| `syslog` | Syslog logging driver for Docker. Writes log messages to syslog. |
|
||||||
|
| `journald` | Journald logging driver for Docker. Writes log messages to `journald`. |
|
||||||
|
| `gelf` | Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. |
|
||||||
|
| `fluentd` | Fluentd logging driver for Docker. Writes log messages to `fluentd` (forward input). |
|
||||||
|
|
||||||
|
The `docker logs`command is available only for the `json-file` logging driver.
|
||||||
|
|
||||||
|
### The json-file options
|
||||||
|
|
||||||
|
The following logging options are supported for the `json-file` logging driver:
|
||||||
|
|
||||||
|
--log-opt max-size=[0-9+][k|m|g]
|
||||||
|
--log-opt max-file=[0-9+]
|
||||||
|
|
||||||
|
Logs that reach `max-size` are rolled over. You can set the size in kilobytes(k), megabytes(m), or gigabytes(g). eg `--log-opt max-size=50m`. If `max-size` is not set, then logs are not rolled over.
|
||||||
|
|
||||||
|
|
||||||
|
`max-file` specifies the maximum number of files that a log is rolled over before being discarded. eg `--log-opt max-file=100`. If `max-size` is not set, then `max-file` is not honored.
|
||||||
|
|
||||||
|
If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file.
|
||||||
|
|
||||||
|
### The syslog options
|
||||||
|
|
||||||
|
The following logging options are supported for the `syslog` logging driver:
|
||||||
|
|
||||||
|
--log-opt syslog-address=[tcp|udp]://host:port
|
||||||
|
--log-opt syslog-address=unix://path
|
||||||
|
--log-opt syslog-facility=daemon
|
||||||
|
--log-opt syslog-tag="mailer"
|
||||||
|
|
||||||
|
`syslog-address` specifies the remote syslog server address where the driver connects to.
|
||||||
|
If not specified it defaults to the local unix socket of the running system.
|
||||||
|
If transport is either `tcp` or `udp` and `port` is not specified it defaults to `514`
|
||||||
|
The following example shows how to have the `syslog` driver connect to a `syslog`
|
||||||
|
remote server at `192.168.0.42` on port `123`
|
||||||
|
|
||||||
|
$ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123
|
||||||
|
|
||||||
|
The `syslog-facility` option configures the syslog facility. By default, the system uses the
|
||||||
|
`daemon` value. To override this behavior, you can provide an integer of 0 to 23 or any of
|
||||||
|
the following named facilities:
|
||||||
|
|
||||||
|
* `kern`
|
||||||
|
* `user`
|
||||||
|
* `mail`
|
||||||
|
* `daemon`
|
||||||
|
* `auth`
|
||||||
|
* `syslog`
|
||||||
|
* `lpr`
|
||||||
|
* `news`
|
||||||
|
* `uucp`
|
||||||
|
* `cron`
|
||||||
|
* `authpriv`
|
||||||
|
* `ftp`
|
||||||
|
* `local0`
|
||||||
|
* `local1`
|
||||||
|
* `local2`
|
||||||
|
* `local3`
|
||||||
|
* `local4`
|
||||||
|
* `local5`
|
||||||
|
* `local6`
|
||||||
|
* `local7`
|
||||||
|
|
||||||
|
The `syslog-tag` specifies a tag that identifies the container's syslog messages. By default,
|
||||||
|
the system uses the first 12 characters of the container id. To override this behavior, specify
|
||||||
|
a `syslog-tag` option
|
||||||
|
|
||||||
|
## Specify journald options
|
||||||
|
|
||||||
|
The `journald` logging driver stores the container id in the journal's `CONTAINER_ID` field. For detailed information on
|
||||||
|
working with this logging driver, see [the journald logging driver](/reference/logging/journald/)
|
||||||
|
reference documentation.
|
||||||
|
|
||||||
|
## Specify gelf options
|
||||||
|
|
||||||
|
The GELF logging driver supports the following options:
|
||||||
|
|
||||||
|
--log-opt gelf-address=udp://host:port
|
||||||
|
--log-opt gelf-tag="database"
|
||||||
|
|
||||||
|
The `gelf-address` option specifies the remote GELF server address that the
|
||||||
|
driver connects to. Currently, only `udp` is supported as the transport and you must
|
||||||
|
specify a `port` value. The following example shows how to connect the `gelf`
|
||||||
|
driver to a GELF remote server at `192.168.0.42` on port `12201`
|
||||||
|
|
||||||
|
$ docker run --log-driver=gelf --log-opt gelf-address=udp://192.168.0.42:12201
|
||||||
|
|
||||||
|
The `gelf-tag` option specifies a tag for easy container identification.
|
||||||
|
|
||||||
|
## Specify fluentd options
|
||||||
|
|
||||||
|
You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd logging driver options.
|
||||||
|
|
||||||
|
- `fluentd-address`: specify `host:port` to connect [localhost:24224]
|
||||||
|
- `fluentd-tag`: specify tag for `fluentd` message,
|
||||||
|
|
||||||
|
When specifying a `fluentd-tag` value, you can use the following markup tags:
|
||||||
|
|
||||||
|
- `{{.ID}}`: short container id (12 characters)
|
||||||
|
- `{{.FullID}}`: full container id
|
||||||
|
- `{{.Name}}`: container name
|
||||||
|
|
||||||
|
For example, to specify both additional options:
|
||||||
|
|
||||||
|
`docker run --log-driver=fluentd --log-opt fluentd-address=localhost:24224 --log-opt fluentd-tag=docker.{{.Name}}`
|
||||||
|
|
||||||
|
If container cannot connect to the Fluentd daemon on the specified address,
|
||||||
|
the container stops immediately. For detailed information on working with this
|
||||||
|
logging driver, see [the fluentd logging driver](/reference/logging/fluentd/)
|
||||||
|
|||||||
@@ -1,130 +0,0 @@
|
|||||||
<!--[metadata]>
|
|
||||||
+++
|
|
||||||
title = "Configuring Logging Drivers"
|
|
||||||
description = "Configure logging driver."
|
|
||||||
keywords = ["Fluentd, docker, logging, driver"]
|
|
||||||
[menu.main]
|
|
||||||
parent = "smn_logging"
|
|
||||||
weight=-1
|
|
||||||
+++
|
|
||||||
<![end-metadata]-->
|
|
||||||
|
|
||||||
|
|
||||||
# Configure logging drivers
|
|
||||||
|
|
||||||
The container can have a different logging driver than the Docker daemon. Use
|
|
||||||
the `--log-driver=VALUE` with the `docker run` command to configure the
|
|
||||||
container's logging driver. The following options are supported:
|
|
||||||
|
|
||||||
| `none` | Disables any logging for the container. `docker logs` won't be available with this driver. |
|
|
||||||
|-------------|-------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| `json-file` | Default logging driver for Docker. Writes JSON messages to file. |
|
|
||||||
| `syslog` | Syslog logging driver for Docker. Writes log messages to syslog. |
|
|
||||||
| `journald` | Journald logging driver for Docker. Writes log messages to `journald`. |
|
|
||||||
| `gelf` | Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. |
|
|
||||||
| `fluentd` | Fluentd logging driver for Docker. Writes log messages to `fluentd` (forward input). |
|
|
||||||
|
|
||||||
The `docker logs`command is available only for the `json-file` logging driver.
|
|
||||||
|
|
||||||
### The json-file options
|
|
||||||
|
|
||||||
The following logging options are supported for the `json-file` logging driver:
|
|
||||||
|
|
||||||
--log-opt max-size=[0-9+][k|m|g]
|
|
||||||
--log-opt max-file=[0-9+]
|
|
||||||
|
|
||||||
Logs that reach `max-size` are rolled over. You can set the size in kilobytes(k), megabytes(m), or gigabytes(g). eg `--log-opt max-size=50m`. If `max-size` is not set, then logs are not rolled over.
|
|
||||||
|
|
||||||
|
|
||||||
`max-file` specifies the maximum number of files that a log is rolled over before being discarded. eg `--log-opt max-file=100`. If `max-size` is not set, then `max-file` is not honored.
|
|
||||||
|
|
||||||
If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file.
|
|
||||||
|
|
||||||
### The syslog options
|
|
||||||
|
|
||||||
The following logging options are supported for the `syslog` logging driver:
|
|
||||||
|
|
||||||
--log-opt syslog-address=[tcp|udp]://host:port
|
|
||||||
--log-opt syslog-address=unix://path
|
|
||||||
--log-opt syslog-facility=daemon
|
|
||||||
--log-opt syslog-tag="mailer"
|
|
||||||
|
|
||||||
`syslog-address` specifies the remote syslog server address where the driver connects to.
|
|
||||||
If not specified it defaults to the local unix socket of the running system.
|
|
||||||
If transport is either `tcp` or `udp` and `port` is not specified it defaults to `514`
|
|
||||||
The following example shows how to have the `syslog` driver connect to a `syslog`
|
|
||||||
remote server at `192.168.0.42` on port `123`
|
|
||||||
|
|
||||||
$ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123
|
|
||||||
|
|
||||||
The `syslog-facility` option configures the syslog facility. By default, the system uses the
|
|
||||||
`daemon` value. To override this behavior, you can provide an integer of 0 to 23 or any of
|
|
||||||
the following named facilities:
|
|
||||||
|
|
||||||
* `kern`
|
|
||||||
* `user`
|
|
||||||
* `mail`
|
|
||||||
* `daemon`
|
|
||||||
* `auth`
|
|
||||||
* `syslog`
|
|
||||||
* `lpr`
|
|
||||||
* `news`
|
|
||||||
* `uucp`
|
|
||||||
* `cron`
|
|
||||||
* `authpriv`
|
|
||||||
* `ftp`
|
|
||||||
* `local0`
|
|
||||||
* `local1`
|
|
||||||
* `local2`
|
|
||||||
* `local3`
|
|
||||||
* `local4`
|
|
||||||
* `local5`
|
|
||||||
* `local6`
|
|
||||||
* `local7`
|
|
||||||
|
|
||||||
The `syslog-tag` specifies a tag that identifies the container's syslog messages. By default,
|
|
||||||
the system uses the first 12 characters of the container id. To override this behavior, specify
|
|
||||||
a `syslog-tag` option
|
|
||||||
|
|
||||||
## Specify journald options
|
|
||||||
|
|
||||||
The `journald` logging driver stores the container id in the journal's `CONTAINER_ID` field. For detailed information on
|
|
||||||
working with this logging driver, see [the journald logging driver](/reference/logging/journald/)
|
|
||||||
reference documentation.
|
|
||||||
|
|
||||||
## Specify gelf options
|
|
||||||
|
|
||||||
The GELF logging driver supports the following options:
|
|
||||||
|
|
||||||
--log-opt gelf-address=udp://host:port
|
|
||||||
--log-opt gelf-tag="database"
|
|
||||||
|
|
||||||
The `gelf-address` option specifies the remote GELF server address that the
|
|
||||||
driver connects to. Currently, only `udp` is supported as the transport and you must
|
|
||||||
specify a `port` value. The following example shows how to connect the `gelf`
|
|
||||||
driver to a GELF remote server at `192.168.0.42` on port `12201`
|
|
||||||
|
|
||||||
$ docker run --log-driver=gelf --log-opt gelf-address=udp://192.168.0.42:12201
|
|
||||||
|
|
||||||
The `gelf-tag` option specifies a tag for easy container identification.
|
|
||||||
|
|
||||||
## Specify fluentd options
|
|
||||||
|
|
||||||
You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd logging driver options.
|
|
||||||
|
|
||||||
- `fluentd-address`: specify `host:port` to connect [localhost:24224]
|
|
||||||
- `fluentd-tag`: specify tag for `fluentd` message,
|
|
||||||
|
|
||||||
When specifying a `fluentd-tag` value, you can use the following markup tags:
|
|
||||||
|
|
||||||
- `{{.ID}}`: short container id (12 characters)
|
|
||||||
- `{{.FullID}}`: full container id
|
|
||||||
- `{{.Name}}`: container name
|
|
||||||
|
|
||||||
For example, to specify both additional options:
|
|
||||||
|
|
||||||
`docker run --log-driver=fluentd --log-opt fluentd-address=localhost:24224 --log-opt fluentd-tag=docker.{{.Name}}`
|
|
||||||
|
|
||||||
If container cannot connect to the Fluentd daemon on the specified address,
|
|
||||||
the container stops immediately. For detailed information on working with this
|
|
||||||
logging driver, see [the fluentd logging driver](/reference/logging/fluentd/)
|
|
||||||
@@ -19,11 +19,11 @@ parent = "mn_reference"
|
|||||||
**Docker runs processes in isolated containers**. When an operator
|
**Docker runs processes in isolated containers**. When an operator
|
||||||
executes `docker run`, she starts a process with its own file system,
|
executes `docker run`, she starts a process with its own file system,
|
||||||
its own networking, and its own isolated process tree. The
|
its own networking, and its own isolated process tree. The
|
||||||
[*Image*](/reference/glossary/#image) which starts the process may define
|
[*Image*](/terms/image/#image) which starts the process may define
|
||||||
defaults related to the binary to run, the networking to expose, and
|
defaults related to the binary to run, the networking to expose, and
|
||||||
more, but `docker run` gives final control to the operator who starts
|
more, but `docker run` gives final control to the operator who starts
|
||||||
the container from the image. That's the main reason
|
the container from the image. That's the main reason
|
||||||
[*run*](/reference/commandline/run) has more options than any
|
[*run*](/reference/commandline/cli/#run) has more options than any
|
||||||
other `docker` command.
|
other `docker` command.
|
||||||
|
|
||||||
## General form
|
## General form
|
||||||
@@ -87,7 +87,7 @@ In detached mode (`-d=true` or just `-d`), all I/O should be done
|
|||||||
through network connections or shared volumes because the container is
|
through network connections or shared volumes because the container is
|
||||||
no longer listening to the command line where you executed `docker run`.
|
no longer listening to the command line where you executed `docker run`.
|
||||||
You can reattach to a detached container with `docker`
|
You can reattach to a detached container with `docker`
|
||||||
[*attach*](/reference/commandline/attach). If you choose to run a
|
[*attach*](/reference/commandline/cli/#attach). If you choose to run a
|
||||||
container in the detached mode, then you cannot use the `--rm` option.
|
container in the detached mode, then you cannot use the `--rm` option.
|
||||||
|
|
||||||
### Foreground
|
### Foreground
|
||||||
@@ -360,8 +360,8 @@ Using the `--restart` flag on Docker run you can specify a restart policy for
|
|||||||
how a container should or should not be restarted on exit.
|
how a container should or should not be restarted on exit.
|
||||||
|
|
||||||
When a restart policy is active on a container, it will be shown as either `Up`
|
When a restart policy is active on a container, it will be shown as either `Up`
|
||||||
or `Restarting` in [`docker ps`](/reference/commandline/ps). It can also be
|
or `Restarting` in [`docker ps`](/reference/commandline/cli/#ps). It can also be
|
||||||
useful to use [`docker events`](/reference/commandline/events) to see the
|
useful to use [`docker events`](/reference/commandline/cli/#events) to see the
|
||||||
restart policy in effect.
|
restart policy in effect.
|
||||||
|
|
||||||
Docker supports the following restart policies:
|
Docker supports the following restart policies:
|
||||||
@@ -417,7 +417,7 @@ You can specify the maximum amount of times Docker will try to restart the
|
|||||||
container when using the **on-failure** policy. The default is that Docker
|
container when using the **on-failure** policy. The default is that Docker
|
||||||
will try forever to restart the container. The number of (attempted) restarts
|
will try forever to restart the container. The number of (attempted) restarts
|
||||||
for a container can be obtained via [`docker inspect`](
|
for a container can be obtained via [`docker inspect`](
|
||||||
/reference/commandline/inspect). For example, to get the number of restarts
|
/reference/commandline/cli/#inspect). For example, to get the number of restarts
|
||||||
for container "my-container";
|
for container "my-container";
|
||||||
|
|
||||||
$ docker inspect -f "{{ .RestartCount }}" my-container
|
$ docker inspect -f "{{ .RestartCount }}" my-container
|
||||||
@@ -491,7 +491,9 @@ command:
|
|||||||
|
|
||||||
$ docker run --security-opt label:type:svirt_apache_t -i -t centos bash
|
$ docker run --security-opt label:type:svirt_apache_t -i -t centos bash
|
||||||
|
|
||||||
> **Note**: You would have to write policy defining a `svirt_apache_t` type.
|
Note:
|
||||||
|
|
||||||
|
You would have to write policy defining a `svirt_apache_t` type.
|
||||||
|
|
||||||
## Specifying custom cgroups
|
## Specifying custom cgroups
|
||||||
|
|
||||||
@@ -505,18 +507,16 @@ parent group.
|
|||||||
The operator can also adjust the performance parameters of the
|
The operator can also adjust the performance parameters of the
|
||||||
container:
|
container:
|
||||||
|
|
||||||
| Option | Description |
|
-m, --memory="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||||
|----------------------------|---------------------------------------------------------------------------------------------|
|
--memory-swap="": Total memory limit (memory + swap, format: <number><optional unit>, where unit = b, k, m or g)
|
||||||
| `-m`, `--memory="" ` | Memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g) |
|
-c, --cpu-shares=0: CPU shares (relative weight)
|
||||||
| `--memory-swap=""` | Total memory limit (memory + swap, format: `<number>[<unit>]`, where unit = b, k, m or g) |
|
--cpu-period=0: Limit the CPU CFS (Completely Fair Scheduler) period
|
||||||
| `-c`, `--cpu-shares=0` | CPU shares (relative weight) |
|
--cpuset-cpus="": CPUs in which to allow execution (0-3, 0,1)
|
||||||
| `--cpu-period=0` | Limit the CPU CFS (Completely Fair Scheduler) period |
|
--cpuset-mems="": Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
|
||||||
| `--cpuset-cpus="" ` | CPUs in which to allow execution (0-3, 0,1) |
|
--cpu-quota=0: Limit the CPU CFS (Completely Fair Scheduler) quota
|
||||||
| `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. |
|
--blkio-weight=0: Block IO weight (relative weight) accepts a weight value between 10 and 1000.
|
||||||
| `--cpu-quota=0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
|
--oom-kill-disable=true|false: Whether to disable OOM Killer for the container or not.
|
||||||
| `--blkio-weight=0` | Block IO weight (relative weight) accepts a weight value between 10 and 1000. |
|
--memory-swappiness="": Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
|
||||||
| `--oom-kill-disable=false` | Whether to disable OOM Killer for the container or not. |
|
|
||||||
| `--memory-swappiness="" ` | Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. |
|
|
||||||
|
|
||||||
### Memory constraints
|
### Memory constraints
|
||||||
|
|
||||||
@@ -568,7 +568,7 @@ We have four ways to set memory usage:
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
### Examples
|
Examples:
|
||||||
|
|
||||||
$ docker run -ti ubuntu:14.04 /bin/bash
|
$ docker run -ti ubuntu:14.04 /bin/bash
|
||||||
|
|
||||||
@@ -600,6 +600,8 @@ Only disable the OOM killer on containers where you have also set the
|
|||||||
running out of memory and require killing the host's system processes to free
|
running out of memory and require killing the host's system processes to free
|
||||||
memory.
|
memory.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
The following example limits the memory to 100M and disables the OOM killer for
|
The following example limits the memory to 100M and disables the OOM killer for
|
||||||
this container:
|
this container:
|
||||||
|
|
||||||
@@ -892,7 +894,7 @@ familiar with using LXC directly.
|
|||||||
> you can use `--lxc-conf` to set a container's IP address, but this will not be
|
> you can use `--lxc-conf` to set a container's IP address, but this will not be
|
||||||
> reflected in the `/etc/hosts` file.
|
> reflected in the `/etc/hosts` file.
|
||||||
|
|
||||||
## Logging drivers (--log-driver)
|
# Logging drivers (--log-driver)
|
||||||
|
|
||||||
The container can have a different logging driver than the Docker daemon. Use
|
The container can have a different logging driver than the Docker daemon. Use
|
||||||
the `--log-driver=VALUE` with the `docker run` command to configure the
|
the `--log-driver=VALUE` with the `docker run` command to configure the
|
||||||
@@ -908,8 +910,17 @@ container's logging driver. The following options are supported:
|
|||||||
|
|
||||||
The `docker logs`command is available only for the `json-file` logging
|
The `docker logs`command is available only for the `json-file` logging
|
||||||
driver. For detailed information on working with logging drivers, see
|
driver. For detailed information on working with logging drivers, see
|
||||||
[Configure a logging driver](/reference/logging/overview/).
|
[Configure a logging driver](reference/logging/).
|
||||||
|
|
||||||
|
#### Logging driver: fluentd
|
||||||
|
|
||||||
|
Fluentd logging driver for Docker. Writes log messages to fluentd (forward input). `docker logs`
|
||||||
|
command is not available for this logging driver.
|
||||||
|
|
||||||
|
Some options are supported by specifying `--log-opt` as many as needed, like `--log-opt fluentd-address=localhost:24224 --log-opt fluentd-tag=docker.{{.Name}}`.
|
||||||
|
|
||||||
|
- `fluentd-address`: specify `host:port` to connect [localhost:24224]
|
||||||
|
- `fluentd-tag`: specify tag for fluentd message, which interpret some markup, ex `{{.ID}}`, `{{.FullID}}` or `{{.Name}}` [docker.{{.ID}}]
|
||||||
|
|
||||||
## Overriding Dockerfile image defaults
|
## Overriding Dockerfile image defaults
|
||||||
|
|
||||||
@@ -931,7 +942,7 @@ Dockerfile instruction and how the operator can override that setting.
|
|||||||
- [USER](#user)
|
- [USER](#user)
|
||||||
- [WORKDIR](#workdir)
|
- [WORKDIR](#workdir)
|
||||||
|
|
||||||
### CMD (default command or options)
|
## CMD (default command or options)
|
||||||
|
|
||||||
Recall the optional `COMMAND` in the Docker
|
Recall the optional `COMMAND` in the Docker
|
||||||
commandline:
|
commandline:
|
||||||
@@ -947,7 +958,7 @@ image), you can override that `CMD` instruction just by specifying a new
|
|||||||
If the image also specifies an `ENTRYPOINT` then the `CMD` or `COMMAND`
|
If the image also specifies an `ENTRYPOINT` then the `CMD` or `COMMAND`
|
||||||
get appended as arguments to the `ENTRYPOINT`.
|
get appended as arguments to the `ENTRYPOINT`.
|
||||||
|
|
||||||
### ENTRYPOINT (default command to execute at runtime)
|
## ENTRYPOINT (default command to execute at runtime)
|
||||||
|
|
||||||
--entrypoint="": Overwrite the default entrypoint set by the image
|
--entrypoint="": Overwrite the default entrypoint set by the image
|
||||||
|
|
||||||
@@ -970,7 +981,7 @@ or two examples of how to pass more parameters to that ENTRYPOINT:
|
|||||||
$ docker run -i -t --entrypoint /bin/bash example/redis -c ls -l
|
$ docker run -i -t --entrypoint /bin/bash example/redis -c ls -l
|
||||||
$ docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help
|
$ docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help
|
||||||
|
|
||||||
### EXPOSE (incoming ports)
|
## EXPOSE (incoming ports)
|
||||||
|
|
||||||
The Dockerfile doesn't give much control over networking, only providing
|
The Dockerfile doesn't give much control over networking, only providing
|
||||||
the `EXPOSE` instruction to give a hint to the operator about what
|
the `EXPOSE` instruction to give a hint to the operator about what
|
||||||
@@ -1012,7 +1023,7 @@ then the client container can access the exposed port via a private
|
|||||||
networking interface. Docker will set some environment variables in the
|
networking interface. Docker will set some environment variables in the
|
||||||
client container to help indicate which interface and port to use.
|
client container to help indicate which interface and port to use.
|
||||||
|
|
||||||
### ENV (environment variables)
|
## ENV (environment variables)
|
||||||
|
|
||||||
When a new container is created, Docker will set the following environment
|
When a new container is created, Docker will set the following environment
|
||||||
variables automatically:
|
variables automatically:
|
||||||
@@ -1048,7 +1059,7 @@ variables automatically:
|
|||||||
|
|
||||||
The container may also include environment variables defined
|
The container may also include environment variables defined
|
||||||
as a result of the container being linked with another container. See
|
as a result of the container being linked with another container. See
|
||||||
the [*Container Links*](/userguide/dockerlinks/#connect-with-the-linking-system)
|
the [*Container Links*](/userguide/dockerlinks/#container-linking)
|
||||||
section for more details.
|
section for more details.
|
||||||
|
|
||||||
Additionally, the operator can **set any environment variable** in the
|
Additionally, the operator can **set any environment variable** in the
|
||||||
@@ -1125,7 +1136,7 @@ container's `/etc/hosts` entry will be automatically updated.
|
|||||||
> restarted. We recommend using the host entries in `/etc/hosts` to resolve the
|
> restarted. We recommend using the host entries in `/etc/hosts` to resolve the
|
||||||
> IP address of linked containers.
|
> IP address of linked containers.
|
||||||
|
|
||||||
### VOLUME (shared filesystems)
|
## VOLUME (shared filesystems)
|
||||||
|
|
||||||
-v=[]: Create a bind mount with: [host-dir:]container-dir[:rw|ro].
|
-v=[]: Create a bind mount with: [host-dir:]container-dir[:rw|ro].
|
||||||
If 'host-dir' is missing, then docker creates a new volume.
|
If 'host-dir' is missing, then docker creates a new volume.
|
||||||
@@ -1140,21 +1151,18 @@ one or more `VOLUME`'s associated with an image, but only the operator
|
|||||||
can give access from one container to another (or from a container to a
|
can give access from one container to another (or from a container to a
|
||||||
volume mounted on the host).
|
volume mounted on the host).
|
||||||
|
|
||||||
### USER
|
## USER
|
||||||
|
|
||||||
`root` (id = 0) is the default user within a container. The image developer can
|
The default user within a container is `root` (id = 0), but if the
|
||||||
create additional users. Those users are accessible by name. When passing a numeric
|
developer created additional users, those are accessible too. The
|
||||||
ID, the user does not have to exist in the container.
|
developer can set a default user to run the first process with the
|
||||||
|
Dockerfile `USER` instruction, but the operator can override it:
|
||||||
The developer can set a default user to run the first process with the
|
|
||||||
Dockerfile `USER` instruction. When starting a container, the operator can override
|
|
||||||
the `USER` instruction by passing the `-u` option.
|
|
||||||
|
|
||||||
-u="": Username or UID
|
-u="": Username or UID
|
||||||
|
|
||||||
> **Note:** if you pass a numeric uid, it must be in the range of 0-2147483647.
|
> **Note:** if you pass numeric uid, it must be in range 0-2147483647.
|
||||||
|
|
||||||
### WORKDIR
|
## WORKDIR
|
||||||
|
|
||||||
The default working directory for running binaries within a container is the
|
The default working directory for running binaries within a container is the
|
||||||
root directory (`/`), but the developer can set a different default with the
|
root directory (`/`), but the developer can set a different default with the
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ The `docker-default` profile the default for running
|
|||||||
containers. It is moderately protective while
|
containers. It is moderately protective while
|
||||||
providing wide application compatability.
|
providing wide application compatability.
|
||||||
|
|
||||||
|
The `docker-unconfined` profile is intended for
|
||||||
|
privileged applications and is the default when runing
|
||||||
|
a container with the *--privileged* flag.
|
||||||
|
|
||||||
The system's standard `unconfined` profile inherits all
|
The system's standard `unconfined` profile inherits all
|
||||||
system-wide policies, applying path-based policies
|
system-wide policies, applying path-based policies
|
||||||
intended for the host system inside of containers.
|
intended for the host system inside of containers.
|
||||||
|
|||||||
@@ -1,291 +0,0 @@
|
|||||||
<!--[metadata]>
|
|
||||||
+++
|
|
||||||
title = "Content trust in Docker"
|
|
||||||
description = "Enabling content trust in Docker"
|
|
||||||
keywords = ["content, trust, security, docker, documentation"]
|
|
||||||
[menu.main]
|
|
||||||
parent= "smn_content_trust"
|
|
||||||
weight=-1
|
|
||||||
+++
|
|
||||||
<![end-metadata]-->
|
|
||||||
|
|
||||||
# Content trust in Docker
|
|
||||||
|
|
||||||
When transferring data among networked systems, *trust* is a central concern. In
|
|
||||||
particular, when communicating over an untrusted medium such as the internet, it
|
|
||||||
is critical to ensure the integrity and publisher of all the data a system
|
|
||||||
operates on. You use Docker to push and pull images (data) to a registry. Content trust
|
|
||||||
gives you the ability to both verify the integrity and the publisher of all the
|
|
||||||
data received from a registry over any channel.
|
|
||||||
|
|
||||||
Content trust is currently only available for users of the public Docker Hub. It
|
|
||||||
is currently not available for the Docker Trusted Registry or for private
|
|
||||||
registries.
|
|
||||||
|
|
||||||
## Understand trust in Docker
|
|
||||||
|
|
||||||
Content trust allows operations with a remote Docker registry to enforce
|
|
||||||
client-side signing and verification of image tags. Content trust provides the
|
|
||||||
ability to use digital signatures for data sent to and received from remote
|
|
||||||
Docker registries. These signatures allow client-side verification of the
|
|
||||||
integrity and publisher of specific image tags.
|
|
||||||
|
|
||||||
Currently, content trust is disabled by default. You must enabled it by setting
|
|
||||||
the `DOCKER_CONTENT_TRUST` environment variable.
|
|
||||||
|
|
||||||
Once content trust is enabled, image publishers can sign their images. Image consumers can
|
|
||||||
ensure that the images they use are signed. publishers and consumers can be
|
|
||||||
individuals alone or in organizations. Docker's content trust supports users and
|
|
||||||
automated processes such as builds.
|
|
||||||
|
|
||||||
### Image tags and content trust
|
|
||||||
|
|
||||||
An individual image record has the following identifier:
|
|
||||||
|
|
||||||
```
|
|
||||||
[REGISTRY_HOST[:REGISTRY_PORT]/]REPOSITORY[:TAG]
|
|
||||||
```
|
|
||||||
|
|
||||||
A particular image `REPOSITORY` can have multiple tags. For example, `latest` and
|
|
||||||
`3.1.2` are both tags on the `mongo` image. An image publisher can build an image
|
|
||||||
and tag combination many times changing the image with each build.
|
|
||||||
|
|
||||||
Content trust is associated with the `TAG` portion of an image. Each image
|
|
||||||
repository has a set of keys that image publishers use to sign an image tag.
|
|
||||||
Image publishers have discretion on which tags they sign.
|
|
||||||
|
|
||||||
An image repository can contain an image with one tag that is signed and another
|
|
||||||
tag that is not. For example, consider [the Mongo image
|
|
||||||
repository](https://hub.docker.com/r/library/mongo/tags/). The `latest`
|
|
||||||
tag could be unsigned while the `3.1.6` tag could be signed. It is the
|
|
||||||
responsibility of the image publisher to decide if an image tag is signed or
|
|
||||||
not. In this representation, some image tags are signed, others are not:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Publishers can choose to sign a specific tag or not. As a result, the content of
|
|
||||||
an unsigned tag and that of a signed tag with the same name may not match. For
|
|
||||||
example, a publisher can push a tagged image `someimage:latest` and sign it.
|
|
||||||
Later, the same publisher can push an unsigned `someimage:latest` image. This second
|
|
||||||
push replaces the last unsigned tag `latest` but does not affect the signed `latest` version.
|
|
||||||
The ability to choose which tags they can sign, allows publishers to iterate over
|
|
||||||
the unsigned version of an image before officially signing it.
|
|
||||||
|
|
||||||
Image consumers can enable content trust to ensure that images they use were
|
|
||||||
signed. If a consumer enables content trust, they can only pull, run, or build
|
|
||||||
with trusted images. Enabling content trust is like wearing a pair of
|
|
||||||
rose-colored glasses. Consumers "see" only signed images tags and the less
|
|
||||||
desirable, unsigned image tags are "invisible" to them.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
To the consumer who does not enabled content trust, nothing about how they
|
|
||||||
work with Docker images changes. Every image is visible regardless of whether it
|
|
||||||
is signed or not.
|
|
||||||
|
|
||||||
|
|
||||||
### Content trust operations and keys
|
|
||||||
|
|
||||||
When content trust is enabled, `docker` CLI commands that operate on tagged images must
|
|
||||||
either have content signatures or explicit content hashes. The commands that
|
|
||||||
operate with content trust are:
|
|
||||||
|
|
||||||
* `push`
|
|
||||||
* `build`
|
|
||||||
* `create`
|
|
||||||
* `pull`
|
|
||||||
* `run`
|
|
||||||
|
|
||||||
For example, with content trust enabled a `docker pull someimage:latest` only
|
|
||||||
succeeds if `someimage:latest` is signed. However, an operation with an explicit
|
|
||||||
content hash always succeeds as long as the hash exists:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker pull someimage@sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a
|
|
||||||
```
|
|
||||||
|
|
||||||
Trust for an image tag is managed through the use of signing keys. Docker's content
|
|
||||||
trust makes use four different keys:
|
|
||||||
|
|
||||||
| Key | Description |
|
|
||||||
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| offline key | Root of content trust for a image tag. When content trust is enabled, you create the offline key once. |
|
|
||||||
| target and snapshot | These two keys are known together as the "tagging" key. When content trust is enabled, you create this key when you add a new image repository. If you have the offline key, you can export the tagging key and allow other publishers to sign the image tags. |
|
|
||||||
| timestamp | This key applies to a repository. It allows Docker repositories to have freshness security guarantees without requiring periodic content refreshes on the client's side. |
|
|
||||||
|
|
||||||
With the exception of the timestamp, all the keys are generated and stored locally
|
|
||||||
client-side. The timestamp is safely generated and stored in a signing server that
|
|
||||||
is deployed alongside the Docker registry. All keys are generated in a backend
|
|
||||||
service that isn't directly exposed to the internet and are encrypted at rest.
|
|
||||||
|
|
||||||
The following image depicts the various signing keys and their relationships:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
>**WARNING**: Loss of the offline key is **very difficult** to recover from.
|
|
||||||
>Correcting this loss requires intervention from [Docker
|
|
||||||
>Support](https://support.docker.com) to reset the repository state. This loss
|
|
||||||
>also requires **manual intervention** from every consumer that used a signed
|
|
||||||
>tag from this repository prior to the loss.
|
|
||||||
|
|
||||||
You should backup the offline key somewhere safe. Given that it is only required
|
|
||||||
to create new repositories, it is a good idea to store it offline. Make sure you
|
|
||||||
read [Manage keys for content trust](/security/trust/trust_key_mng) information
|
|
||||||
for details on creating, securing, and backing up your keys.
|
|
||||||
|
|
||||||
## Survey of typical content trust operations
|
|
||||||
|
|
||||||
This section surveys the typical trusted operations users perform with Docker
|
|
||||||
images.
|
|
||||||
|
|
||||||
### Enable content trust
|
|
||||||
|
|
||||||
Enable content trust by setting the `DOCKER_CONTENT_TRUST` environment variable.
|
|
||||||
Enabling per-shell is useful because you can have one shell configured for
|
|
||||||
trusted operations and another terminal shell for untrusted operations. You can
|
|
||||||
also add this declaration to your shell profile to have it turned on always by
|
|
||||||
default.
|
|
||||||
|
|
||||||
To enable content trust in a `bash` shell enter the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export DOCKER_CONTENT_TRUST=1
|
|
||||||
```
|
|
||||||
|
|
||||||
Once set, each of the "tag" operations require key for trusted tag. All of these
|
|
||||||
commands also support the `--disable-content-trust` flag. This flag allows
|
|
||||||
publishers to run individual operations on tagged images without content trust on an
|
|
||||||
as-needed basis.
|
|
||||||
|
|
||||||
|
|
||||||
### Push trusted content
|
|
||||||
|
|
||||||
To create signed content for a specific image tag, simply enable content trust and push
|
|
||||||
a tagged image. If this is the first time you have pushed an image using content trust
|
|
||||||
on your system, the session looks like this:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker push docker/trusttest:latest
|
|
||||||
The push refers to a repository [docker.io/docker/trusttest] (len: 1)
|
|
||||||
9a61b6b1315e: Image already exists
|
|
||||||
902b87aaaec9: Image already exists
|
|
||||||
latest: digest: sha256:d02adacee0ac7a5be140adb94fa1dae64f4e71a68696e7f8e7cbf9db8dd49418 size: 3220
|
|
||||||
Signing and pushing trust metadata
|
|
||||||
You are about to create a new offline signing key passphrase. This passphrase
|
|
||||||
will be used to protect the most sensitive key in your signing system. Please
|
|
||||||
choose a long, complex passphrase and be careful to keep the password and the
|
|
||||||
key file itself secure and backed up. It is highly recommended that you use a
|
|
||||||
password manager to generate the passphrase and keep it safe. There will be no
|
|
||||||
way to recover this key. You can find the key in your config directory.
|
|
||||||
Enter passphrase for new offline key with id a1d96fb:
|
|
||||||
Repeat passphrase for new offline key with id a1d96fb:
|
|
||||||
Enter passphrase for new tagging key with id docker.io/docker/trusttest (3a932f1):
|
|
||||||
Repeat passphrase for new tagging key with id docker.io/docker/trusttest (3a932f1):
|
|
||||||
Finished initializing "docker.io/docker/trusttest"
|
|
||||||
```
|
|
||||||
When you push your first tagged image with content trust enabled, the `docker` client
|
|
||||||
recognizes this is your first push and:
|
|
||||||
|
|
||||||
- alerts you that it will create a new offline key
|
|
||||||
- requests a passphrase for the key
|
|
||||||
- generates an offline key in the `~/.docker/trust` directory
|
|
||||||
- generates a tagging key for in the `~/.docker/trust` directory
|
|
||||||
|
|
||||||
The passphrase you chose for both the offline key and your content key-pair should
|
|
||||||
be randomly generated and stored in a *password manager*.
|
|
||||||
|
|
||||||
It is important to note, if you had left off the `latest` tag, content trust is skipped.
|
|
||||||
This is true even if content trust is enabled and even if this is your first push.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker push docker/trusttest
|
|
||||||
The push refers to a repository [docker.io/docker/trusttest] (len: 1)
|
|
||||||
9a61b6b1315e: Image successfully pushed
|
|
||||||
902b87aaaec9: Image successfully pushed
|
|
||||||
latest: digest: sha256:a9a9c4402604b703bed1c847f6d85faac97686e48c579bd9c3b0fa6694a398fc size: 3220
|
|
||||||
No tag specified, skipping trust metadata push
|
|
||||||
```
|
|
||||||
|
|
||||||
It is skipped because as the message states, you did not supply an image `TAG`
|
|
||||||
value. In Docker content trust, signatures are associated with tags.
|
|
||||||
|
|
||||||
Once you have an offline key on your system, subsequent images repositories
|
|
||||||
you create can use that same offline key:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker push docker.io/docker/seaside:latest
|
|
||||||
The push refers to a repository [docker.io/docker/seaside] (len: 1)
|
|
||||||
a9539b34a6ab: Image successfully pushed
|
|
||||||
b3dbab3810fc: Image successfully pushed
|
|
||||||
latest: digest: sha256:d2ba1e603661a59940bfad7072eba698b79a8b20ccbb4e3bfb6f9e367ea43939 size: 3346
|
|
||||||
Signing and pushing trust metadata
|
|
||||||
Enter key passphrase for offline key with id a1d96fb:
|
|
||||||
Enter passphrase for new tagging key with id docker.io/docker/seaside (bb045e3):
|
|
||||||
Repeat passphrase for new tagging key with id docker.io/docker/seaside (bb045e3):
|
|
||||||
Finished initializing "docker.io/docker/seaside"
|
|
||||||
```
|
|
||||||
|
|
||||||
The new image has its own tagging key and timestamp key. The `latest` tag is signed with both of
|
|
||||||
these.
|
|
||||||
|
|
||||||
|
|
||||||
### Pull image content
|
|
||||||
|
|
||||||
A common way to consume an image is to `pull` it. With content trust enabled, the Docker
|
|
||||||
client only allows `docker pull` to retrieve signed images.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ docker pull docker/seaside
|
|
||||||
Using default tag: latest
|
|
||||||
Pull (1 of 1): docker/trusttest:latest@sha256:d149ab53f871
|
|
||||||
...
|
|
||||||
Tagging docker/trusttest@sha256:d149ab53f871 as docker/trusttest:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
The `seaside:latest` image is signed. In the following example, the command does not specify a tag, so the system uses
|
|
||||||
the `latest` tag by default again and the `docker/cliffs:latest` tag is not signed.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker pull docker/cliffs
|
|
||||||
Using default tag: latest
|
|
||||||
no trust data available
|
|
||||||
```
|
|
||||||
|
|
||||||
Because the tag `docker/cliffs:latest` is not trusted, the `pull` fails.
|
|
||||||
|
|
||||||
|
|
||||||
### Disable content trust for specific operations
|
|
||||||
|
|
||||||
A user that wants to disable content trust for a particular operation can use the
|
|
||||||
`--disable-content-trust` flag. **Warning: this flag disables content trust for
|
|
||||||
this operation**. With this flag, Docker will ignore content-trust and allow all
|
|
||||||
operations to be done without verifying any signatures. If we wanted the
|
|
||||||
previous untrusted build to succeed we could do:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cat Dockerfile
|
|
||||||
FROM docker/trusttest:notrust
|
|
||||||
RUN echo
|
|
||||||
$ docker build --disable-content-trust -t docker/trusttest:testing .
|
|
||||||
Sending build context to Docker daemon 42.84 MB
|
|
||||||
...
|
|
||||||
Successfully built f21b872447dc
|
|
||||||
```
|
|
||||||
|
|
||||||
The same is true for all the other commands, such as `pull` and `push`:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ docker pull --disable-content-trust docker/trusttest:untrusted
|
|
||||||
...
|
|
||||||
$ docker push --disable-content-trust docker/trusttest:untrusted
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
## Related information
|
|
||||||
|
|
||||||
* [Manage keys for content trust](/security/trust/trust_key_mng)
|
|
||||||
* [Automation with content trust](/security/trust/trust_automation)
|
|
||||||
* [Play in a content trust sandbox](/security/trust/trust_sandbox)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 73 KiB |