การเรียกใช้ในคอนเทนเนอร์ Docker
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
นอกจากนี้ คุณยังเรียกใช้ตัวอย่างและพัฒนาแอปพลิเคชัน Google Ads API
ภายในคอนเทนเนอร์ Docker ที่สร้างขึ้นโดยใช้
Dockerfile และ
docker-compose.yml ที่ให้ไว้ได้ด้วย
หากต้องการดำเนินการดังกล่าว (ในกรณีที่คุณมีสภาพแวดล้อม Docker ที่ติดตั้งแล้ว) ให้เรียกใช้คำสั่งต่อไปนี้ในไดเรกทอรีที่คุณโคลนที่เก็บนี้
docker-compose up --build -d
ซึ่งจะสร้างอินสแตนซ์คอนเทนเนอร์ Docker ที่มีการตั้งค่าสภาพแวดล้อมการดำเนินการ
หากต้องการเปิดเชลล์ Bash ภายในคอนเทนเนอร์ Docker ให้เรียกใช้ docker ps
เพื่อรับ
รหัสคอนเทนเนอร์ จากนั้นเรียกใช้คำสั่งต่อไปนี้
docker exec -it <YOUR_CONTAINER_ID> bash
ซึ่งจะช่วยให้คุณเรียกใช้ตัวอย่างโค้ดและแอปพลิเคชันอื่นๆ ภายใน
คอนเทนเนอร์ได้
ในกรณีที่คุณมีคอนเทนเนอร์ Docker เพียงคอนเทนเนอร์เดียวที่ทำงานในเครื่อง คุณยังเรียกใช้คำสั่งต่อไปนี้ได้ด้วย
docker exec -it $(docker ps -a -q) bash
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 UTC"],[[["\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"]]