-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
website: enhance container examples #2956
Draft
AkihiroSuda
wants to merge
1
commit into
lima-vm:master
Choose a base branch
from
AkihiroSuda:docs-containers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+113
−29
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
title: Containers | ||
weight: 5 | ||
--- | ||
|
||
## Running containers | ||
{{< tabpane text=true >}} | ||
|
||
{{% tab header="containerd" %}} | ||
{{< tabpane text=true >}} | ||
{{% tab header="Rootless" %}} | ||
```bash | ||
lima nerdctl run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
nerdctl.lima run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine | ||
``` | ||
{{% /tab %}} | ||
{{% tab header="Rootful" %}} | ||
```bash | ||
lima sudo systemctl enable --now containerd | ||
lima sudo nerdctl run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine | ||
``` | ||
{{% /tab %}} | ||
{{< /tabpane >}} | ||
|
||
- For the usage of containerd and nerdctl (contaiNERD ctl), visit <https://github.com/containerd/containerd> | ||
and <https://github.com/containerd/nerdctl>. | ||
|
||
- If you have installed Lima by `make install`, the `nerdctl.lima` command is also available as `nerdctl`. | ||
If you have installed Lima by `brew install lima`, you may make an alias (or a symlink) by yourself: | ||
`alias nerdctl=nerdctl.lima` | ||
|
||
{{% /tab %}} | ||
|
||
{{% tab header="Docker" %}} | ||
{{< tabpane text=true >}} | ||
{{% tab header="Rootless" %}} | ||
```bash | ||
limactl start template://docker | ||
export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock') | ||
docker run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine | ||
``` | ||
{{% /tab %}} | ||
{{% tab header="Rootful" %}} | ||
TBD | ||
{{% /tab %}} | ||
{{< /tabpane >}} | ||
{{% /tab %}} | ||
|
||
{{% tab header="Podman" %}} | ||
{{< tabpane text=true >}} | ||
{{% tab header="Rootless" %}} | ||
TBD | ||
{{% /tab %}} | ||
{{% tab header="Rootful" %}} | ||
TBD | ||
{{% /tab %}} | ||
{{< /tabpane >}} | ||
{{% /tab %}} | ||
|
||
|
||
{{% tab header="Kubernetes" %}} | ||
{{< tabpane text=true >}} | ||
{{% tab header="kubeadm" %}} | ||
```bash | ||
limactl start template://k8s | ||
export KUBECONFIG=$(limactl list k8s --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml') | ||
kubectl apply -f ... | ||
``` | ||
{{% /tab %}} | ||
{{% tab header="k3s" %}} | ||
TBD | ||
{{% /tab %}} | ||
{{< /tabpane >}} | ||
{{% /tab %}} | ||
|
||
{{< /tabpane >}} | ||
|
||
- <http://127.0.0.1:8080> is accessible from the host, as well as from the VM. | ||
|
||
## Accelerating pulls with eStargz | ||
|
||
WIP | ||
|
||
```console | ||
|
||
$ time nerdctl --snapshotter=overlayfs run -it --rm ghcr.io/stargz-containers/python:3.7-org python3 -c 'print("hi")' | ||
[...] | ||
hi | ||
|
||
real 0m33.505s | ||
user 0m2.962s | ||
sys 0m6.629s | ||
``` | ||
|
||
```console | ||
$ time nerdctl --snapshotter=stargz run -it --rm ghcr.io/stargz-containers/python:3.7-esgz python3 -c 'print("hi")' | ||
[...] | ||
hi | ||
|
||
real 0m12.335s | ||
user 0m0.469s | ||
sys 0m0.522s | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Looks like tabpanes cannot be nested)