From db9d68c3e42a187a735082776b671d23651f4334 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 9 Aug 2013 10:50:58 -0700 Subject: [PATCH 01/24] Improve TestKillDifferentUser to prevent timeout on buildbot --- container_test.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/container_test.go b/container_test.go index 1050bfb2ad..c09c9f48f9 100644 --- a/container_test.go +++ b/container_test.go @@ -401,22 +401,24 @@ func TestOutput(t *testing.T) { func TestKillDifferentUser(t *testing.T) { runtime := mkRuntime(t) defer nuke(runtime) + container, err := NewBuilder(runtime).Create(&Config{ - Image: GetTestImage(runtime).ID, - Cmd: []string{"tail", "-f", "/etc/resolv.conf"}, - User: "daemon", + Image: GetTestImage(runtime).ID, + Cmd: []string{"cat"}, + OpenStdin: true, + User: "daemon", }, ) if err != nil { t.Fatal(err) } defer runtime.Destroy(container) + defer container.stdin.Close() if container.State.Running { t.Errorf("Container shouldn't be running") } - hostConfig := &HostConfig{} - if err := container.Start(hostConfig); err != nil { + if err := container.Start(&HostConfig{}); err != nil { t.Fatal(err) } @@ -426,8 +428,13 @@ func TestKillDifferentUser(t *testing.T) { } }) - // Even if the state is running, lets give some time to lxc to spawn the process - container.WaitTimeout(500 * time.Millisecond) + setTimeout(t, "read/write assertion timed out", 2*time.Second, func() { + out, _ := container.StdoutPipe() + in, _ := container.StdinPipe() + if err := assertPipe("hello\n", "hello", out, in, 15); err != nil { + t.Fatal(err) + } + }) if err := container.Kill(); err != nil { t.Fatal(err) From 3b23f02229fd3f4928934f317d41b8f497cec9a9 Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Fri, 9 Aug 2013 19:52:05 -0400 Subject: [PATCH 02/24] Fix typo: fmt.Sprint -> fmt.Sprintf --- registry/registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/registry.go b/registry/registry.go index 5b8480d183..1e0e1815d2 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -391,7 +391,7 @@ func (r *Registry) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, regis if res.StatusCode != 200 { errBody, err := ioutil.ReadAll(res.Body) if err != nil { - return utils.NewHTTPRequestError(fmt.Sprint("HTTP code %d while uploading metadata and error when trying to parse response body: %s", res.StatusCode, err), res) + return utils.NewHTTPRequestError(fmt.Sprintf("HTTP code %d while uploading metadata and error when trying to parse response body: %s", res.StatusCode, err), res) } var jsonBody map[string]string if err := json.Unmarshal(errBody, &jsonBody); err != nil { From 1408f08c40f73ccf0204334ceb44ac482c5641e9 Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Fri, 9 Aug 2013 20:09:42 -0400 Subject: [PATCH 03/24] Update AUTHORS --- .mailmap | 3 ++- AUTHORS | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 11ff5357d8..adeac2d7ff 100644 --- a/.mailmap +++ b/.mailmap @@ -1,4 +1,4 @@ -# Generate AUTHORS: git log --all --format='%aN <%aE>' | sort -uf | grep -v vagrant-ubuntu-12 +# Generate AUTHORS: git log --format='%aN <%aE>' | sort -uf | grep -v vagrant-ubuntu-12 @@ -25,3 +25,4 @@ Walter Stanish Roberto Hashioka Konstantin Pelykh David Sissitka +Nolan Darilek diff --git a/AUTHORS b/AUTHORS index 773ad6e4d3..a9442d8637 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,6 +39,7 @@ Erno Hopearuoho Evan Wies ezbercih Fabrizio Regini +Fareed Dudhia Flavio Castelli Francisco Souza Frederick F. Kautz IV @@ -81,6 +82,7 @@ Nelson Chen Niall O'Higgins Nick Stenning Nick Stinemates +Nolan Darilek odk- Paul Bowsher Paul Hammond @@ -104,6 +106,7 @@ Thomas Hansen Tianon Gravi Tim Terhorst Tobias Bieniek +Tobias Schmidt Tobias Schwab Tom Hulihan unclejack From 7c50221de5ec1066f0f04d6db94ee9c2fef98efb Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Fri, 9 Aug 2013 20:42:20 -0400 Subject: [PATCH 04/24] Use ranged for loop on channels --- api.go | 3 +-- commands.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api.go b/api.go index 95b9c98de8..81d1e3aab1 100644 --- a/api.go +++ b/api.go @@ -223,8 +223,7 @@ func getEvents(srv *Server, version float64, w http.ResponseWriter, r *http.Requ } } } - for { - event := <-listener + for event := range listener { err := sendEvent(wf, &event) if err != nil && err.Error() == "JSON error" { continue diff --git a/commands.go b/commands.go index a2099b9607..42fb8cdc48 100644 --- a/commands.go +++ b/commands.go @@ -1696,8 +1696,7 @@ func (cli *DockerCli) monitorTtySize(id string) error { sigchan := make(chan os.Signal, 1) signal.Notify(sigchan, syscall.SIGWINCH) go func() { - for { - <-sigchan + for _ = range sigchan { cli.resizeTty(id) } }() From 4dc04d7690a4d634d9afd93821bb8e78620c5f9f Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Fri, 9 Aug 2013 21:16:44 -0400 Subject: [PATCH 05/24] Add GitHub usernames to MAINTAINERS --- MAINTAINERS | 12 ++++++------ docs/MAINTAINERS | 4 ++-- docs/sources/api/MAINTAINERS | 2 +- docs/theme/MAINTAINERS | 2 +- hack/dockerbuilder/MAINTAINERS | 2 +- hack/infrastructure/MAINTAINERS | 4 ++-- library/MAINTAINERS | 2 +- packaging/MAINTAINERS | 2 +- registry/MAINTAINERS | 6 +++--- term/MAINTAINERS | 4 ++-- testing/MAINTAINERS | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 55cb07b72b..96469c9814 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1,6 +1,6 @@ -Solomon Hykes -Guillaume Charmes -Victor Vieux -Michael Crosby -api.go: Victor Vieux -Vagrantfile: Daniel Mizyrycki +Solomon Hykes (@shykes) +Guillaume Charmes (@creack) +Victor Vieux (@vieux) +Michael Crosby (@crosbymichael) +api.go: Victor Vieux (@vieux) +Vagrantfile: Daniel Mizyrycki (@mzdaniel) diff --git a/docs/MAINTAINERS b/docs/MAINTAINERS index f079e58481..a506ce11df 100644 --- a/docs/MAINTAINERS +++ b/docs/MAINTAINERS @@ -1,2 +1,2 @@ -Andy Rothfusz -Ken Cochrane +Andy Rothfusz (@metalivedev) +Ken Cochrane (@kencochrane) diff --git a/docs/sources/api/MAINTAINERS b/docs/sources/api/MAINTAINERS index e1c6f2ccfc..1887dfc232 100644 --- a/docs/sources/api/MAINTAINERS +++ b/docs/sources/api/MAINTAINERS @@ -1 +1 @@ -Solomon Hykes +Solomon Hykes (@shykes) diff --git a/docs/theme/MAINTAINERS b/docs/theme/MAINTAINERS index 606a1dd746..93231b1223 100644 --- a/docs/theme/MAINTAINERS +++ b/docs/theme/MAINTAINERS @@ -1 +1 @@ -Thatcher Peskens +Thatcher Peskens (@dhrp) diff --git a/hack/dockerbuilder/MAINTAINERS b/hack/dockerbuilder/MAINTAINERS index 228bd562e5..5dfc881420 100644 --- a/hack/dockerbuilder/MAINTAINERS +++ b/hack/dockerbuilder/MAINTAINERS @@ -1 +1 @@ -Daniel Mizyrycki +Daniel Mizyrycki (@mzdaniel) diff --git a/hack/infrastructure/MAINTAINERS b/hack/infrastructure/MAINTAINERS index 490b0c1ea2..bd089c55f4 100644 --- a/hack/infrastructure/MAINTAINERS +++ b/hack/infrastructure/MAINTAINERS @@ -1,2 +1,2 @@ -Ken Cochrane -Jerome Petazzoni +Ken Cochrane (@kencochrane) +Jerome Petazzoni (@jpetazzo) diff --git a/library/MAINTAINERS b/library/MAINTAINERS index b1c52939ef..6ac7d8cd79 100644 --- a/library/MAINTAINERS +++ b/library/MAINTAINERS @@ -1 +1 @@ -Joffrey Fuhrer +Joffrey Fuhrer (@shin-) diff --git a/packaging/MAINTAINERS b/packaging/MAINTAINERS index 228bd562e5..5dfc881420 100644 --- a/packaging/MAINTAINERS +++ b/packaging/MAINTAINERS @@ -1 +1 @@ -Daniel Mizyrycki +Daniel Mizyrycki (@mzdaniel) diff --git a/registry/MAINTAINERS b/registry/MAINTAINERS index b11dfc061b..bf3984f5f9 100644 --- a/registry/MAINTAINERS +++ b/registry/MAINTAINERS @@ -1,3 +1,3 @@ -Sam Alba -Joffrey Fuhrer -Ken Cochrane +Sam Alba (@samalba) +Joffrey Fuhrer (@shin-) +Ken Cochrane (@kencochrane) diff --git a/term/MAINTAINERS b/term/MAINTAINERS index 8df21a4601..48d4d91b2a 100644 --- a/term/MAINTAINERS +++ b/term/MAINTAINERS @@ -1,2 +1,2 @@ -Guillaume Charmes -Solomon Hykes +Guillaume Charmes (@creack) +Solomon Hykes (@shykes) diff --git a/testing/MAINTAINERS b/testing/MAINTAINERS index 228bd562e5..5dfc881420 100644 --- a/testing/MAINTAINERS +++ b/testing/MAINTAINERS @@ -1 +1 @@ -Daniel Mizyrycki +Daniel Mizyrycki (@mzdaniel) From d6e5c2c276de458f36034d46f7b7f0f8efd24491 Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Sat, 10 Aug 2013 02:38:11 +0100 Subject: [PATCH 06/24] Add initial bash completion script The script can be used to auto-complete commands, image names and container ids from within a bash prompt. This partially resolves #336. --- contrib/docker.bash | 434 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 434 insertions(+) create mode 100644 contrib/docker.bash diff --git a/contrib/docker.bash b/contrib/docker.bash new file mode 100644 index 0000000000..dcabdf252c --- /dev/null +++ b/contrib/docker.bash @@ -0,0 +1,434 @@ +#!bash + +have docker && { +__docker_containers() +{ + local containers + containers="$( docker ps -a -q )" + COMPREPLY=( $( compgen -W "$containers" -- "$cur" ) ) +} + +__docker_image_repos() +{ + local repos + repos="$( docker images | awk 'NR>1{print $1}' )" + COMPREPLY=( $( compgen -W "$repos" -- "$cur" ) ) +} + +__docker_images() +{ + local images + images="$( docker images | awk 'NR>1{print $1":"$2}' )" + COMPREPLY=( $( compgen -W "$images" -- "$cur" ) ) + __ltrim_colon_completions "$cur" +} + +__docker_image_repos_and_tags() +{ + local repos images + repos="$( docker images | awk 'NR>1{print $1}' )" + images="$( docker images | awk 'NR>1{print $1":"$2}' )" + COMPREPLY=( $( compgen -W "$repos $images" -- "$cur" ) ) + __ltrim_colon_completions "$cur" +} + +__docker_containers_and_images() +{ + local containers images + containers="$( docker ps -a -q )" + images="$( docker images | awk 'NR>1{print $1":"$2}' )" + COMPREPLY=( $( compgen -W "$images $containers" -- "$cur" ) ) + __ltrim_colon_completions "$cur" +} + +_docker_docker() +{ + case "$prev" in + -H) + return + ;; + *) + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-H" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$commands help" -- "$cur" ) ) + ;; + esac +} + +_docker_attach() +{ + if [ $cpos -eq $cword ]; then + __docker_containers + fi +} + +_docker_build() +{ + case "$prev" in + -t) + return + ;; + *) + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-t -q" -- "$cur" ) ) + ;; + *) + _filedir + ;; + esac +} + +_docker_commit() +{ + case "$prev" in + -author|-m|-run) + return + ;; + *) + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-author -m -run" -- "$cur" ) ) + ;; + *) + __docker_containers + ;; + esac +} + +_docker_diff() +{ + if [ $cpos -eq $cword ]; then + __docker_containers + fi +} + +_docker_events() +{ + COMPREPLY=( $( compgen -W "-since" -- "$cur" ) ) +} + +_docker_export() +{ + if [ $cpos -eq $cword ]; then + __docker_containers + fi +} + +_docker_help() +{ + if [ $cpos -eq $cword ]; then + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + fi +} + +_docker_history() +{ + if [ $cpos -eq $cword ]; then + __docker_image_repos_and_tags + fi +} + +_docker_images() +{ + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-a -notrunc -q -viz" -- "$cur" ) ) + ;; + *) + local counter=$cpos + while [ $counter -le $cword ]; do + case "${words[$counter]}" in + -*) + ;; + *) + break + ;; + esac + (( counter++ )) + done + + if [ $counter -eq $cword ]; then + __docker_image_repos + fi + ;; + esac +} + +_docker_import() +{ + return +} + +_docker_info() +{ + return +} + +_docker_insert() +{ + if [ $cpos -eq $cword ]; then + __docker_image_repos_and_tags + fi +} + +_docker_inspect() +{ + __docker_containers_and_images +} + +_docker_kill() +{ + __docker_containers +} + +_docker_login() +{ + COMPREPLY=( $( compgen -W "-e -p -u" -- "$cur" ) ) +} + +_docker_logs() +{ + if [ $cpos -eq $cword ]; then + __docker_containers + fi +} + +_docker_port() +{ + if [ $cpos -eq $cword ]; then + __docker_containers + fi +} + +_docker_ps() +{ + COMPREPLY=( $( compgen -W "-a -beforeId -l -n -notrunc -q -s -sinceId" -- "$cur" ) ) +} + +_docker_pull() +{ + COMPREPLY=( $( compgen -W "-t" -- "$cur" ) ) +} + +_docker_push() +{ + return +} + +_docker_restart() +{ + case "$prev" in + -t) + return + ;; + *) + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-t" -- "$cur" ) ) + ;; + *) + __docker_containers + ;; + esac +} + +_docker_rm() +{ + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-v" -- "$cur" ) ) + ;; + *) + __docker_containers + ;; + esac +} + +_docker_rmi() +{ + __docker_image_repos_and_tags +} + +_docker_run() +{ + case "$prev" in + -cidfile) + _filedir + ;; + -volumes-from) + __docker_containers + ;; + -a|-c|-dns|-e|-h|-m|-p|-u|-v) + return + ;; + *) + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-a -c -cidfile -d -dns -e -entrypoint -h -i -m -n -p -t -u -v -volumes-from" -- "$cur" ) ) + ;; + *) + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-a -notrunc -q -viz" -- "$cur" ) ) + ;; + *) + local counter=$cpos + while [ $counter -le $cword ]; do + case "${words[$counter]}" in + -a|-c|-cidfile|-dns|-e|-h|-m|-p|-u|-v|-volumes-from) + (( counter++ )) + ;; + -*) + ;; + *) + break + ;; + esac + (( counter++ )) + done + + if [ $counter -eq $cword ]; then + __docker_image_repos_and_tags + fi + ;; + esac + ;; + esac +} + +_docker_search() +{ + COMPREPLY=( $( compgen -W "-notrunc" -- "$cur" ) ) +} + +_docker_start() +{ + __docker_containers +} + +_docker_stop() +{ + case "$prev" in + -t) + return + ;; + *) + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-t" -- "$cur" ) ) + ;; + *) + __docker_containers + ;; + esac +} + +_docker_tag() +{ + COMPREPLY=( $( compgen -W "-f" -- "$cur" ) ) +} + +_docker_top() +{ + if [ $cpos -eq $cword ]; then + __docker_containers + fi +} + +_docker_version() +{ + return +} + +_docker_wait() +{ + __docker_containers +} + +_docker() +{ + local cur prev words cword command="docker" counter=1 word cpos + local commands=" + attach + build + commit + diff + events + export + history + images + import + info + insert + inspect + kill + login + logs + port + ps + pull + push + restart + rm + rmi + run + search + start + stop + tag + top + version + wait + " + + COMPREPLY=() + _get_comp_words_by_ref -n : cur prev words cword + + while [ $counter -lt $cword ]; do + word="${words[$counter]}" + case "$word" in + -H) + (( counter++ )) + ;; + -*) + ;; + *) + command="$word" + cpos=$counter + (( cpos++ )) + break + ;; + esac + (( counter++ )) + done + + local completions_func=_docker_${command} + declare -F $completions_func >/dev/null && $completions_func + + return 0 +} + +complete -F _docker docker +} \ No newline at end of file From e3acbff2edd04c8a7211ea078b24745749021efc Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Sat, 10 Aug 2013 03:06:08 +0000 Subject: [PATCH 07/24] Revert "docker.upstart: avoid spawning a `sh` process" This reverts commit 24dd50490a027f01ea086eb90663d53348fa770e. --- packaging/ubuntu/docker.upstart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packaging/ubuntu/docker.upstart b/packaging/ubuntu/docker.upstart index f4d2fbe922..143be03402 100644 --- a/packaging/ubuntu/docker.upstart +++ b/packaging/ubuntu/docker.upstart @@ -5,4 +5,6 @@ stop on runlevel [!2345] respawn -exec /usr/bin/docker -d +script + /usr/bin/docker -d +end script From 91ae1358966211826818ed452f13e3e2e27ed6cc Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Sat, 10 Aug 2013 13:05:31 +0100 Subject: [PATCH 08/24] Add description and usage information --- contrib/docker.bash | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/contrib/docker.bash b/contrib/docker.bash index dcabdf252c..5a4a8e30a9 100644 --- a/contrib/docker.bash +++ b/contrib/docker.bash @@ -1,4 +1,23 @@ #!bash +# +# bash completion file for core docker commands +# +# This script provides supports completion of: +# - commands and their options +# - container ids +# - image repos and tags +# - filepaths +# +# To enable the completions either: +# - place this file in /etc/bash_completion.d +# or +# - copy this file and add the line below to your .bashrc after +# bash completion features are loaded +# . docker.bash +# +# Note: +# If the docker daemon is using a unix socket for communication your user +# must have access to the socket for the completions to function correctly have docker && { __docker_containers() From a43bae4c0b6f3ec632636be544a6816f5f62dcb0 Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Sat, 10 Aug 2013 13:48:24 -0400 Subject: [PATCH 09/24] gitignore all test files --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 512e4f2cd9..ea62e34d19 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,7 @@ docker/docker a.out *.orig build_src -command-line-arguments.test .flymake* -docker.test -auth/auth.test .idea .DS_Store docs/_build @@ -16,3 +13,4 @@ docs/_static docs/_templates .gopath/ .dotcloud +*.test From d75282eb147218bb7c6f4032e75b95a1ddd299cf Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Sun, 11 Aug 2013 00:57:18 +0100 Subject: [PATCH 10/24] Missed -entrypoint from 'docker run' options --- contrib/docker.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker.bash b/contrib/docker.bash index 5a4a8e30a9..a94ae2360f 100644 --- a/contrib/docker.bash +++ b/contrib/docker.bash @@ -293,7 +293,7 @@ _docker_run() -volumes-from) __docker_containers ;; - -a|-c|-dns|-e|-h|-m|-p|-u|-v) + -a|-c|-dns|-e|-entrypoint|-h|-m|-p|-u|-v) return ;; *) From ae1909b4823e500798f224a3ea70f7faf644a2bc Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Sun, 11 Aug 2013 01:08:47 +0100 Subject: [PATCH 11/24] Clarified bash completion limitations --- contrib/docker.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/docker.bash b/contrib/docker.bash index a94ae2360f..1edabe1fe1 100644 --- a/contrib/docker.bash +++ b/contrib/docker.bash @@ -16,6 +16,8 @@ # . docker.bash # # Note: +# Currently, the completions will not work if the docker daemon is not +# bound to the default communication port/socket # If the docker daemon is using a unix socket for communication your user # must have access to the socket for the completions to function correctly From e737856a7f2c92f6cb582a12cc6f0b9fb4720d5a Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Sun, 11 Aug 2013 01:29:22 +0100 Subject: [PATCH 12/24] Still missed -entrypoint from 'docker run' --- contrib/docker.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker.bash b/contrib/docker.bash index 1edabe1fe1..b9fb2ec6e0 100644 --- a/contrib/docker.bash +++ b/contrib/docker.bash @@ -315,7 +315,7 @@ _docker_run() local counter=$cpos while [ $counter -le $cword ]; do case "${words[$counter]}" in - -a|-c|-cidfile|-dns|-e|-h|-m|-p|-u|-v|-volumes-from) + -a|-c|-cidfile|-dns|-e|-entrypoint|-h|-m|-p|-u|-v|-volumes-from) (( counter++ )) ;; -*) From a2fb870ce30d87aa7a08cca4c2e45c4d021c99c4 Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Sun, 11 Aug 2013 02:04:04 +0100 Subject: [PATCH 13/24] Fix typo in docs for docker run -dns --- docs/sources/commandline/command/run.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/commandline/command/run.rst b/docs/sources/commandline/command/run.rst index c5b363d787..1aa6884a07 100644 --- a/docs/sources/commandline/command/run.rst +++ b/docs/sources/commandline/command/run.rst @@ -24,7 +24,7 @@ -p=[]: Map a network port to the container -t=false: Allocate a pseudo-tty -u="": Username or UID - -d=[]: Set custom dns servers for the container + -dns=[]: Set custom dns servers for the container -v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro]. If "host-dir" is missing, then docker creates a new volume. -volumes-from="": Mount all volumes from the given container. -entrypoint="": Overwrite the default entrypoint set by the image. From 64b817a5c12545252d0cbb3d4ce1f23996bb266b Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 11 Aug 2013 11:52:16 +0200 Subject: [PATCH 14/24] runtime: correctly detect IPv4 forwarding When memory cgroup is absent, there was not attempt to detect if IPv4 forwarding was enabled and therefore, docker was printing a warning for each command spawning a new container. The test for IPv4 forwarding was guarded by the test for memory cgroup. --- runtime.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime.go b/runtime.go index 894028354e..0f97c01cba 100644 --- a/runtime.go +++ b/runtime.go @@ -241,12 +241,12 @@ func (runtime *Runtime) UpdateCapabilities(quiet bool) { if !runtime.capabilities.SwapLimit && !quiet { log.Printf("WARNING: Your kernel does not support cgroup swap limit.") } + } - content, err3 := ioutil.ReadFile("/proc/sys/net/ipv4/ip_forward") - runtime.capabilities.IPv4Forwarding = err3 == nil && len(content) > 0 && content[0] == '1' - if !runtime.capabilities.IPv4Forwarding && !quiet { - log.Printf("WARNING: IPv4 forwarding is disabled.") - } + content, err3 := ioutil.ReadFile("/proc/sys/net/ipv4/ip_forward") + runtime.capabilities.IPv4Forwarding = err3 == nil && len(content) > 0 && content[0] == '1' + if !runtime.capabilities.IPv4Forwarding && !quiet { + log.Printf("WARNING: IPv4 forwarding is disabled.") } } From 529ee848da1f1dd4b628c3396289b4bcffdbd540 Mon Sep 17 00:00:00 2001 From: Laurie Voss Date: Sun, 11 Aug 2013 17:27:47 -0700 Subject: [PATCH 15/24] Adding a reference to ps -a It was confusing to me as a first-time user that my docker attach command failed; I was expecting the container to run continuously, and when I couldn't attach to it, I assumed something was wrong. ps -a shows that the container still exists, which gives the user confidence to go to the next step. --- docs/sources/examples/python_web_app.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/sources/examples/python_web_app.rst b/docs/sources/examples/python_web_app.rst index ed4a490c72..dae46d66d8 100644 --- a/docs/sources/examples/python_web_app.rst +++ b/docs/sources/examples/python_web_app.rst @@ -36,7 +36,13 @@ Inside of the "shykes/pybuilder" image there is a command called buildapp, we ar docker attach $BUILD_JOB [...] -We attach to the new container to see what is going on. Ctrl-C to disconnect +While this container is running, we can attach to the new container to see what is going on. Ctrl-C to disconnect. + +.. code-block:: bash + + docker ps -a + +List all docker containers. If this container has already finished running, it will still be listed here. .. code-block:: bash From def9598ed968eac934699db1b8717f852652b1ef Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Mon, 12 Aug 2013 05:22:33 +0100 Subject: [PATCH 16/24] Install websocket library before building docker --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 46f9b585c8..7430ec6c0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,9 @@ run echo 'deb http://archive.ubuntu.com/ubuntu precise main universe' > /etc/apt run apt-get update run apt-get install -y lxc run apt-get install -y aufs-tools +# Docker requires code.google.com/p/go.net/websocket +run apt-get install -y -q mercurial +run PKG=code.google.com/p/go.net REV=78ad7f42aa2e; hg clone https://$PKG /go/src/$PKG && cd /go/src/$PKG && hg checkout -r $REV # Upload docker source add . /go/src/github.com/dotcloud/docker # Build the binary From d52c1490753cb924aa2aeeefc92fbe7a985f4cd3 Mon Sep 17 00:00:00 2001 From: Zaiste! Date: Mon, 12 Aug 2013 12:03:43 +0200 Subject: [PATCH 17/24] docs/postgresql: PostgreSQL service on Docker example --- docs/sources/examples/index.rst | 3 +- docs/sources/examples/postgresql_service.rst | 149 +++++++++++++++++++ 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 docs/sources/examples/postgresql_service.rst diff --git a/docs/sources/examples/index.rst b/docs/sources/examples/index.rst index d017f641b1..58da18e344 100644 --- a/docs/sources/examples/index.rst +++ b/docs/sources/examples/index.rst @@ -1,6 +1,6 @@ :title: Docker Examples :description: Examples on how to use Docker -:keywords: docker, hello world, node, nodejs, python, couch, couchdb, redis, ssh, sshd, examples +:keywords: docker, hello world, node, nodejs, python, couch, couchdb, redis, ssh, sshd, examples, postgresql @@ -20,3 +20,4 @@ Contents: running_redis_service running_ssh_service couchdb_data_volumes + postgresql_service diff --git a/docs/sources/examples/postgresql_service.rst b/docs/sources/examples/postgresql_service.rst new file mode 100644 index 0000000000..c829a53a86 --- /dev/null +++ b/docs/sources/examples/postgresql_service.rst @@ -0,0 +1,149 @@ +:title: PostgreSQL service How-To +:description: Running and installing a PostgreSQL service +:keywords: docker, example, package installation, postgresql + +.. _postgresql_service: + +PostgreSQL Service +================== + +.. note:: + + A shorter version of `this blog post`_. + +.. _this blog post: http://zaiste.net/2013/08/docker_postgresql_how_to/ + +Installing PostgreSQL on Docker +------------------------------- + +For clarity I won't be showing commands output. + +Run an interactive shell in Docker container. + +.. code-block:: bash + + docker run -i -t base /bin/bash + +Update its dependencies. + +.. code-block:: bash + + apt-get update + +Install ``python-software-properies``. + +.. code-block:: bash + + apt-get install python-software-properties + apt-get install software-properties-common + +Add Pitti's PostgreSQL repository. It contains the most recent stable release +of PostgreSQL i.e. ``9.2``. + +.. code-block:: bash + + add-apt-repository ppa:pitti/postgresql + apt-get update + +Finally, install PostgreSQL 9.2 + +.. code-block:: bash + + apt-get -y install postgresql-9.2 postgresql-client-9.2 postgresql-contrib-9.2 + +Now, create a PostgreSQL superuser role that can create databases and other roles. +Following Vagrant's convention the role will be named `docker` with `docker` +password assigned to it. + +.. code-block:: bash + + sudo -u postgres createuser -P -d -r -s docker + +Create a test database also named ``docker`` owned by previously created ``docker`` +role. + +.. code-block:: bash + + sudo -u postgres createdb -O docker docker + +Adjust PostgreSQL configuration so that remote connections to the database are +possible. Make sure that inside ``/etc/postgresql/9.2/main/pg_hba.conf`` you have +following line: + +.. code-block:: bash + + host all all 0.0.0.0/0 md5 + +Additionaly, inside ``/etc/postgresql/9.2/main/postgresql.conf`` uncomment +``listen_address`` so it is as follows: + +.. code-block:: bash + + listen_address='*' + +*Note:* this PostgreSQL setup is for development only purposes. Refer to +PostgreSQL documentation how to fine-tune these settings so that it is enough +secure. + +Create an image and assign it a name. ```` is in the Bash prompt; +you can also locate it using ``docker ps -a``. + +.. code-block:: bash + + docker commit /postgresql + +Finally, run PostgreSQL server via ``docker``. + +.. code-block:: bash + + CONTAINER=$(docker run -d -p 5432 \ + -t /postgresql \ + /bin/su postgres -c '/usr/lib/postgresql/9.2/bin/postgres \ + -D /var/lib/postgresql/9.2/main \ + -c config_file=/etc/postgresql/9.2/main/postgresql.conf') + +Connect the PostgreSQL server using ``psql``. + +.. code-block:: bash + + CONTAINER_IP=$(docker inspect $CONTAINER | grep IPAddress | awk '{ print $2 }' | tr -d ',"') + psql -h $CONTAINER_IP -p 5432 -d docker -U docker -W + +As before, create roles or databases if needed. + +.. code-block:: bash + + psql (9.2.4) + Type "help" for help. + + docker=# CREATE DATABASE foo OWNER=docker; + CREATE DATABASE + +Additionally, publish there your newly created image on Docker Index. + +.. code-block:: bash + + docker login + Username: + [...] + +.. code-block:: bash + + docker push /postgresql + +PostgreSQL service auto-launch +------------------------------ + +Running our image seems complicated. We have to specify the whole command with +``docker run``. Let's simplify it so the service starts automatically when the +container starts. + +.. code-block:: bash + + docker commit /postgresql -run='{"Cmd": \ + ["/bin/su", "postgres", "-c", "/usr/lib/postgresql/9.2/bin/postgres -D \ + /var/lib/postgresql/9.2/main -c \ + config_file=/etc/postgresql/9.2/main/postgresql.conf"], PortSpecs": ["5432"]} + +From now on, just type ``docker run /postgresql`` and PostgreSQL +should automatically start. From 3af60bf37565de35643c95eae9fd4ddc863c21fc Mon Sep 17 00:00:00 2001 From: Zaiste! Date: Mon, 12 Aug 2013 15:30:52 +0200 Subject: [PATCH 18/24] fix/docs: ubuntu instead of base, note about root-only --- docs/sources/examples/postgresql_service.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/sources/examples/postgresql_service.rst b/docs/sources/examples/postgresql_service.rst index c829a53a86..4ed1ca4bed 100644 --- a/docs/sources/examples/postgresql_service.rst +++ b/docs/sources/examples/postgresql_service.rst @@ -11,18 +11,27 @@ PostgreSQL Service A shorter version of `this blog post`_. +.. note:: + + As of version 0.5.2, docker requires root privileges to run. + You have to either manually adjust your system configuration (permissions on + /var/run/docker.sock or sudo config), or prefix `docker` with `sudo`. Check + `this thread`_ for details. + .. _this blog post: http://zaiste.net/2013/08/docker_postgresql_how_to/ +.. _this thread: https://groups.google.com/forum/?fromgroups#!topic/docker-club/P3xDLqmLp0E Installing PostgreSQL on Docker ------------------------------- For clarity I won't be showing commands output. + Run an interactive shell in Docker container. .. code-block:: bash - docker run -i -t base /bin/bash + docker run -i -t ubuntu /bin/bash Update its dependencies. From 9b2a5964fc2067014f24e26bd2f99873751ebdc3 Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Mon, 12 Aug 2013 18:53:06 +0100 Subject: [PATCH 19/24] Fixed typos --- api_test.go | 10 +++++----- archive.go | 2 +- buildfile.go | 2 +- commands.go | 2 +- commands_test.go | 2 +- container_test.go | 8 ++++---- docker/docker.go | 2 +- docs/README.md | 2 +- docs/sources/api/docker_remote_api.rst | 4 ++-- docs/sources/api/docker_remote_api_v1.1.rst | 4 ++-- docs/sources/api/docker_remote_api_v1.2.rst | 4 ++-- docs/sources/api/docker_remote_api_v1.3.rst | 4 ++-- docs/sources/api/docker_remote_api_v1.4.rst | 4 ++-- docs/sources/api/registry_index_spec.rst | 2 +- docs/sources/conf.py | 2 +- docs/sources/contributing/contributing.rst | 2 +- docs/sources/examples/running_ssh_service.rst | 4 ++-- docs/sources/index.rst | 2 +- docs/sources/installation/rackspace.rst | 2 +- docs/sources/terms/layer.rst | 2 +- docs/sources/use/workingwithrepository.rst | 4 ++-- network.go | 4 ++-- server.go | 10 +++++----- server_test.go | 8 ++++---- utils/utils_test.go | 2 +- 25 files changed, 47 insertions(+), 47 deletions(-) diff --git a/api_test.go b/api_test.go index 9ab00cd759..fb065bb27e 100644 --- a/api_test.go +++ b/api_test.go @@ -471,7 +471,7 @@ func TestGetContainersTop(t *testing.T) { } defer runtime.Destroy(container) defer func() { - // Make sure the process dies before destorying runtime + // Make sure the process dies before destroying runtime container.stdin.Close() container.WaitTimeout(2 * time.Second) }() @@ -563,7 +563,7 @@ func TestGetContainersByName(t *testing.T) { t.Fatal(err) } if outContainer.ID != container.ID { - t.Fatalf("Wrong containers retrieved. Expected %s, recieved %s", container.ID, outContainer.ID) + t.Fatalf("Wrong containers retrieved. Expected %s, received %s", container.ID, outContainer.ID) } } @@ -802,7 +802,7 @@ func TestPostContainersStart(t *testing.T) { r = httptest.NewRecorder() if err = postContainersStart(srv, APIVERSION, r, req, map[string]string{"name": container.ID}); err == nil { - t.Fatalf("A running containter should be able to be started") + t.Fatalf("A running container should be able to be started") } if err := container.Kill(); err != nil { @@ -926,7 +926,7 @@ func TestPostContainersAttach(t *testing.T) { stdin, stdinPipe := io.Pipe() stdout, stdoutPipe := io.Pipe() - // Try to avoid the timeoout in destroy. Best effort, don't check error + // Try to avoid the timeout in destroy. Best effort, don't check error defer func() { closeWrap(stdin, stdinPipe, stdout, stdoutPipe) container.Kill() @@ -982,7 +982,7 @@ func TestPostContainersAttach(t *testing.T) { t.Fatalf("/bin/cat is not running after closing stdin") } - // Try to avoid the timeoout in destroy. Best effort, don't check error + // Try to avoid the timeout in destroy. Best effort, don't check error cStdin, _ := container.StdinPipe() cStdin.Close() container.Wait() diff --git a/archive.go b/archive.go index bb79cd34d4..bb019fb033 100644 --- a/archive.go +++ b/archive.go @@ -98,7 +98,7 @@ func TarFilter(path string, compression Compression, filter []string) (io.Reader // Untar reads a stream of bytes from `archive`, parses it as a tar archive, // and unpacks it into the directory at `path`. -// The archive may be compressed with one of the following algorithgms: +// The archive may be compressed with one of the following algorithms: // identity (uncompressed), gzip, bzip2, xz. // FIXME: specify behavior when target path exists vs. doesn't exist. func Untar(archive io.Reader, path string) error { diff --git a/buildfile.go b/buildfile.go index a4f89091d1..5a2662646e 100644 --- a/buildfile.go +++ b/buildfile.go @@ -509,7 +509,7 @@ func (b *buildFile) Build(context io.Reader) (string, error) { fmt.Fprintf(b.out, "Successfully built %s\n", utils.TruncateID(b.image)) return b.image, nil } - return "", fmt.Errorf("An error occured during the build\n") + return "", fmt.Errorf("An error occurred during the build\n") } func NewBuildFile(srv *Server, out io.Writer, verbose, utilizeCache bool) BuildFile { diff --git a/commands.go b/commands.go index c9f669b782..9b9dd51e75 100644 --- a/commands.go +++ b/commands.go @@ -194,7 +194,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error { } var body io.Reader // Setup an upload progress bar - // FIXME: ProgressReader shouldn't be this annoyning to use + // FIXME: ProgressReader shouldn't be this annoying to use if context != nil { sf := utils.NewStreamFormatter(false) body = utils.ProgressReader(ioutil.NopCloser(context), 0, cli.err, sf.FormatProgress("", "Uploading context", "%v bytes%0.0s%0.0s"), sf, true) diff --git a/commands_test.go b/commands_test.go index ddbc7f6b40..ac30cc73f9 100644 --- a/commands_test.go +++ b/commands_test.go @@ -373,7 +373,7 @@ func TestAttachDisconnect(t *testing.T) { t.Fatalf("/bin/cat is not running after closing stdin") } - // Try to avoid the timeoout in destroy. Best effort, don't check error + // Try to avoid the timeout in destroy. Best effort, don't check error cStdin, _ := container.StdinPipe() cStdin.Close() container.Wait() diff --git a/container_test.go b/container_test.go index aca53e5eb3..6aa4b94f54 100644 --- a/container_test.go +++ b/container_test.go @@ -186,7 +186,7 @@ func TestDiff(t *testing.T) { } } - // Create a new containere + // Create a new container container3, _, _ := mkContainer(runtime, []string{"_", "rm", "/bin/httpd"}, t) defer runtime.Destroy(container3) @@ -351,10 +351,10 @@ func TestStart(t *testing.T) { t.Errorf("Container should be running") } if err := container.Start(hostConfig); err == nil { - t.Fatalf("A running containter should be able to be started") + t.Fatalf("A running container should be able to be started") } - // Try to avoid the timeoout in destroy. Best effort, don't check error + // Try to avoid the timeout in destroy. Best effort, don't check error cStdin.Close() container.WaitTimeout(2 * time.Second) } @@ -764,7 +764,7 @@ func TestUser(t *testing.T) { Image: GetTestImage(runtime).ID, Cmd: []string{"id"}, - User: "unkownuser", + User: "unknownuser", }, ) if err != nil { diff --git a/docker/docker.go b/docker/docker.go index 9874d756d5..a48865bfa3 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -37,7 +37,7 @@ func main() { flag.Var(&flHosts, "H", "tcp://host:port to bind/connect to or unix://path/to/socket to use") flag.Parse() if len(flHosts) > 1 { - flHosts = flHosts[1:] //trick to display a nice defaul value in the usage + flHosts = flHosts[1:] //trick to display a nice default value in the usage } for i, flHost := range flHosts { flHosts[i] = utils.ParseHost(docker.DEFAULTHTTPHOST, docker.DEFAULTHTTPPORT, flHost) diff --git a/docs/README.md b/docs/README.md index 366b7ed8f2..d53b8675b9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -28,7 +28,7 @@ Usage Working using GitHub's file editor ---------------------------------- Alternatively, for small changes and typo's you might want to use GitHub's built in file editor. It allows -you to preview your changes right online. Just be carefull not to create many commits. +you to preview your changes right online. Just be careful not to create many commits. Images ------ diff --git a/docs/sources/api/docker_remote_api.rst b/docs/sources/api/docker_remote_api.rst index 7e4b674348..9113d8e155 100644 --- a/docs/sources/api/docker_remote_api.rst +++ b/docs/sources/api/docker_remote_api.rst @@ -26,7 +26,7 @@ Docker Remote API 2. Versions =========== -The current verson of the API is 1.4 +The current version of the API is 1.4 Calling /images//insert is the same as calling /v1.4/images//insert @@ -107,7 +107,7 @@ The client should send it's authConfig as POST on each call of 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 chidren and remove all the untagged parents if has any. + has children and remove all the untagged parents if has any. .. http:post:: /images//delete diff --git a/docs/sources/api/docker_remote_api_v1.1.rst b/docs/sources/api/docker_remote_api_v1.1.rst index 3e906ed50f..7fecdbfddd 100644 --- a/docs/sources/api/docker_remote_api_v1.1.rst +++ b/docs/sources/api/docker_remote_api_v1.1.rst @@ -305,8 +305,8 @@ Start a container :statuscode 500: server error -Stop a contaier -*************** +Stop a container +**************** .. http:post:: /containers/(id)/stop diff --git a/docs/sources/api/docker_remote_api_v1.2.rst b/docs/sources/api/docker_remote_api_v1.2.rst index b956d1dfe6..387b5a5dda 100644 --- a/docs/sources/api/docker_remote_api_v1.2.rst +++ b/docs/sources/api/docker_remote_api_v1.2.rst @@ -317,8 +317,8 @@ Start a container :statuscode 500: server error -Stop a contaier -*************** +Stop a container +**************** .. http:post:: /containers/(id)/stop diff --git a/docs/sources/api/docker_remote_api_v1.3.rst b/docs/sources/api/docker_remote_api_v1.3.rst index 8e5c7b2a3b..f1d743dd63 100644 --- a/docs/sources/api/docker_remote_api_v1.3.rst +++ b/docs/sources/api/docker_remote_api_v1.3.rst @@ -365,8 +365,8 @@ Start a container :statuscode 500: server error -Stop a contaier -*************** +Stop a container +**************** .. http:post:: /containers/(id)/stop diff --git a/docs/sources/api/docker_remote_api_v1.4.rst b/docs/sources/api/docker_remote_api_v1.4.rst index 06e8f46f99..88ba3a60af 100644 --- a/docs/sources/api/docker_remote_api_v1.4.rst +++ b/docs/sources/api/docker_remote_api_v1.4.rst @@ -368,8 +368,8 @@ Start a container :statuscode 500: server error -Stop a contaier -*************** +Stop a container +**************** .. http:post:: /containers/(id)/stop diff --git a/docs/sources/api/registry_index_spec.rst b/docs/sources/api/registry_index_spec.rst index 3ae39e37d9..a41523e813 100644 --- a/docs/sources/api/registry_index_spec.rst +++ b/docs/sources/api/registry_index_spec.rst @@ -154,7 +154,7 @@ API (pulling repository foo/bar): .. note:: - **It’s possible not to use the Index at all!** In this case, a deployed version of the Registry is deployed to store and serve images. Those images are not authentified and the security is not guaranteed. + **It’s possible not to use the Index 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:: diff --git a/docs/sources/conf.py b/docs/sources/conf.py index b4c23f0c58..8168deb241 100644 --- a/docs/sources/conf.py +++ b/docs/sources/conf.py @@ -51,7 +51,7 @@ source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' -#disable the parmalinks on headers, I find them really annoying +#disable the permalinks on headers, I find them really annoying html_add_permalinks = None diff --git a/docs/sources/contributing/contributing.rst b/docs/sources/contributing/contributing.rst index 1913cec30d..301977e5e1 100644 --- a/docs/sources/contributing/contributing.rst +++ b/docs/sources/contributing/contributing.rst @@ -1,5 +1,5 @@ :title: Contribution Guidelines -:description: Contribution guidelines: create issues, convetions, pull requests +:description: Contribution guidelines: create issues, conventions, pull requests :keywords: contributing, docker, documentation, help, guideline Contributing to Docker diff --git a/docs/sources/examples/running_ssh_service.rst b/docs/sources/examples/running_ssh_service.rst index 54ca4cd200..821ff84659 100644 --- a/docs/sources/examples/running_ssh_service.rst +++ b/docs/sources/examples/running_ssh_service.rst @@ -33,7 +33,7 @@ The password is 'screencast' .. code-block:: bash - # Hello! We are going to try and install openssh on a container and run it as a servic + # Hello! We are going to try and install openssh on a container and run it as a service # let's pull ubuntu to get a base ubuntu image. $ docker pull ubuntu # I had it so it was quick @@ -46,7 +46,7 @@ The password is 'screencast' $ apt-get install openssh-server # ok. lets see if we can run it. $ which sshd - # we need to create priviledge separation directory + # we need to create privilege separation directory $ mkdir /var/run/sshd $ /usr/sbin/sshd $ exit diff --git a/docs/sources/index.rst b/docs/sources/index.rst index ba8f60c3fa..8dfffa718b 100644 --- a/docs/sources/index.rst +++ b/docs/sources/index.rst @@ -23,7 +23,7 @@ dependencies. commit``). Each use of ``docker`` is documented here. The features of Docker are -currently in active development, so this documention will change +currently in active development, so this documentation will change frequently. For an overview of Docker, please see the `Introduction diff --git a/docs/sources/installation/rackspace.rst b/docs/sources/installation/rackspace.rst index 7482404683..7f360682e2 100644 --- a/docs/sources/installation/rackspace.rst +++ b/docs/sources/installation/rackspace.rst @@ -10,7 +10,7 @@ Rackspace Cloud :ref:`ubuntu_linux` installation path. This version may sometimes be out of date. -Installing Docker on Ubuntu proviced by Rackspace is pretty straightforward, and you should mostly be able to follow the +Installing Docker on Ubuntu provided by Rackspace is pretty straightforward, and you should mostly be able to follow the :ref:`ubuntu_linux` installation guide. **However, there is one caveat:** diff --git a/docs/sources/terms/layer.rst b/docs/sources/terms/layer.rst index 981194b6a3..509dbe5cba 100644 --- a/docs/sources/terms/layer.rst +++ b/docs/sources/terms/layer.rst @@ -14,7 +14,7 @@ switches the whole rootfs volume to read-write mode. Layer ..... -When Docker mounts the rootfs, it starts read-only, as in a tradtional +When Docker mounts the rootfs, it starts read-only, as in a traditional Linux boot, but then, instead of changing the file system to read-write mode, it takes advantage of a `union mount `_ to add a read-write file diff --git a/docs/sources/use/workingwithrepository.rst b/docs/sources/use/workingwithrepository.rst index 4a2e39aea1..b1ed6fc633 100644 --- a/docs/sources/use/workingwithrepository.rst +++ b/docs/sources/use/workingwithrepository.rst @@ -1,6 +1,6 @@ :title: Working With Repositories :description: Repositories allow users to share images. -:keywords: repo, repositiores, usage, pull image, push image, image, documentation +:keywords: repo, repositories, usage, pull image, push image, image, documentation .. _working_with_the_repository: @@ -71,7 +71,7 @@ function completely independently from the Central Index. Find public images available on the Central Index ------------------------------------------------- -Seach by name, namespace or description +Search by name, namespace or description .. code-block:: bash diff --git a/network.go b/network.go index b289934295..dd0fe2dd41 100644 --- a/network.go +++ b/network.go @@ -332,7 +332,7 @@ func newPortMapper() (*PortMapper, error) { return mapper, nil } -// Port allocator: Atomatically allocate and release networking ports +// Port allocator: Automatically allocate and release networking ports type PortAllocator struct { sync.Mutex inUse map[int]struct{} @@ -385,7 +385,7 @@ func newPortAllocator() (*PortAllocator, error) { return allocator, nil } -// IP allocator: Atomatically allocate and release networking ports +// IP allocator: Automatically allocate and release networking ports type IPAllocator struct { network *net.IPNet queueAlloc chan allocatedIP diff --git a/server.go b/server.go index f06b5ce68e..16b59dc83d 100644 --- a/server.go +++ b/server.go @@ -425,7 +425,7 @@ func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgID, endpoin out.Write(sf.FormatProgress(utils.TruncateID(id), "Pulling", "metadata")) imgJSON, imgSize, err := r.GetRemoteImageJSON(id, endpoint, token) if err != nil { - // FIXME: Keep goging in case of error? + // FIXME: Keep going in case of error? return err } img, err := NewImgJSON(imgJSON) @@ -565,7 +565,7 @@ func (srv *Server) poolAdd(kind, key string) error { srv.pushingPool[key] = struct{}{} break default: - return fmt.Errorf("Unkown pool type") + return fmt.Errorf("Unknown pool type") } return nil } @@ -579,7 +579,7 @@ func (srv *Server) poolRemove(kind, key string) error { delete(srv.pushingPool, key) break default: - return fmt.Errorf("Unkown pool type") + return fmt.Errorf("Unknown pool type") } return nil } @@ -693,7 +693,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgID, out = utils.NewWriteFlusher(out) jsonRaw, err := ioutil.ReadFile(path.Join(srv.runtime.graph.Root, imgID, "json")) if err != nil { - return "", fmt.Errorf("Error while retreiving the path for {%s}: %s", imgID, err) + return "", fmt.Errorf("Error while retrieving the path for {%s}: %s", imgID, err) } out.Write(sf.FormatStatus("", "Pushing %s", imgID)) @@ -731,7 +731,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgID, return imgData.Checksum, nil } -// FIXME: Allow to interupt current push when new push of same image is done. +// FIXME: Allow to interrupt current push when new push of same image is done. func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig) error { if err := srv.poolAdd("push", localName); err != nil { return err diff --git a/server_test.go b/server_test.go index b66c44427e..b7ffbb7e6f 100644 --- a/server_test.go +++ b/server_test.go @@ -283,8 +283,8 @@ func TestPools(t *testing.T) { t.Fatalf("Expected `pull test1 is already in progress`") } err = srv.poolAdd("wait", "test3") - if err == nil || err.Error() != "Unkown pool type" { - t.Fatalf("Expected `Unkown pool type`") + if err == nil || err.Error() != "Unknown pool type" { + t.Fatalf("Expected `Unknown pool type`") } err = srv.poolRemove("pull", "test2") @@ -304,8 +304,8 @@ func TestPools(t *testing.T) { t.Fatal(err) } err = srv.poolRemove("wait", "test3") - if err == nil || err.Error() != "Unkown pool type" { - t.Fatalf("Expected `Unkown pool type`") + if err == nil || err.Error() != "Unknown pool type" { + t.Fatalf("Expected `Unknown pool type`") } } diff --git a/utils/utils_test.go b/utils/utils_test.go index d8ba7f1c31..1030b2902a 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -219,7 +219,7 @@ func assertIndexGet(t *testing.T, index *TruncIndex, input, expectedResult strin func assertKernelVersion(t *testing.T, a, b *KernelVersionInfo, result int) { if r := CompareKernelVersion(a, b); r != result { - t.Fatalf("Unepected kernel version comparaison result. Found %d, expected %d", r, result) + t.Fatalf("Unexpected kernel version comparison result. Found %d, expected %d", r, result) } } From 999a8d72492c7937aa9f826406ae40158017f766 Mon Sep 17 00:00:00 2001 From: Daniel Mizyrycki Date: Mon, 12 Aug 2013 15:15:52 -0700 Subject: [PATCH 20/24] API, issue 1471: Allow users belonging to the docker group to use the docker client --- api.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/api.go b/api.go index c9ac15bc53..18f42c446d 100644 --- a/api.go +++ b/api.go @@ -15,6 +15,7 @@ import ( "net/http" "os" "os/exec" + "regexp" "strconv" "strings" ) @@ -1086,7 +1087,25 @@ func ListenAndServe(proto, addr string, srv *Server, logging bool) error { return e } if proto == "unix" { - os.Chmod(addr, 0700) + if err := os.Chmod(addr, 0660); err != nil { + return err + } + + groups, err := ioutil.ReadFile("/etc/group") + if err != nil { + return err + } + re := regexp.MustCompile("(^|\n)docker:.*?:([0-9]+)") + if gidMatch := re.FindStringSubmatch(string(groups)); gidMatch != nil { + gid, err := strconv.Atoi(gidMatch[2]) + if err != nil { + return err + } + utils.Debugf("docker group found. gid: %d", gid) + if err := os.Chown(addr, 0, gid); err != nil { + return err + } + } } httpSrv := http.Server{Addr: addr, Handler: r} return httpSrv.Serve(l) From 6cb908bb823409661bfedab806da924d232bf200 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 13 Aug 2013 13:35:34 +0000 Subject: [PATCH 21/24] fix merge issue --- commands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 9b9dd51e75..d9d4f1b620 100644 --- a/commands.go +++ b/commands.go @@ -857,7 +857,7 @@ func (cli *DockerCli) CmdPush(args ...string) error { } if err := push(); err != nil { - if err == fmt.Errorf("Authentication is required.") { + if err.Error() == "Authentication is required." { if err = cli.checkIfLogged("push"); err == nil { return push() } From 2ba1300773857273585288c79aa65f011b045b4c Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 13 Aug 2013 13:51:49 +0000 Subject: [PATCH 22/24] remove checkIfLogged --- commands.go | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/commands.go b/commands.go index d9d4f1b620..8cefe3408f 100644 --- a/commands.go +++ b/commands.go @@ -858,9 +858,11 @@ func (cli *DockerCli) CmdPush(args ...string) error { if err := push(); err != nil { if err.Error() == "Authentication is required." { - if err = cli.checkIfLogged("push"); err == nil { - return push() + fmt.Fprintln(cli.out, "\nPlease login prior to push:") + if err := cli.CmdLogin(""); err != nil { + return err } + return push() } return err } @@ -1512,19 +1514,6 @@ func (cli *DockerCli) CmdCp(args ...string) error { return nil } -func (cli *DockerCli) checkIfLogged(action string) error { - // If condition AND the login failed - if cli.configFile.Configs[auth.IndexServerAddress()].Username == "" { - if err := cli.CmdLogin(""); err != nil { - return err - } - if cli.configFile.Configs[auth.IndexServerAddress()].Username == "" { - return fmt.Errorf("Please login prior to %s. ('docker login')", action) - } - } - return nil -} - func (cli *DockerCli) call(method, path string, data interface{}) ([]byte, int, error) { var params io.Reader if data != nil { From e09863fedb1b2fec4672d2d1ebad29ecdb8eed1a Mon Sep 17 00:00:00 2001 From: unclejack Date: Tue, 13 Aug 2013 19:48:30 +0300 Subject: [PATCH 23/24] use Go 1.1.2 for dockerbuilder --- hack/dockerbuilder/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/dockerbuilder/Dockerfile b/hack/dockerbuilder/Dockerfile index 60cd93b17a..496ee45e7a 100644 --- a/hack/dockerbuilder/Dockerfile +++ b/hack/dockerbuilder/Dockerfile @@ -23,7 +23,7 @@ run add-apt-repository -y ppa:dotcloud/docker-golang/ubuntu run apt-get update # Packages required to checkout, build and upload docker run DEBIAN_FRONTEND=noninteractive apt-get install -y -q s3cmd curl -run curl -s -o /go.tar.gz https://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz +run curl -s -o /go.tar.gz https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz run tar -C /usr/local -xzf /go.tar.gz run echo "export PATH=/usr/local/go/bin:$PATH" > /.bashrc run echo "export PATH=/usr/local/go/bin:$PATH" > /.bash_profile From e2409ad3376baeb36d1011732f7d7b1a239320ae Mon Sep 17 00:00:00 2001 From: Andy Rothfusz Date: Tue, 13 Aug 2013 13:45:07 -0700 Subject: [PATCH 24/24] Added information about Docker's high level tools over LXC. Formatting cleanup. Mailing list cleanup. --- docs/sources/api/registry_index_spec.rst | 3 +- docs/sources/faq.rst | 124 ++++++++++++++++++++--- docs/sources/use/builder.rst | 2 + 3 files changed, 116 insertions(+), 13 deletions(-) diff --git a/docs/sources/api/registry_index_spec.rst b/docs/sources/api/registry_index_spec.rst index a41523e813..4ea0c687db 100644 --- a/docs/sources/api/registry_index_spec.rst +++ b/docs/sources/api/registry_index_spec.rst @@ -2,9 +2,10 @@ :description: Documentation for docker Registry and Registry API :keywords: docker, registry, api, index +.. _registryindexspec: ===================== -Registry & index Spec +Registry & Index Spec ===================== .. contents:: Table of Contents diff --git a/docs/sources/faq.rst b/docs/sources/faq.rst index 3cc0086c5d..dd5fd11fd5 100644 --- a/docs/sources/faq.rst +++ b/docs/sources/faq.rst @@ -9,40 +9,140 @@ FAQ Most frequently asked questions. -------------------------------- -1. **How much does Docker cost?** +How much does Docker cost? +.......................... Docker is 100% free, it is open source, so you can use it without paying. -2. **What open source license are you using?** +What open source license are you using? +....................................... - We are using the Apache License Version 2.0, see it here: https://github.com/dotcloud/docker/blob/master/LICENSE + We are using the Apache License Version 2.0, see it here: + https://github.com/dotcloud/docker/blob/master/LICENSE -3. **Does Docker run on Mac OS X or Windows?** +Does Docker run on Mac OS X or Windows? +....................................... - Not at this time, Docker currently only runs 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 :ref:`install_using_vagrant` and :ref:`windows` installation guides. + Not at this time, Docker currently only runs 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 + :ref:`install_using_vagrant` and :ref:`windows` installation + guides. -4. **How do containers compare to virtual machines?** +How do containers compare to virtual machines? +.............................................. - They are complementary. VMs are best used to allocate chunks of hardware resources. Containers operate at the process level, which makes them very lightweight and perfect as a unit of software delivery. + They are complementary. VMs are best used to allocate chunks of + hardware resources. Containers operate at the process level, which + makes them very lightweight and perfect as a unit of software + delivery. -5. **Can I help by adding some questions and answers?** +What does Docker add to just plain LXC? +....................................... + + Docker is not a replacement for LXC. "LXC" refers to capabilities + of the Linux kernel (specifically namespaces and control groups) + which allow sandboxing processes from one another, and controlling + their resource allocations. On top of this low-level foundation of + kernel features, Docker offers a high-level tool with several + powerful functionalities: + + * *Portable deployment across machines.* + Docker defines a format for bundling an application and all its + dependencies into a single object which can be transferred to + any Docker-enabled machine, and executed there with the + guarantee that the execution environment exposed to the + application will be the same. LXC implements process sandboxing, + which is an important pre-requisite for portable deployment, but + that alone is not enough for portable deployment. If you sent me + a copy of your application installed in a custom LXC + configuration, it would almost certainly not run on my machine + the way it does on yours, because it is tied to your machine's + specific configuration: networking, storage, logging, distro, + etc. Docker defines an abstraction for these machine-specific + settings, so that the exact same Docker container can run - + unchanged - on many different machines, with many different + configurations. + + * *Application-centric.* + Docker is optimized for the deployment of applications, as + opposed to machines. This is reflected in its API, user + interface, design philosophy and documentation. By contrast, the + ``lxc`` helper scripts focus on containers as lightweight + machines - basically servers that boot faster and need less + RAM. We think there's more to containers than just that. + + * *Automatic build.* + Docker includes :ref:`a tool for developers to automatically + assemble a container from their source code `, + with full control over application dependencies, build tools, + packaging etc. They are free to use ``make, maven, chef, puppet, + salt,`` Debian packages, RPMs, source tarballs, or any + combination of the above, regardless of the configuration of the + machines. + + * *Versioning.* + Docker includes git-like capabilities for tracking successive + versions of a container, inspecting the diff between versions, + committing new versions, rolling back etc. The history also + includes how a container was assembled and by whom, so you get + full traceability from the production server all the way back to + the upstream developer. Docker also implements incremental + uploads and downloads, similar to ``git pull``, so new versions + of a container can be transferred by only sending diffs. + + * *Component re-use.* + Any container can be used as a :ref:`"base image" + ` to create more specialized components. This + can be done manually or as part of an automated build. For + example you can prepare the ideal Python environment, and use it + as a base for 10 different applications. Your ideal Postgresql + setup can be re-used for all your future projects. And so on. + + * *Sharing.* + Docker has access to a `public registry + `_ 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 for various Linux distros. The :ref:`registry + ` also includes an official "standard + library" of useful containers maintained by the Docker team. The + registry itself is open-source, so anyone can deploy their own + registry to store and transfer private containers, for internal + server deployments for example. + + * *Tool ecosystem.* + Docker defines an API for automating and customizing the + creation and deployment of containers. There are a huge number + of tools integrating with Docker to extend its + capabilities. PaaS-like deployment (Dokku, Deis, Flynn), + multi-node orchestration (Maestro, Salt, Mesos, Openstack Nova), + management dashboards (docker-ui, Openstack Horizon, Shipyard), + configuration management (Chef, Puppet), continuous integration + (Jenkins, Strider, Travis), etc. Docker is rapidly establishing + itself as the standard for container-based tooling. + +Can I help by adding some questions and answers? +................................................ Definitely! You can fork `the repo`_ and edit the documentation sources. -42. **Where can I find more answers?** +Where can I find more answers? +.............................. You can find more answers on: - * `Docker club mailinglist`_ + * `Docker user mailinglist`_ + * `Docker developer mailinglist`_ * `IRC, docker on freenode`_ * `Github`_ * `Ask questions on Stackoverflow`_ * `Join the conversation on Twitter`_ - .. _Docker club mailinglist: https://groups.google.com/d/forum/docker-club + .. _Docker user mailinglist: https://groups.google.com/d/forum/docker-user + .. _Docker developer mailinglist: https://groups.google.com/d/forum/docker-dev .. _the repo: http://www.github.com/dotcloud/docker .. _IRC, docker on freenode: irc://chat.freenode.net#docker .. _Github: http://www.github.com/dotcloud/docker diff --git a/docs/sources/use/builder.rst b/docs/sources/use/builder.rst index d111e335ab..293ad32063 100644 --- a/docs/sources/use/builder.rst +++ b/docs/sources/use/builder.rst @@ -2,6 +2,8 @@ :description: Dockerfiles use a simple DSL which allows you to automate the steps you would normally manually take to create an image. :keywords: builder, docker, Dockerfile, automation, image creation +.. _dockerbuilder: + ================== Dockerfile Builder ==================