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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Docker High Performance

You're reading from   Docker High Performance Complete your Docker journey by optimizing your application's work?ows and performance

Arrow left icon
Product type Paperback
Published in Apr 2019
Publisher
ISBN-13 9781789807219
Length 174 pages
Edition 2nd Edition
Tools
Arrow right icon
Authors (2):
Arrow left icon
Russ McKendrick Russ McKendrick
Author Profile Icon Russ McKendrick
Russ McKendrick
Allan Espinosa Allan Espinosa
Author Profile Icon Allan Espinosa
Allan Espinosa
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Initializing Docker Swarm

Now that we have a base configuration of setting up a Docker host, let us move to the next level and set up a Docker Swarm cluster automatically:

  1. First, we need a way to store the Docker Swarm join token securely. We will use chef-vault as a way to store the token. To be able to use chef-vault, we will simply add it as a dependency of our cookbook in cookbooks/dockerhost/metadata.rb:
name 'dockerhost'
# ...
version '0.1.0'

depends 'docker', '~> 4.7'
depends 'chef-vault', '~> 3.1' # update here
  1. Next, we will create a Chef recipe for initializing the manager node in cookbooks/dockerhost/recipes/manager.rb:
include_recipe 'dockerhost::base'

execute 'init swarm' do
command 'docker swarm init'
not_if 'docker info -f "{{.Swarm.LocalNodeState}}" |...
You have been reading a chapter from
Docker High Performance - Second Edition
Published in: Apr 2019
Publisher:
ISBN-13: 9781789807219
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