container: add page (#23074)

This commit is contained in:
Qutibah Ananzeh
2026-08-23 16:11:46 +03:00
committed by GitHub
parent 5cfb49cef2
commit 8d3431b698
+36
View File
@@ -0,0 +1,36 @@
# container
> Create and run Linux containers as lightweight virtual machines on macOS.
> More information: <https://github.com/apple/container>.
- Start the container services (required before running containers):
`container system start`
- Run a container from an image interactively and remove it after it exits:
`container run --rm {{[-it|--interactive --tty]}} {{image}} {{sh}}`
- Run a container in the background with a name and a published port:
`container run {{[-d|--detach]}} --name {{container_name}} {{[-p|--publish]}} {{8080:80}} {{image}}`
- Execute a command inside a running container:
`container exec {{[-it|--interactive --tty]}} {{container_name}} {{sh}}`
- List all containers (running and stopped):
`container {{[ls|list]}} {{[-a|--all]}}`
- Follow the logs of a container:
`container logs {{[-f|--follow]}} {{container_name}}`
- Build an image from a Dockerfile in a directory:
`container build {{[-t|--tag]}} {{image_name}} {{path/to/directory}}`
- Stop or delete a container:
`container {{stop|delete}} {{container_name}}`