github.com/eikeon/docker@v1.5.0-rc4/docs/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  If you **docker run** a container in detached mode (**-d**), you can reattach to
    16  the detached container with **docker attach** using the container's ID or name.
    17  
    18  You can detach from the container again (and leave it running) with `CTRL-p 
    19  CTRL-q` (for a quiet exit), or `CTRL-c`  which will send a SIGKILL to the
    20  container, or `CTRL-\` to get a stacktrace of the Docker client when it quits.
    21  When you detach from a container the exit code will be returned to
    22  the client.
    23  
    24  It is forbidden to redirect the standard input of a docker attach command while
    25  attaching to a tty-enabled container (i.e.: launched with -t`).
    26  
    27  # OPTIONS
    28  **--help**
    29    Print usage statement
    30  
    31  **--no-stdin**=*true*|*false*
    32     Do not attach STDIN. The default is *false*.
    33  
    34  **--sig-proxy**=*true*|*false*
    35     Proxy all received signals to the process (non-TTY mode only). SIGCHLD, SIGKILL, and SIGSTOP are not proxied. The default is *true*.
    36  
    37  # EXAMPLES
    38  
    39  ## Attaching to a container
    40  
    41  In this example the top command is run inside a container, from an image called
    42  fedora, in detached mode. The ID from the container is passed into the **docker
    43  attach** command:
    44  
    45      # ID=$(sudo docker run -d fedora /usr/bin/top -b)
    46      # sudo docker attach $ID
    47      top - 02:05:52 up  3:05,  0 users,  load average: 0.01, 0.02, 0.05
    48      Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
    49      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
    50      Mem:    373572k total,   355560k used,    18012k free,    27872k buffers
    51      Swap:   786428k total,        0k used,   786428k free,   221740k cached
    52  
    53      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    54      1 root      20   0 17200 1116  912 R    0  0.3   0:00.03 top
    55  
    56      top - 02:05:55 up  3:05,  0 users,  load average: 0.01, 0.02, 0.05
    57      Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
    58      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
    59      Mem:    373572k total,   355244k used,    18328k free,    27872k buffers
    60      Swap:   786428k total,        0k used,   786428k free,   221776k cached
    61  
    62      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    63      1 root      20   0 17208 1144  932 R    0  0.3   0:00.03 top
    64  
    65  # HISTORY
    66  April 2014, Originally compiled by William Henry (whenry at redhat dot com)
    67  based on docker.com source material and internal work.
    68  June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>