Skip to main content
Version: 8.4.x

Running Applications with Docker Compose

This page describes the provided docker-compose examples for running Self-Managed Commerce containers. These docker-compose files and commands demonstrate which containers to run, the order in which to start them, and provide an example of configuring the containers.

Examine the provided docker-compose files to see how the containers are configured, and use them as a model for configuring the containers in your container orchestration tool of choice.

With these examples you can use container images built locally or images built and pushed to a remote image repository.

note

For more detailed information about running containerized Self-Managed Commerce environments and how to configure them, see Containerized Environments.

Prerequisites​

Before you begin, ensure you meet the following prerequisites.

Commerce Application Images​

The Self-Managed Commerce application images must be available on the host where you will be running docker-compose. For instructions to create the application images, see Build Application Images.

Access to the Self-Managed Commerce Code​

The docker-compose templates are included in the Self-Managed Commerce ep-commerce Git project.

Image Facts File​

The docker-compose examples require a file named /opt/env/image_facts.env. The file must exist and contain the names and tags of the available Commerce images. This file will be used to create environment variables that the docker-compose process will reference.

If you built the Commerce images locally using the steps in Build Application Images, then the file will already exist and contain the necessary information.

If you built the Commerce images on a different machine then you will need to create or copy the file locally before proceeding.

For more details on the image facts file, see Build Application Images.

Docker Environment Requirements​

A properly-configured Docker environment is required to run the Self-Managed Commerce application images.

Using the Build Host​

The Self-Managed Commerce build host can be used to run the application images. For instructions to configure a build host, see Configure a Build Host.

Using a Docker Host​

If you will not be using the Self-Managed Commerce build host to run the application images, ensure you are using a system that meets these requirements:

  • A running Docker daemon
  • The docker-compose command is available
  • Access to the Self-Managed Commerce application images
  • Access to the image_facts.env file

Running Self-Managed Commerce​

Use docker-compose to run the Self-Managed Commerce application containers.

  1. Clone the Self-Managed Commerce source code project ep-commerce from your organization Git repository.
  2. Checkout the ep-commerce branch that you used to build the application images.
  3. Change directory to devops/docker_compose.
  4. Start the application images using docker-compose.
source /opt/env/image_facts.env

docker-compose -p ep-commerce -f activemq/docker-compose.yml up -d
docker-compose -p ep-commerce -f mysql/docker-compose.yml up -d
docker-compose -p ep-commerce -f data-pop-tool/docker-compose.yml up
docker-compose -p ep-commerce -f commerce/docker-compose.yml up -d

Run docker ps to see which containers are running and the ports to which their services are mapped. This will list the names and IDs of each running container.

Running Wiremock​

  1. Clone the Self-Managed Commerce source code project ep-commerce from your organization Git repository.
  2. Checkout the ep-commerce branch that you used to build the application images.
  3. Change directory to devops/docker_compose.
  4. Start the application image using docker-compose.
source /opt/env/image_facts.env

docker-compose -p ep-commerce -f commerce/docker-compose.wiremock.yml up -d

Diagnosing Problems with the Containers​

Accessing a Shell Inside the Containers​

You can access any of the containers using an interactive shell.

docker exec -it <container> /bin/sh
note

<container> is either the ID or name of the container obtained by running docker ps.

Viewing the Logs for the Containers​

You can view logs from the Self-Managed Commerce application running in each container.

docker logs <container>
note

<container> is either the ID or name of the container obtained by running docker ps.