Feedback

Chat Icon

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Deploying Applications on Docker Swarm: A Practical Guide
89%

Deploying a WordPress Application on Docker Swarm

Let's utilize what we have learned so far to deploy a WordPress application on Docker Swarm.

Before moving forward, let's delete all the previous services we created:

docker service rm $(docker service ls -q)

The WordPress application will utilize a MySQL database, so we need to create a MySQL service as well. Both services should be in the same network to enable communication between them.

Let's begin by creating the network:

export network_name=wordpress-network
docker network create --driver overlay $network_name

Create Docker secrets for MySQL and WordPress:

# Create the secrets for MySQL root password 
echo "your_db_root_password" \
  | docker secret create db_root_password -

# Create the secrets for WordPress database password
echo "your_db_wordpress_password" | \
  docker secret create db_wordpress_password -

Create the MySQL service:

docker service create --name mysql \
  --network $network_name \
  --secret db_root_password \
  --secret db_wordpress_password \

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Enroll now to unlock all content and receive all future updates for free.

Unlock now  $31.99$25.59

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More