github.com/gunjan5/docker@v1.8.2/man/docker-attach.1.md (about)

     1  % DOCKER(1) Docker User Manuals
     2  % Docker Community
     3  % JUNE 2014
     4  # NAME
     5  docker-attach - Attach to a running container
     6  
     7  # SYNOPSIS
     8  **docker attach**
     9  [**--help**]/
    10  [**--no-stdin**[=*false*]]
    11  [**--sig-proxy**[=*true*]]
    12  CONTAINER
    13  
    14  # DESCRIPTION
    15  The **docker attach** command allows you to attach to a running container using
    16  the container's ID or name, either to view its ongoing output or to control it
    17  interactively.  You can attach to the same contained process multiple times
    18  simultaneously, screen sharing style, or quickly view the progress of your
    19  daemonized process.
    20  
    21  You can detach from the container (and leave it running) with `CTRL-p CTRL-q`
    22  (for a quiet exit) or `CTRL-c` which will send a `SIGKILL` to the container.
    23  When you are attached to a container, and exit its main process, the process's
    24  exit code will be returned to the client.
    25  
    26  It is forbidden to redirect the standard input of a `docker attach` command while
    27  attaching to a tty-enabled container (i.e.: launched with `-t`).
    28  
    29  # OPTIONS
    30  **--help**
    31    Print usage statement
    32  
    33  **--no-stdin**=*true*|*false*
    34     Do not attach STDIN. The default is *false*.
    35  
    36  **--sig-proxy**=*true*|*false*
    37     Proxy all received signals to the process (non-TTY mode only). SIGCHLD, SIGKILL, and SIGSTOP are not proxied. The default is *true*.
    38  
    39  # EXAMPLES
    40  
    41  ## Attaching to a container
    42  
    43  In this example the top command is run inside a container, from an image called
    44  fedora, in detached mode. The ID from the container is passed into the **docker
    45  attach** command:
    46  
    47      # ID=$(sudo docker run -d fedora /usr/bin/top -b)
    48      # sudo docker attach $ID
    49      top - 02:05:52 up  3:05,  0 users,  load average: 0.01, 0.02, 0.05
    50      Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
    51      Cpu(s):  0.1%us,  0.2%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    52      Mem:    373572k total,   355560k used,    18012k free,    27872k buffers
    53      Swap:   786428k total,        0k used,   786428k free,   221740k cached
    54  
    55      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    56      1 root      20   0 17200 1116  912 R    0  0.3   0:00.03 top
    57  
    58      top - 02:05:55 up  3:05,  0 users,  load average: 0.01, 0.02, 0.05
    59      Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
    60      Cpu(s):  0.0%us,  0.2%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    61      Mem:    373572k total,   355244k used,    18328k free,    27872k buffers
    62      Swap:   786428k total,        0k used,   786428k free,   221776k cached
    63  
    64      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    65      1 root      20   0 17208 1144  932 R    0  0.3   0:00.03 top
    66  
    67  # HISTORY
    68  April 2014, Originally compiled by William Henry (whenry at redhat dot com)
    69  based on docker.com source material and internal work.
    70  June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>