O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Developing with Docker

Book Description

Change the way your organization deploys software at scale with this fast-paced guide to the world of Docker

About This Book

  • Cut through the noise and in simple terms learn to package your applications and test, ship, and scale your containers
  • Find and build images and successfully run your programs within containers
  • Build, deploy, and test your Docker containers and put them to work in production

Who This Book Is For

This book is for IT professionals, system administrators, and DevOps professionals or anyone looking to quickly develop and deploy software to production at scale. If you are interested in Docker, DevOps, or containers in general, don’t look any further.

What You Will Learn

  • Understand Docker’s architecture
  • Build, ship, and run distributed applications
  • Deploy, automate, and manage the execution of applications within Docker
  • Scale and virtualize images and containers
  • Utilize the networking features that Docker offers
  • Use repositories to store and retrieve images

In Detail

This fast-paced practical guide will get you up and running with Docker. Using Docker, you will be able to build, ship, and run many distributed applications in real time.

You will start with quickly installing Docker and start working with images and containers. We will present different types of containers and their applications, and show you how to find and build images. You will learn how you can contribute to the image repository by publishing different images. This will familiarize you with the image building process and you will be able to successfully run your programs within containers.

By finishing this book, you will be well equipped in deploying your applications using Docker and will have a clear understanding of concepts, techniques, and practical methods to get it running in production systems.

Style and approach

This book takes a fast-paced practical approach that quickly gets you up and running with Docker so that you spend less time learning and more time deploying Docker containers effectively. This book contains a mix of concepts, practical examples, techniques, and the most up-to-date content to run things effectively in production. We’ll show you the easiest way to speed up your development and deployment with Docker.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Developing with Docker
    1. Developing with Docker
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    7. 1. Introduction to Docker
      1. The basic idea
      2. Containerization versus virtualization
        1. Traditional virtualization
        2. Containerization
      3. Benefits of using Docker
        1. Speed and size
        2. Reproducible and portable builds
        3. Immutable and agile infrastructure
        4. Tools and APIs
      4. Tools overview
        1. Docker Engine and Docker Engine client
        2. Docker Machine
        3. Kitematic
        4. Docker compose
        5. Oracle VirtualBox
        6. Git
      5. Summary
    8. 2. Installing Docker
      1. Hardware requirements
      2. Installing on Windows
      3. Installing on Mac OS
      4. Installing on Linux
      5. Installing on the cloud — AWS
      6. Summary
    9. 3. Understanding Images and Containers
      1. Images
      2. Layers
      3. Containers
        1. Saving changes to a container
      4. Docker registry, repository and index
      5. Summary
    10. 4. Networking and Persistent Storage
      1. Docker networking
        1. Default networks
        2. No networking
        3. Host network
        4. Bridged network
        5. Creating a network
        6. Running a container in a network
        7. Creating multi-host networking
          1. Swarm mode
          2. Key-value store overlay networking
        8. Exposing and mapping ports
        9. Linking containers
        10. Networking plugins
      2. Docker volumes
        1. Creating a volume
        2. Removing a volume
        3. Volume drivers
      3. Summary
    11. 5. Finding Images
      1. The Docker Hub
        1. Docker Hub account
        2. Organization account and teams
        3. Collaborators
        4. Private Repositories
        5. Logging into Docker Hub
      2. Searching for images
        1. Image naming and tags
        2. Searching through the web interface
        3. Searching using the command line
      3. Docker Hub and docker registry REST API
      4. Summary
    12. 6. Creating Images
      1. Dockerfile instructions
        1. FROM
        2. MAINTAINER
        3. ADD
        4. COPY
        5. CMD
        6. ENTRYPOINT
        7. LABEL
        8. EXPOSE
        9. RUN
        10. USER
        11. VOLUME
        12. WORKDIR
        13. ARG
        14. ONBUILD
        15. STOPSIGNAL
        16. HEALTHCHECK
        17. SHELL
      2. Using Dockerfiles
      3. Summary
    13. 7. Running Containers
      1. Runtime modes - detached and foreground
        1. Detached
        2. Foreground
      2. Identifying images and containers
        1. PID settings
        2. UTS settings
      3. Overriding default commands from Dockerfile
        1. Overriding the CMD
        2. Overriding the ENTRYPOINT
      4. Executing arbitrary commands with exec
      5. Monitoring containers
        1. Viewing logs
        2. Container events
        3. Inspecting a container
        4. Statistics
      6. Container exit codes and restart policies
        1. no
        2. always
        3. on-failure
        4. unless-stopped
        5. Updating a restart policy on a running container
      7. Runtime constraints on resources
        1. Memory
        2. Processors
        3. Updating constraints on a running container
      8. Docker Swarm mode
        1. The purpose
        2. Terminology
        3. Swarm mode commands
      9. Summary
    14. 8. Publishing Images
      1. Publishing images
        1. Tagging
        2. Untagging the image
        3. Pushing the image
      2. Webhooks and automated builds
        1. Setting up the automated build
        2. Build Triggers
        3. Webhooks and continuous deployments
      3. Summary
    15. 9. Using Docker in Development
      1. Using Docker with Maven
        1. Spotify's Maven Docker plugin
        2. fabric8io Maven Docker plugin
      2. Spring Boot application in Docker container
      3. Packaging Angular.js application
      4. Summary
    16. Appendix A. More Resources
      1. Official documentation
      2. Awesome Docker
      3. Training