Book Image

Mastering Docker

By : Scott Gallagher
Book Image

Mastering Docker

By: Scott Gallagher

Overview of this book

<p><span id="description" class="sugar_field">Docker has been a game-changer when it comes to virtualization – it has now grown to become a key driver of innovation beyond system administration, having an impact on the world of web development and more. But how can you make sure you’re keeping up with the innovations that it’s driving? How can you be sure you’re using it to its full potential? Mastering Docker shows you how – it not only demonstrates how to use Docker more effectively, it also helps you rethink and reimagine what’s possible with Docker.</span></p> <p><span class="sugar_field"><span id="description" class="sugar_field"> Covering best practices to make sure you’re confident with and the basics, such as building, managing and storing containers, before diving deeper into Docker security, you’ll find everything you need to help you extend and integrate Docker in new and innovative ways. You’ll learn how to take greater control over your containers using some of Docker’s most sophisticated and useful tools, such as Docker compose and Docker swarm, before bringing together everything you already know and have learned to put your containers into production and monitor them for safety and performance.</span></span></p> <p><span class="sugar_field"><span class="sugar_field"><span id="description" class="sugar_field"> Beyond this, you’ll also explore even more advanced strategies, as you learn how to extend and integrate Docker with cloud platforms such as Heroku and OpenStack, and how tools such as Kubernetes can improve the way you manage large-scale container orchestration. With further guidance on how you can use configuration management tools such as Puppet, Chef and PowerShell, by the end of the book you’ll have a broad and detailed sense of exactly what’s possible with Docker – and how seamlessly it fits with a range of other platforms and tools.</span></span></span></p>
Table of Contents (20 chapters)
Mastering Docker
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

The Swarm cluster example


We will now go through an example of how to set up a Docker Swarm cluster:

# Create a new Docker host with Docker Machine
$ docker-machine create --driver virtualbox swarm

# Point to the new Docker host
$ eval "$(docker-machine env swarm)"

# Generate a Docker Swarm Discovery Token
$ docker run swarm create

# Launch the Swarm Manager
$ docker-machine create \
        --driver virtualbox \
        --swarm \
        --swarm-master \
        --swarm-discovery token://<DISCOVERY_TOKEN> \
        swarm-master

# Launch a Swarm node
$ docker-machine create \
    --driver virtualbox \
    --swarm \
    --swarm-discovery token://<DISCOVERY_TOKEN> \
    swarm_node-01

# Launch another Swarm node 
$ docker-machine create \
    --driver virtualbox \
    --swarm \
    --swarm-discovery token://<DISCOVERY_TOKEN> \
    swarm_node-02

# Point to our Swarm Manager
$ eval "$(docker-machine env swarm-master)"

# Execute 'docker info' command to view information...