Specifying Rootfs to Create a Container
Function Description
Different from a common container that needs to be started by specifying a container image, a system container is started by specifying a local root file system (rootfs) using the --external-rootfs parameter. The rootfs contains the operating system environment on which the container depends during running.
Parameter Description
|
Constraints
- The rootfs directory specified using the --external-rootfs parameter must be an absolute path.
- The rootfs directory specified using the --external-rootfs parameter must be a complete OS environment including systemd package. Otherwise, the container fails to be started.
- When a container is deleted, the rootfs directory specified using --external-rootfs is not deleted.
- Containers based on an ARM rootfs cannot run in the x86 environment. Containers based on an x86 rootfs cannot run in the ARM environment.
- You are advised not to start multiple container instances in the same rootfs. That is, one rootfs is used by only one container instance that is in the lifecycle.
Example
Assuming the local rootfs path is /root/myrootfs, run the following command to start a system container:
# isula run -tid --system-container --external-rootfs /root/myrootfs none init
NOTE:
The rootfs is a user-defined file system. Prepare it by yourself. For example, a rootfs is generated after the TAR package of a container image is decompressed.