Docker attach

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

Attaches the invoking shell's stdin, stdout and stderr to the container specified as argument. Attachment will only succeed if the target container was started in interactive mode. The container to attach to should be started in interactive mode, giving the ability to type into it, and with a TTY so you can see the input and output:

docker run [-d] -i alpine1 alpine ash

Then, the attachment can be performed later:

docker attach alpine1