[[["わかりやすい","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."]]