May 2017
Beginner
552 pages
28h 47m
English
The docker attach command attaches your display to the tty session in a running container. You need to run as the root within this container.
To exit an attached session, type ^P^Q.
This example creates an HTML page and starts the Apache web server in the container:
$ docker attach leph1
root@131aaaeeac79:/# cd /var/www
root@131aaaeeac79:/var/www# mkdir symfony
root@131aaaeeac79:/var/www# mkdir symfony/web
root@131aaaeeac79:/var/www# cd symfony/web
root@131aaaeeac79:/var/www/symfony/web# echo "<html><body><h1>It's Alive</h1></body></html>"
>index.html
root@131aaaeeac79:/# cd /etc/init.d
root@131aaaeeac79:/etc/init.d# ./apache2 start
[....] Starting web server: apache2/usr/sbin/apache2ctl: ...