Docker コンテナで実行する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
また、提供されている Dockerfile と docker-compose.yml を使用してビルドされた Docker コンテナ内で、サンプルを実行して Google Ads API アプリケーションを開発することもできます。
これを行うには(Docker 環境がインストールされている場合)、このリポジトリのクローンを作成したディレクトリで次のコマンドを実行します。
docker-compose up --build -d
これにより、必要な依存関係がすべてインストールされた Docker コンテナ インスタンスが提供されます。
Docker コンテナ内で BASH シェルを開くには、docker ps
を実行してコンテナ ID を取得し、次のコマンドを実行します。
docker exec -it <YOUR_CONTAINER_ID> bash
これにより、コンテナ内でコード例や他のアプリケーションを実行できるようになります。
マシンで実行されている Docker コンテナが 1 つだけの場合は、次のコマンドを実行することもできます。
docker exec -it $(docker ps -a -q) bash
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-05 UTC。
[null,null,["最終更新日 2025-09-05 UTC。"],[[["\u003cp\u003eUtilize Docker for seamless execution of Google Ads API examples and application development within a pre-built environment.\u003c/p\u003e\n"],["\u003cp\u003eInitiate the Docker environment using \u003ccode\u003edocker-compose up --build -d\u003c/code\u003e after cloning the repository.\u003c/p\u003e\n"],["\u003cp\u003eAccess a BASH shell within the Docker container via \u003ccode\u003edocker exec -it <YOUR_CONTAINER_ID> bash\u003c/code\u003e to interact with code samples and applications.\u003c/p\u003e\n"],["\u003cp\u003eLeverage \u003ccode\u003edocker exec -it $(docker ps -a -q) bash\u003c/code\u003e as a shortcut for accessing the container when only one is running.\u003c/p\u003e\n"]]],[],null,["# Running in a Docker Container\n\nYou can also execute the examples and develop your Google Ads API application\ninside a Docker container, built using the provided\n[Dockerfile](https://github.com/googleads/google-ads-php/blob/HEAD/Dockerfile) and\n[docker-compose.yml](https://github.com/googleads/google-ads-php/blob/HEAD/docker-compose.yml).\n\nTo do so (provided that you have a Docker environment\n[installed](//docs.docker.com/install/)), run the following command in the\ndirectory where you cloned this repository: \n\n docker-compose up --build -d\n\nThis will provide a Docker container instance with all the required dependencies\nalready installed.\n\nTo open a BASH shell inside the Docker container, you can run `docker ps` to get\nthe container ID and then run: \n\n docker exec -it \u003cYOUR_CONTAINER_ID\u003e bash\n\nThis will allow you to run code examples and other applications inside the\ncontainer.\n\nAs a shorthand, in case you only have a single Docker container running on your\nmachine, you can also run: \n\n docker exec -it $(docker ps -a -q) bash"]]