Book Image

Beginning DevOps with Docker

By : Joseph Muli
5 (1)
Book Image

Beginning DevOps with Docker

5 (1)
By: Joseph Muli

Overview of this book

Making sure that your application runs across different systems as intended is quickly becoming a standard development requirement. With Docker, you can ensure that what you build will behave the way you expect it to, regardless of where it's deployed. By guiding you through Docker from start to finish (from installation, to the Docker Registry, all the way through to working with Docker Swarms), we’ll equip you with the skills you need to migrate your workflow to Docker with complete confidence.
Table of Contents (7 chapters)

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...