diff --git a/pages/osx/container.md b/pages/osx/container.md new file mode 100644 index 0000000000..c3b1718cca --- /dev/null +++ b/pages/osx/container.md @@ -0,0 +1,36 @@ +# container + +> Create and run Linux containers as lightweight virtual machines on macOS. +> More information: . + +- 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}}`