在 Docker 容器中執行
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您也可以在 Docker 容器中執行範例,並開發 Google Ads API 應用程式。Docker 容器是使用提供的 Dockerfile 和 docker-compose.yml 建構而成。
如要這麼做 (前提是您已安裝 Docker 環境),請在複製這個存放區的目錄中執行下列指令:
docker-compose up --build -d
這會提供已設定執行環境的 Docker 容器執行個體。
如要在 Docker 容器中開啟 Bash 殼層,請執行 docker ps
取得容器 ID,然後執行下列指令:
docker exec -it <YOUR_CONTAINER_ID> bash
這樣一來,您就能在容器內執行程式碼範例和其他應用程式。
如果您的電腦只執行單一 Docker 容器,也可以執行以下簡短指令:
docker exec -it $(docker ps -a -q) bash
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[null,null,["上次更新時間:2025-08-27 (世界標準時間)。"],[[["\u003cp\u003eUtilize provided Docker resources to execute Google Ads API application examples and develop your own applications within a Docker container.\u003c/p\u003e\n"],["\u003cp\u003eInitiate the Docker environment by executing \u003ccode\u003edocker-compose up --build -d\u003c/code\u003e after cloning the repository.\u003c/p\u003e\n"],["\u003cp\u003eAccess a Bash shell inside the container using \u003ccode\u003edocker exec -it <YOUR_CONTAINER_ID> bash\u003c/code\u003e to interact with code samples and applications.\u003c/p\u003e\n"],["\u003cp\u003eIf running a single Docker container, \u003ccode\u003edocker exec -it $(docker ps -a -q) bash\u003c/code\u003e can be used as a shortcut for shell access.\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-perl/blob/HEAD/Dockerfile) and\n[docker-compose.yml](https://github.com/googleads/google-ads-perl/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 the execution environment set\nup.\n\nTo open a Bash shell inside the Docker container, run `docker ps` to get\nthe container ID, 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"]]