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

have podman env or similar command to output setup that makes other docker clients work #11422

Closed
maxandersen opened this issue Sep 2, 2021 · 17 comments · Fixed by #13075
Closed
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@maxandersen
Copy link

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

I'm coming to podman to have a way to run containers but still use it with the larger ecosystem
that know how to connect to docker demon (i.e. test containers etc.)

They don't "just work" thus I assume there is some environment I need to setup - should/could podman provide a command like podman env that would print out out the necessary config ?

Describe the results you received:

podman env 
DOCKER_HOST=abc
DOCKER_...
## use this in your shell `source <(podman env)`

or similar.

Just some hint/setup to enable docker ce migrations.

@mheon mheon added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 3, 2021
@afbjorklund
Copy link
Contributor

afbjorklund commented Sep 9, 2021

It's possible to view the current sockets, using podman system connection ls

Ultimately this needs to be paired with the other feature, to create a ssh tunnel.

But one could add a generic feature. to print both DOCKER_HOST and CONTAINER_HOST ?

At the moment, it outputs JSON: (podman system connection ls --format=json)

[
    {
        "Name": "podman-machine-default*",
        "URI": "ssh://core@localhost:33475/run/user/1000/podman/podman.sock",
        "Identity": "/home/anders/.ssh/podman-machine-default"
    },
    {
        "Name": "podman-machine-default-root",
        "URI": "ssh://root@localhost:33475/run/podman/podman.sock",
        "Identity": "/home/anders/.ssh/podman-machine-default"
    }
]

Currently there is no way to provide the ssh key or even the socket path to Docker, though...

stderr=root@localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

ssh host connection is not valid: extra path after the host: "/run/podman/podman.sock"

So one has to work around it, using ssh-add and using symlinks. Not needed for Podman.

@n1hility
Copy link
Member

FYI I have a WIP proposal that introduces this and ssh tunneling here:
#11643

@afbjorklund
Copy link
Contributor

afbjorklund commented Sep 18, 2021

@n1hility : does your PR add another "connection" for the temporary unix socket, or only the env vars ?

I don't have anything against just using the environment variables myself, but they were "replaced" earlier.

I suppose if you only use Docker, you are stuck with DOCKER_HOST (and workarounds for the SSH key)

Then something like docker-machine env work work just fine (for eval), see also minikube docker-env

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Oct 19, 2021

@n1hility @afbjorklund What is going on with this?

@n1hility
Copy link
Member

@rhatdan This should be addressed soon as part of the work on #11462

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@maxandersen
Copy link
Author

Still relevant

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@baude
Copy link
Member

baude commented Jan 17, 2022

I'm a little turned around on this one @maxandersen ... what exactly are you asking for? are you wanting to use a podman frontend and a docker backend?

@n1hility
Copy link
Member

n1hility commented Feb 17, 2022

after chatting with @maxandersen, he would like to also have an additional docker-env command like minikube or the old docker machine in case the output of podman machine start was ran in the background or left running and later forgotten.

@n1hility
Copy link
Member

ill do a follow-up PR for that for a later release

@afbjorklund
Copy link
Contributor

afbjorklund commented Feb 17, 2022

Both docker and podman seem to be switching to magic config files, instead of using environment variables.

DOCKER_HOST vs. docker context ls

CONTAINER_HOST vs. podman system connection list

Currently docker does list the environment context, but podman does not list the environment connection.

$ docker context ls
NAME        DESCRIPTION                               DOCKER ENDPOINT                                     KUBERNETES ENDPOINT   ORCHESTRATOR
default *   Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                                               swarm
lima                                                  unix:///home/anders/.lima/docker/sock/docker.sock                         
$ podman system connection list
Name        URI                                                Identity    Default
lima        unix:///home/anders/.lima/podman/sock/podman.sock              false

@afbjorklund
Copy link
Contributor

afbjorklund commented Feb 17, 2022

The help text seems to have a typo/syntax error in it, missing the // in the scheme.

podman --remote --help

--url string URL to access Podman service (CONTAINER_HOST) (default "unix:/run/user/1000/podman/podman.sock")

But it's a valid configuration (for Podman), so it's just not an URL. Probably not important.

@maxandersen
Copy link
Author

But magic context files is more for global config, right ?

It doesn't let you isolate / reset configuration for just one shell ?

@afbjorklund
Copy link
Contributor

afbjorklund commented Feb 17, 2022

Right, that is why I don't like them myself...

But podman machine sets it up by default:

Name                         URI                                                          Identity                                  Default
podman-machine-default       ssh://core@localhost:42465/run/user/1000/podman/podman.sock  /home/anders/.ssh/podman-machine-default  true
podman-machine-default-root  ssh://root@localhost:42465/run/podman/podman.sock            /home/anders/.ssh/podman-machine-default  false

No environment variables needed to set.

The default socket changed, everywhere.

podman --remote --help

--url string URL to access Podman service (CONTAINER_HOST) (default "ssh://core@localhost:42465/run/user/1000/podman/podman.sock")

@rhatdan
Copy link
Member

rhatdan commented Feb 17, 2022

We have talked about adding a podman context command to match the Docker one for certain types of scripts. Perhaps hidden from users.

podman machine env would probably be acceptable Perhaps with a --docker option or maybe just print out the DOCKER_HOST=/PATH

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants