Skip to content
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

Add client wrappers for docker and podman, similar to nerdctl wrapper #855

Merged
merged 1 commit into from
May 16, 2022

Conversation

afbjorklund
Copy link
Member

@afbjorklund afbjorklund commented May 11, 2022

These will call the clients, without having to clobber the global configuration.

You only need to run the first command from the "message", not the second:

INFO[0128] Message from the instance "docker":          
To run `docker` on the host (assumes docker-cli is installed), run the following commands:
------
docker context create lima --docker "host=unix:///home/anders/.lima/docker/sock/docker.sock"
docker context use lima
docker run hello-world
------
INFO[0018] Message from the instance "podman":          
To run `podman` on the host (assumes podman-remote is installed), run the following commands:
------
podman system connection add lima "unix:///home/anders/.lima/podman/sock/podman.sock"
podman system connection default lima
podman --remote run quay.io/podman/hello
------

EDIT: Don't have to create the context/connection, using env variables instead.

They were mentioned as comments in the YAML files, if you looked close enough...

Sometimes the commands are missed, then it would be useful to view them:

Installing the clients is painful, but you can use brew and it was scoped out:


Only one VM of each kind is supported, since the name "lima" is hardcoded.

Note that you need podman-remote for v3, in order to talk to the podman VM:

Error: unable to connect to Podman socket: server API version is too old. Client "4.0.0" server "3.4.4"

If the binary clients are missing, it will default to SSH - just as for nerdctl...

limactl shell docker docker

limactl shell podman podman

cmd/docker.lima Outdated Show resolved Hide resolved
cmd/docker.lima Outdated Show resolved Hide resolved
@AkihiroSuda
Copy link
Member

Looks good but please squash commits

Install the extra client wrappers

But don't set up any alias for "docker" or "podman", by default.
They would conflict with the regular client (binary) programs.

Use environment variables

This means it will work with multiple instances if needed.
Instead of hardcoding just one context/connection, "lima".

Exit if instance does not exist

Signed-off-by: Anders F Björklund <[email protected]>
@AkihiroSuda AkihiroSuda requested a review from jandubois May 16, 2022 05:09
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I was briefly wondering about the case where the instance exists, but is not running, but I think the default error message from the docker CLI is good enough:

$ docker.lima ps
Cannot connect to the Docker daemon at unix:///Users/jan/.lima/docker/sock/docker.sock. Is the docker daemon running?

@jandubois jandubois merged commit 8388641 into lima-vm:master May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants