Run in a Docker container

  • The Google Ads API application and examples can be executed and developed inside a Docker container built using the provided Dockerfile and docker-compose.yml.

  • To use this feature, you need a Docker environment installed and can build and run the container using docker-compose up --build -d.

  • You can open a BASH shell inside the Docker container to run code examples and other applications using the docker exec command with the container ID or a shorthand if only one container is running.

You can execute code examples and develop your Google Ads API application inside a Docker container built using the provided Dockerfile and docker-compose.yml.

Prerequisites

  1. Install Docker on your machine.
  2. Configure your google_ads_php.ini file as described in the Configuration guide.

Start the container

To build and start the Docker container in the background, run the following command in the root directory of your cloned repository:

docker compose up --build -d

This provides a Docker container instance with all required dependencies installed.

Access the container shell

To open a Bash shell inside the running container, run docker ps to get the container ID and then run:

docker exec -it <CONTAINER_ID> bash

Alternatively, you can use Docker Compose with the service name defined in docker-compose.yml (web):

docker compose exec web bash

This lets you run code examples and other scripts inside the container.

Stop the container

To stop and remove the running container instances, run:

docker compose down