Book Image

Learning Docker

By : Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah
Book Image

Learning Docker

By: Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah

Overview of this book

Table of Contents (18 chapters)
Learning Docker
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Installing and using nsenter


In any commercial Docker deployments, you may use various containers, such as web application, database, and so on. However, you need to access these containers in order to modify the configuration or debug/troubleshoot the issues. A simple solution for this problem is to run an SSH server in each container. It is a not good way to access the machines due to unanticipated security implications. However, if you are working in any one of the world-class IT companies, such as IBM, DELL, HP, and so on, your security compliance guy will never allow you to use SSH to connect to machines.

So, here is the solution. The nsenter tool provides you access to log in to your container. Note that nsenter will be first deployed as a Docker container only. Using this deployed nsenter, you can access your container. Follow these steps:

  1. Let's run a simple web application as a container:

    $ sudo docker run -d -p 5000:5000 training/webapp python app.py
    ------------------------
    a245253db38b626b8ac4a05575aa704374d0a3c25a392e0f4f562df92bb98d74...