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

Set DOCKER_HOST in the VM #12066

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

matejvasek
Copy link
Contributor

Some tools might expect the envvar is set.

[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
@afbjorklund
Copy link
Contributor

afbjorklund commented Oct 24, 2021

@matejvasek : There is no need to set the DOCKER_SOCK, the default will still work.

The podman-docker package uses the tmpfiles workaround, to create a symlink:

/var/run/docker.sock -> /run/podman/podman.sock

Currently it is copied to /etc/tmpfiles.d/podman-docker.conf instead of using the RPM: b3307bc

https://github.com/containers/podman/blob/main/contrib/systemd/system/podman-docker.conf


The environment variable is used for rootless containers: (so user "core", not user "root")

https://docs.docker.com/engine/security/rootless/#expose-docker-api-socket-through-ssh

So that is the one you should configure, but the default socket doesn't need the variable.

And of course this is only needed for compat socket, podman-remote requires a path.

DOCKER_HOST=ssh://root@localhost:35503
CONTAINER_HOST=ssh://root@localhost:35503/run/podman/podman.sock

@matejvasek
Copy link
Contributor Author

matejvasek commented Oct 24, 2021

@afbjorklund OK rootfull should work without setting the environment variable since the socket is at default location. But for rootless it's useful. And I believe this shouldn't hurt anybody because podman info -f "{{.Host.RemoteSocket.Path}}" prints correct path depending on user. So it sets DOCKER_HOST correctly for both root and core user to their respective socket.

@matejvasek
Copy link
Contributor Author

I am using a software that is mounting socket into running container. So I need the DOCKER_HOST environment variable to be set properly for each user so I know what socket mount.

@matejvasek
Copy link
Contributor Author

For rootfull it's not really issue if the symlink exists.

@matejvasek
Copy link
Contributor Author

I could move the script to /home/core/.bashrc.d so it's set only for non-root, but as I mentioned above having it set also for root shoudn't be issue.

@mheon
Copy link
Member

mheon commented Oct 25, 2021

@baude PTAL

@rhatdan
Copy link
Member

rhatdan commented Oct 25, 2021

I would set it for both cases, LGTM

@TomSweeneyRedHat
Copy link
Member

LGTM too, but would like a @baude head nod

@matejvasek
Copy link
Contributor Author

@baude PTAL

@baude
Copy link
Member

baude commented Oct 27, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2021
@rhatdan
Copy link
Member

rhatdan commented Oct 27, 2021

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 27, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matejvasek, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2021
@openshift-merge-robot openshift-merge-robot merged commit a05a445 into containers:main Oct 27, 2021
@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. 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 this pull request may close these issues.

7 participants