... | ... |
@@ -76,7 +76,7 @@ Installing on Ubuntu 12.04 and 12.10 |
76 | 76 |
|
77 | 77 |
```bash |
78 | 78 |
cd docker-master |
79 |
- sudo ./docker run -a -i -t base /bin/bash |
|
79 |
+ sudo ./docker run -i -t base /bin/bash |
|
80 | 80 |
``` |
81 | 81 |
|
82 | 82 |
Consider adding docker to your `PATH` for simplicity. |
... | ... |
@@ -136,7 +136,7 @@ docker import base |
136 | 136 |
|
137 | 137 |
# Run an interactive shell in the base image, |
138 | 138 |
# allocate a tty, attach stdin and stdout |
139 |
-docker run -a -i -t base /bin/bash |
|
139 |
+docker run -i -t base /bin/bash |
|
140 | 140 |
``` |
141 | 141 |
|
142 | 142 |
|
... | ... |
@@ -148,7 +148,7 @@ Starting a long-running worker process |
148 | 148 |
(docker -d || echo "Docker daemon already running") & |
149 | 149 |
|
150 | 150 |
# Start a very useful long-running process |
151 |
-JOB=$(docker run base /bin/sh -c "while true; do echo Hello world; sleep 1; done") |
|
151 |
+JOB=$(docker run -d base /bin/sh -c "while true; do echo Hello world; sleep 1; done") |
|
152 | 152 |
|
153 | 153 |
# Collect the output of the job so far |
154 | 154 |
docker logs $JOB |
... | ... |
@@ -171,7 +171,7 @@ Expose a service on a TCP port |
171 | 171 |
|
172 | 172 |
```bash |
173 | 173 |
# Expose port 4444 of this container, and tell netcat to listen on it |
174 |
-JOB=$(docker run -p 4444 base /bin/nc -l -p 4444) |
|
174 |
+JOB=$(docker run -d -p 4444 base /bin/nc -l -p 4444) |
|
175 | 175 |
|
176 | 176 |
# Which public port is NATed to my container? |
177 | 177 |
PORT=$(docker port $JOB 4444) |
... | ... |
@@ -794,7 +794,7 @@ func (srv *Server) CmdTag(stdin io.ReadCloser, stdout io.Writer, args ...string) |
794 | 794 |
func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string) error { |
795 | 795 |
cmd := rcli.Subcmd(stdout, "run", "[OPTIONS] IMAGE COMMAND [ARG...]", "Run a command in a new container") |
796 | 796 |
fl_user := cmd.String("u", "", "Username or UID") |
797 |
- fl_attach := cmd.Bool("a", false, "Attach stdin and stdout") |
|
797 |
+ fl_detach := cmd.Bool("d", false, "Detached mode: leave the container running in the background") |
|
798 | 798 |
fl_stdin := cmd.Bool("i", false, "Keep stdin open even if not attached") |
799 | 799 |
fl_tty := cmd.Bool("t", false, "Allocate a pseudo-tty") |
800 | 800 |
fl_memory := cmd.Int64("m", 0, "Memory limit (in bytes)") |
... | ... |
@@ -821,7 +821,6 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string) |
821 | 821 |
if len(cmdline) == 0 { |
822 | 822 |
*fl_stdin = true |
823 | 823 |
*fl_tty = true |
824 |
- *fl_attach = true |
|
825 | 824 |
cmdline = []string{"/bin/bash", "-i"} |
826 | 825 |
} |
827 | 826 |
|
... | ... |
@@ -843,7 +842,7 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string) |
843 | 843 |
if err != nil { |
844 | 844 |
return err |
845 | 845 |
} |
846 |
- if *fl_attach { |
|
846 |
+ if !*fl_detach { |
|
847 | 847 |
Go(func() error { |
848 | 848 |
_, err := io.Copy(cmd_stdin, stdin) |
849 | 849 |
cmd_stdin.Close() |
... | ... |
@@ -852,7 +851,7 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string) |
852 | 852 |
} |
853 | 853 |
} |
854 | 854 |
// Run the container |
855 |
- if *fl_attach { |
|
855 |
+ if !*fl_detach { |
|
856 | 856 |
cmd_stderr, err := container.StderrPipe() |
857 | 857 |
if err != nil { |
858 | 858 |
return err |