Docker Compose Windows



Estimated reading time: 3 minutes

You can use Docker Compose to easily run WordPress in an isolated environmentbuilt with Docker containers. This quick-start guide demonstrates how to useCompose to set up and run WordPress. Before starting, make sure you haveCompose installed.

Apt get -even after adding the repositories they specify for docker CE, seems to only contain docker-compose 1.8, which is compatible with a maximum docker-compose.yml file of version 2. If not provided, Compose looks for a file named docker-compose.yml in the current directory and then each parent directory in succession until a file by that name is found. This variable supports multiple Compose files separated by a path separator (on Linux and macOS the path separator is:, on Windows it is; ). Windows prompts you for access every time Docker starts, allowing Docker to manage the Hyper-V VM’s. The first time Docker starts, you may need to provide the token from the Beta invitation email. When initialization completes, select About Docker from the notification area and verify you have the latest version.

Define the project

Docker
  1. Create an empty project directory.

    You can name the directory something easy for you to remember.This directory is the context for your application image. Thedirectory should only contain resources to build that image.

    This project directory contains a docker-compose.yml file whichis complete in itself for a good starter wordpress project.

    Tip: You can use either a .yml or .yaml extension forthis file. They both work.

  2. Change into your project directory.

    For example, if you named your directory my_wordpress:

  3. Create a docker-compose.yml file that starts yourWordPress blog and a separate MySQL instance with a volumemount for data persistence:

Notes:

Docker compose windows 10
  • The docker volume db_data persists any updates made by WordPress to the database. Learn more about docker volumes

  • WordPress Multisite works only on ports 80 and 443.

Build the project

Now, run docker-compose up -d from your project directory.

This runs docker-compose up in detached mode, pullsthe needed Docker images, and starts the wordpress and database containers, as shown inthe example below.

Note: WordPress Multisite works only on ports 80 and/or 443.If you get an error message about binding 0.0.0.0 to port 80 or 443(depending on which one you specified), it is likely that the port youconfigured for WordPress is already in use by another service.

Server

Bring up WordPress in a web browser

At this point, WordPress should be running on port 8000 of your Docker Host,and you can complete the “famous five-minute installation” as a WordPressadministrator.

Docker Compose Windows

Docker Compose Windows Volume Example

Note: The WordPress site is not immediately available on port 8000because the containers are still being initialized and may take a couple ofminutes before the first load.

If you are using Docker Machine, you can run the commanddocker-machine ip MACHINE_VM to get the machine address, and then openhttp://MACHINE_VM_IP:8000 in a web browser.

If you are using Docker Desktop for Mac or Docker Desktop for Windows, you can usehttp://localhost as the IP address, and open http://localhost:8000 in a webbrowser.

Shutdown and cleanup

The command docker-compose down removes thecontainers and default network, but preserves your WordPress database.

Docker compose windows and linux containers

Docker Compose Windows Volume Path

The command docker-compose down --volumes removes the containers, defaultnetwork, and the WordPress database.

More Compose documentation

documentation, docs, docker, compose, orchestration, containers

Key Features and Capabilities

The fastest way to design and deliver containerized applications and microservices on the desktop and cloud.

Simple Setup for Docker and Kubernetes

No need to fiddle with VMs or add a bunch of extra components; simply install from a single package and have your first containers running in minutes. You get certified Kubernetes and Docker, for developers of all levels of container expertise.

Docker Compose Windows Volume

Certified Kubernetes

Setup a fully functional Kubernetes environment on your desktop with a single click and start developing and testing modern applications in minutes.

Application Templates and App Designer

Customize and share multi-service applications and service templates that are tailored to your organization. Pre-defined and customizable application templates adhere to corporate standards and automate configuration, eliminating error-prone manual setup. Intuitive Application Designer facilitates the packaging, installing, and managing of multi-service applications as a shareable package.