mirror of
https://github.com/tldr-pages/tldr
synced 2026-08-26 14:13:36 +01:00
container: add page (#23074)
This commit is contained in:
@@ -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}}`
|
||||
Reference in New Issue
Block a user