Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Docker

You're reading from   Learning Docker Build, ship, and scale faster

Arrow left icon
Product type Paperback
Published in May 2017
Publisher
ISBN-13 9781786462923
Length 300 pages
Edition 2nd Edition
Tools
Arrow right icon
Authors (3):
Arrow left icon
Jeeva S. Chelladhurai Jeeva S. Chelladhurai
Author Profile Icon Jeeva S. Chelladhurai
Jeeva S. Chelladhurai
Pethuru Raj Pethuru Raj
Author Profile Icon Pethuru Raj
Pethuru Raj
Vinod Singh Vinod Singh
Author Profile Icon Vinod Singh
Vinod Singh
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with Docker FREE CHAPTER 2. Handling Docker Containers 3. Building Images 4. Publishing Images 5. Running Your Private Docker Infrastructure 6. Running Services in a Container 7. Sharing Data with Containers 8. Orchestrating Containers 9. Testing with Docker 10. Debugging Containers 11. Securing Docker Containers 12. The Docker Platform – Distinct Capabilities and Use Cases

The docker attach command

The docker attach command attaches the running container and it is very helpful when you want to see what is written in stdout in real time:

$ sudo docker run -d --name=newtest alpine /bin/sh -c "while true; do sleep 2; df -h; done"
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
3690ec4760f9: Pull complete
Digest: sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c
1825927d488bef7328a26556cfd72a54adeb3dd7deafb35e317de31e60c25d67
$ sudo docker attach newtest
Filesystem Size Used Available Use% Mounted on
none 7.7G 3.2G 4.1G 44% /
tmpfs 496.2M 0 496.2M 0% /dev
tmpfs 496.2M 0 496.2M 0% /sys/fs/cgroup
/dev/xvda1 7.7G 3.2G 4.1G 44% /etc/resolv.conf
/dev/xvda1 7.7G 3.2G ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image