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
Beginning DevOps with Docker

You're reading from   Beginning DevOps with Docker Automate the deployment of your environment with the power of the Docker toolchain

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781789532401
Length 96 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Joseph Muli Joseph Muli
Author Profile Icon Joseph Muli
Joseph Muli
Arrow right icon
View More author details
Toc

Networking with docker-compose


By default, docker-compose sets up a single network for your application(s) where each container can reach and discover other containers.

The network is given a name based on the name of the directory it lives in. Thus, if your directory is called py_docker, when your run docker-compose up, the network created is called py_docker_default.

We mentioned ports in the previous topic, when creating the WordPress container. To explain networking better, we'll use the docker-compose.yml used to spin up a WordPress application:

In this file, we have two services: db and wordpress.

In the WordPress service, we have the ports option mapping port 80 to port 8000. No wonder, the WordPress app runs on 0.0.0.0:8000 on our browsers.

The ports option is not in the db service. However, if you go to the docker hub page for mysql, you'll notice that port 3306 is exposed. This is the standard port for MySQL. You can obtain more information on MySQL from: https://hub.docker.com/r/library...

lock icon The rest of the chapter is locked
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