Linux command
crun 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run a container
crun run [container_id]
Create a container
crun create [container_id]
Start a created container
crun start [container_id]
List running containers
crun list
Execute a command
crun exec [container_id] [command]
Delete a container
crun delete [container_id]
Get container state
crun state [container_id]
Pause all processes
crun pause [container_id]
Show processes
crun ps [container_id]
说明
crun is a fast and low-memory footprint OCI container runtime written in C. It is fully compatible with the OCI (Open Container Initiative) runtime specification and can be used as a drop-in replacement for runc. crun implements all required OCI runtime operations including container creation, execution, and lifecycle management. It supports Linux namespaces, cgroups v1 and v2, seccomp, and other container isolation features. The runtime is designed to be lightweight and efficient, with significantly faster startup times and lower memory usage compared to Go-based runtimes. It's used by container engines like Podman and Buildah.
参数
- run _ID_
- Create and start a container from an OCI bundle.
- create _ID_
- Create a container but don't start it.
- start _ID_
- Start a previously created container.
- exec _ID_ _CMD_
- Execute a command in a running container.
- delete _ID_
- Delete a container.
- kill _ID_ _SIGNAL_
- Send a signal to the container's init process.
- list
- List containers.
- state _ID_
- Output the state of a container.
- pause _ID_
- Pause all processes in the container.
- resume _ID_
- Resume the processes in the container.
- ps _ID_
- Show the processes running in a container.
- update _ID_
- Update container resource constraints.
- spec
- Create a new OCI bundle specification.
- checkpoint _ID_
- Checkpoint a running container using CRIU.
- --root _DIR_
- Root directory for container state.
- --debug
- Produce verbose output.
- --log=_DESTINATION_
- Define destination for error and warning messages (file:PATH, journald:ID, or syslog:ID).
- --systemd-cgroup
- Use systemd for configuring cgroups.
- --cgroup-manager=_MANAGER_
- Specify cgroup manager (cgroupfs, systemd, or disabled).
FAQ
What is the crun command used for?
crun is a fast and low-memory footprint OCI container runtime written in C. It is fully compatible with the OCI (Open Container Initiative) runtime specification and can be used as a drop-in replacement for runc. crun implements all required OCI runtime operations including container creation, execution, and lifecycle management. It supports Linux namespaces, cgroups v1 and v2, seccomp, and other container isolation features. The runtime is designed to be lightweight and efficient, with significantly faster startup times and lower memory usage compared to Go-based runtimes. It's used by container engines like Podman and Buildah.
How do I run a basic crun example?
Run `crun run [container_id]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does run _ID_ do in crun?
Create and start a container from an OCI bundle.