Home > Store

Docker Containers from Start to Enterprise: Build and Deploy with Kubernetes, Flannel, Cockpit and Atomic

eBook

  • Your Price: $30.39
  • List Price: $37.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Also available in other formats.

Register your product to gain access to bonus material or receive a coupon.

Description

  • Copyright 2016
  • Dimensions: 7" x 9-1/8"
  • Pages: 320
  • Edition: 1st
  • eBook
  • ISBN-10: 0-13-413665-9
  • ISBN-13: 978-0-13-413665-3

The Practical Guide to Running Docker on Linux Systems or Cloud Environments


Whether on your laptop or a remote cloud, Docker can transform how you create, test, deploy, and manage your most critical applications. In Docker Containers, Christopher Negus helps you master Docker containerization from the ground up.

You’ll start out running a few Docker container images in Ubuntu, Fedora, RHEL, CoreOS, or Project Atomic. By the time you’ve finished, you’ll be deploying enterprise-quality, multi-container Kubernetes setups in modern Linux and cloud environments.

Writing for system administrators, software developers, and technology enthusiasts, Negus touches on every aspect of working with Docker: setting up containerized applications, working with both individual and multiple containers, running containers in cloud environments, and developing containers.

Teaching through realistic examples of desktop applications, system services, and games, Negus guides you through building and deploying your own Dockerized applications. As you build your expertise, you’ll also learn indispensable Docker best practices for building and integrating containers, managing Docker on a day-to-day basis, and much more:

• Understanding what Docker is and what you can do with it
• Installing Docker on standard Linux or specialized container operating systems such as Atomic Host and CoreOS
• Setting up a container runtime environment and private Docker Registry
• Creating, running, and investigating Docker images and containers
• Finding, pulling, saving, loading, and tagging container images
• Pulling and pushing containers between local systems and Docker Registries
• Integrating Docker containers with host networking and storage
• Building containers with the docker build command and Dockerfile files
• Minimizing space consumption and erasing unneeded containers
• Accessing special host privileges from within a container
• Orchestrating multiple containers into complex applications with Kubernetes
• Using super privileged containers in cloud environments
• Managing containers in the cloud with Cockpit
• Getting started with Docker container development
• Learning container build techniques from shared Dockerfiles

This book is part of the Pearson Content Update Program. As the technology changes, sections of this book will be updated or new sections will be added. The updates will be delivered to you via a free Web Edition of this book, which can be accessed with any Internet connection.

Sample Content

Table of Contents

Preface     xv
Acknowledgments     xxi
About the Author     xxiii


Part I: Getting Going with Containers     1


Chapter 1: Containerizing Applications with Docker     3
Understanding Pros and Cons of Containerizing Applications     4
     ...An Application Running Directly on a Host Computer     4
     ...An Application Running Directly within a Virtual Machine     5
     Understanding the Upside of Containers     5
     Understanding Challenges of Containerizing Applications     7
Understanding What Makes Up Docker     8
     The Docker Project     8
     The Docker Hub Registry     9
     Docker Images and Containers     10
     The docker Command     11
Approaching Containers     13
Summary     14


Chapter 2: Setting Up a Container Run-Time Environment     17
Configuring a Standard Linux System for Docker     18
     Configuring Ubuntu for Docker     18
     Configuring Fedora for Docker     21
     Configuring Red Hat Enterprise Linux for Docker     25
     Configuring Other Operating Systems for Docker     27
Configuring a Container-Style Linux System for Docker     29
     Configuring an Atomic Host for Docker     29
     Configuring CoreOS for Docker     32
Summary     34


Chapter 3: Setting Up a Private Docker Registry     35
Getting and Starting a Private Docker Registry     36
     Setting Up a Docker Registry in Fedora     37
     Setting Up a Docker Registry in Ubuntu     40
Configuring a Private Docker Registry     43
     Configuring the docker-registry Package     43
     Configuring the registry Container     46
Understanding the Docker Image Namespace     46
Summary     48


Part II: Working with Individual Containers     49


Chapter 4: Running Container Images     51
Running Container Images Interactively     54
     Starting an Interactive Bash Shell     54
     Playing Some Character-Based Games     56
     Running Administrative Commands Inside a Container     57
Running Containerized Services     59
     Running a Containerized Web Server     59
     Limiting Resources When Running Services in Containers     62
Running Privileged Containers     63
Summary     64


Chapter 5: Finding, Pulling, Saving, and Loading Container Images     65
Searching for Images     66
     Searching for Images with the docker Command     66
     Searching for Images on Docker Hub     69
     Searching Other Repositories for Images     70
Pulling Images from Registries     73
Saving and Loading Images     76
Summary     77


Chapter 6: Tagging Images     79
Assigning Names to Images     80
Assigning Tags to Images     81
Assigning Repository Names to Images     83
     Attaching a User Name to an Image     83
     Attaching a Repository Name to an Image     85
Summary     86


Chapter 7: Investigating Containers     87
Inspecting Images and Containers     88
Inspecting an Image     88
     Inspecting Base Images with docker inspect     89
     Inspecting Application Images with docker inspect     90
     Looking at the History of an Image     92
Inspecting Running Containers     92
     Start a Container to Inspect     93
     Inspect an Entire Container Configuration     94
     Inspect Individual Container Attributes     99
Finding More Ways to Look into Containers     103
     Using docker top to See Container Processes     103
     Using docker attach to Interact with a Service Inside a Container     104
     Using docker exec to Start a New Process in a Running Container     105
     Using docker logs to See Container Process Output     106
     Using docker diff to See How a Container Has Changed     106
     Using docker cp to Copy Files from a Container     107
Summary     107


Chapter 8: Starting, Stopping, and Restarting Containers     109
Stopping and Starting a Container     109
     Stopping and Starting a Detached Container     110
     Starting and Stopping an Interactive Container     112
Restarting a Container     113
Sending Signals to a Container     114
Pausing and Unpausing Containers     115
Waiting for a Container’s Exit Code     116
Renaming a Container     117
Creating a Container     117
Summary     118


Chapter 9: Configuring Container Storage     121
Managing Storage for a Container     122
     Using Volumes from the Host     122
     Data Volume Container     123
     Write-Protecting a Bind Mount     124
     Mounting Devices     125
     Mounting Sockets     125
Storage Strategies for the Docker Host     127
     Attaching External Storage to a Docker Host     128
Summary     130


Chapter 10: Configuring Container Networking     133
Expose Ports to Other Containers     134
Map Ports Outside the Host     136
     Map a Port from Linked Containers     136
     Connect Containers on Different Hosts     138
Alternatives to the docker0 Bridge     139
     Changing Network Mode for a Container     140
     Examining Network Options     140
Changing the Docker Network Bridge     142
Summary     143


Chapter 11: Cleaning Up Containers     145
Making Space for Images and Containers     146
Removing Images     146
     Removing Individual Images     147
     Removing Multiple Images     148
Removing Containers     150
     Removing Individual Containers     150
     Removing Multiple Containers     152
Cleaning Up and Saving Containers     153
     Cleaning Up and Saving an Ubuntu Container     153
     Cleaning Up and Saving a Fedora Container     154
Summary     154


Chapter 12: Building Docker Images     157
Doing a Simple docker build     158
Setting a Command to Execute from a Dockerfile     161
     Using the CMD Instruction     161
     Using the ENTRYPOINT Instruction     162
     Using the RUN Instruction     163
     Adding Files to an Image from a Dockerfile     164
Exposing Ports from an Image within a Dockerfile     165
Assigning Environment Variables in a Dockerfile     166
Assigning Labels in a Dockerfile     167
Using Other docker build Command Options     168
Tips for Building Containers     169
     Clean Up the Image     169
     Keep Build Directory Small     169
     Keep Containers Simple     170
     Manage How Caching Is Done     170
Summary     171


Part III: Running Containers in Cloud Environments     173


Chapter 13: Using Super Privileged Containers     175
Using Super Privileged Containers in Atomic Host     176
Understanding Super Privileged Containers     176
     Opening Privileges to the Host     177
     Accessing the Host Process Table     177
     Accessing Host Network Interfaces     178
     Accessing Host Inter-Process Communications     179
     Accessing Host File Systems     179
Preparing to Use Super Privileged Containers     180
Using the atomic Command     180
     Installing an SPC Image with atomic     182
     Getting Information about an SPC Image with atomic     182
     Running an SPC Image with atomic     183
     Stopping and Restarting an SPC with atomic     184
     Updating an SPC Image     184
     Uninstalling an SPC Image     185
Trying Some SPCs     185
     Running the RHEL Tools SPC     186
     Running the Logging (rsyslog) SPC     187
     Running the System Monitor (sadc) SPC     189
Summary     191


Chapter 14: Managing Containers in the Cloud with Cockpit     193
Understanding Cockpit     194
Starting with Cockpit     198
Adding Servers into Cockpit     199
Working with Containers from Cockpit     201
     Adding Container Images to Cockpit     201
     Running Images from Cockpit     201
Working with Network Interfaces from Cockpit     204
Configuring Storage from Cockpit     207
Doing Other Administrative Tasks in Cockpit     208
     Managing Administrator Accounts in Cockpit     208
     Open a Terminal in Cockpit     209
Summary     210


Part IV: Managing Multiple Containers     211


Chapter 15: Orchestrating Containers with Kubernetes     213
Understanding Kubernetes     214
Starting with Kubernetes     216
Setting Up an All-in-One Kubernetes Configuration     218
     Installing and Starting Up Kubernetes     218
     Starting Up a Pod in Kubernetes     220
     Working with Kubernetes     223
Summary     224


Chapter 16: Creating a Kubernetes Cluster     225
Understanding Advanced Kubernetes Features     226
Setting Up a Kubernetes Cluster     226
     Step 1: Install Linux     227
     Step 2: Set Up Kubernetes Master     227
     Step 3: Set Up Kubernetes Nodes     230
     Step 4: Set Up Networking with Flannel     231
Starting Up Pods in a Kubernetes Cluster     233
Deleting Replication Controllers, Services, and Pods     237
Summary     238


Part V: Developing Containers     239


Chapter 17: Developing Docker Containers     241
Setting Up for Container Development     241
     Choosing a Container Development Environment for Red Hat Systems     242
     Container Development Environments from Docker     246
Using Good Development Practices     247
     Gathering or Excluding Files for a Build     248
     Taking Advantage of Layers     249
     Managing Software Packages in a Build     250
     Learning More about Building Containers     251
Summary     252


Chapter 18: Exploring Sample Dockerfile Files     253
Examining Dockerfiles for Official Docker Images     254
     Viewing a CentOS Dockerfile     254
     Viewing a Busybox Dockerfile     257
Examining Dockerfiles from Open Source Projects     258
     Viewing a WordPress Dockerfile     258
     Viewing the MySQL Dockerfile     260
Examining Dockerfiles for Desktop and Personal Use     263
     Viewing a Chrome Dockerfile     263
     Viewing a Firefox Dockerfile     267
Summary     270


Index     273

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020