Container-Optimized OS를 빌드하려면 적절한 chroot 환경을 만들어야 합니다. depot_tools에 포함된 cros_sdk 도구를 사용하여 이전 단계에서 생성한 소스 디렉터리에서 다음 명령어를 실행하여 Container-Optimized OS 컴파일에 사용할 수 있는 chroot를 만들고 입력할 수 있습니다.
cd $HOME/cos-src
cros_sdk --enter
chroot 내부에 있으면 디스크 이미지를 빌드할 수 있습니다. Container-Optimized OS를 빌드하려면 다음과 같이 보드 이름에 lakitu(x86 이미지) 또는 lakitu-arm64(Arm 이미지)를 지정하세요.
test 외에도 ./build image 스크립트 명령어에 적절한 매개변수를 전달하여 base 또는 dev 이미지를 빌드할 수 있습니다. 매개변수를 지정하지 않으면 기본적으로 dev 이미지가 빌드됩니다.
dev 이미지에는 base 이미지 위에 설치된 몇 가지 추가 디버그 도구가 포함되어 있습니다. test 이미지에는 dev 이미지의 디버그 도구와 자동 Container-Optimized OS 테스트를 실행하는 데 필요한 도구가 포함되어 있습니다.
저작자 표시 요구사항
Container-Optimized OS 이미지를 생성할 때는 서드 파티 라이선스의 다양한 저작자 표시 요구사항을 충족해야 합니다. 빌드를 통해 생성한 이미지는 /opt/google/chrome/resources/about_os_credits.html에 모든 관련 저작자 표시 정보가 포함됩니다. 이는 개별 빌드 아티팩트로서 빌드 출력 디렉터리에서도 license_credits.html 파일로 제공합니다.
이미지 실행
Container-Optimized OS 이미지를 빌드했으면 KVM을 사용하여 이미지를 실행하거나 Compute Engine 인스턴스로 이미지를 가져오면 됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eContainer-Optimized OS can be built directly from its open-source code, which is based on the Chromium OS project.\u003c/p\u003e\n"],["\u003cp\u003eBuilding a Container-Optimized OS image requires \u003ccode\u003egit\u003c/code\u003e, \u003ccode\u003ecurl\u003c/code\u003e, and the \u003ccode\u003edepot_tools\u003c/code\u003e package, which includes \u003ccode\u003erepo\u003c/code\u003e and \u003ccode\u003ecros_sdk\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can build different types of images, specifically \u003ccode\u003ebase\u003c/code\u003e, \u003ccode\u003edev\u003c/code\u003e, or \u003ccode\u003etest\u003c/code\u003e, with the \u003ccode\u003etest\u003c/code\u003e image containing debug tools and test utilities, allowing root login with the password "test0000".\u003c/p\u003e\n"],["\u003cp\u003eOnce built, the Container-Optimized OS image can be run in a hypervisor like KVM or imported into a Compute Engine instance.\u003c/p\u003e\n"],["\u003cp\u003eAttribution requirements are available within the \u003ccode\u003e/opt/google/chrome/resources/about_os_credits.html\u003c/code\u003e directory of the image, or as \u003ccode\u003elicense_credits.html\u003c/code\u003e in the build output.\u003c/p\u003e\n"]]],[],null,["# Building Container-Optimized OS from source\n\nContainer-Optimized OS is based on, and built using, tools from the\nopen-source [Chromium OS](http://www.chromium.org/chromium-os)\nproject. If you like, you can build a Container-Optimized OS image yourself\ndirectly from the Container-Optimized OS source code.\n\nPrerequisites\n-------------\n\nTo build a Container-Optimized OS image, you'll need to install the following\ntools on your development machine:\n\n- `git` and `curl`\n- A package of Chromium scripts called [`depot_tools`](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html) that includes tools like `repo` and `cros_sdk`.\n\nObtaining the Container-Optimized OS source code\n------------------------------------------------\n\nYou can download the source code for Container-Optimized OS by using the\n`repo` tool that is included in `depot_tools`.\n\nFirst, create a directory to store the source code. For example, `cos-src` in\nyour home directory: \n\n mkdir $HOME/cos-src\n cd $HOME/cos-src\n\nNow download source code using the following commands: \n\n repo init https://cos.googlesource.com/cos/manifest.git\n repo sync\n\n| **Note:** Depending on your network speed, downloading the source code may take several minutes.\n\nBuilding a Container-Optimized OS image\n---------------------------------------\n\nTo build Container-Optimized OS, you must create a suitable `chroot`\nenvironment. You can use the `cros_sdk` tool included in `depot_tools` to create\nand enter a `chroot` that's ready for Container-Optimized OS compilation by\nrunning the following command in the source directory that you created in the\nprevious step: \n\n cd $HOME/cos-src\n cros_sdk --enter\n\nOnce inside `chroot`, you can build the disk image. To build\nContainer-Optimized OS, specify `lakitu` (x86 image) or `lakitu-arm64`\n(Arm image) for the board name as follows: \n\n### x86 image\n\n build_packages --board=lakitu\n build_image --board=lakitu test\n\n### Arm image\n\n build_packages --board=lakitu-arm64\n build_image --board=lakitu-arm64 test\n\nIn addition to **`test`** , you can build either a **`base`** , or **`dev`** image\nby passing the appropriate parameter to the `./build image` script command. If\nyou don't specify a parameter, *the `dev` image is built by default*.\n\nThe `dev` image contains some additional debug tools installed on top of the\n`base` image. The `test` image includes the debug tools from the `dev` image as\nwell as tools necessary for running automatic Container-Optimized OS tests.\n| **Note:** You can log into a `test` image as the root user with the password \"test0000\", which can be useful if the SSH service is not accessible.\n\nAttribution Requirements\n------------------------\n\nWhen you produce a Container-Optimized OS image, you need to fulfill various\nattribution requirements of third party licenses. The image generated by a build\ncontains all relevant attribution information in\n`/opt/google/chrome/resources/about_os_credits.html`. As a separate build\nartifact it is also available as `license_credits.html` file in the build output\ndirectory.\n\nRunning Your Image\n------------------\n\nOnce you've built your Container-Optimized OS image, you can run the image\nusing KVM, or import the image to a [Compute Engine](/compute) instance.\n\n### Running in hypervisor\n\nTo boot your image in hypervisor, run the following command: \n\n### x86 image\n\n kvm -m 1024 -nographic -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:9222-:22 -hda src/build/images/lakitu/latest/chromiumos_test_image.bin\n\n### Arm image\n\n sudo apt-get install qemu-system-arm qemu-efi\n\n dd if=/dev/zero of=/tmp/flash0.img bs=1M count=64\n dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=/tmp/flash0.img conv=notrunc\n\n sudo qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt -nographic \\\n -pflash /tmp/flash0.img \\\n -device virtio-scsi-pci,id=scsi \\\n -drive if=none,file=src/build/images/lakitu-arm64/latest/chromiumos_test_image.bin,id=hd0 \\\n -device scsi-hd,drive=hd0,bootindex=0 \\\n -net nic \\\n -net user,hostfwd=tcp::9222-:22\n \nBooting in this manner leaves the VM's serial port connected to your console,\nletting you log in without using SSH. If you're running a `test` image, you can\nlog in with the username/password pair \"root/test0000\".\n\nOnce the VM is started, you can access your `dev` or `test` image using SSH. To\nSSH into the image, use the key generated for that image, as follows: \n\n### x86 image\n\n ssh root@localhost -p 9222 -i src/build/images/lakitu/latest/id_rsa\n\n### Arm image\n\n ssh root@localhost -p 9222 -i src/build/images/lakitu-arm64/latest/id_rsa\n\n### Running on Compute Engine\n\nTo import your image to a Compute Engine instance, you must compress the image\ninto a `.tar` file. To compress the image, run the following command: \n\n### x86 image\n\n tar -Sczf compressed-image.tar.gz images/lakitu/latest/chromiumos_image.bin --transform 's|images/lakitu/latest/chromiumos_image.bin|disk.raw|'\n\n### Arm image\n\n tar -Sczf compressed-image.tar.gz images/lakitu-arm64/latest/chromiumos_image.bin --transform 's|images/lakitu-arm64/latest/chromiumos_image.bin|disk.raw|'\n\nAfter you've created your `.tar` file, you can follow the instructions to\n[import an existing image](/compute/docs/images/import-existing-image#import_image)\nin the Compute Engine documentation."]]