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

Fails to run on docker #45

Open
jonhadfield opened this issue Mar 1, 2020 · 0 comments
Open

Fails to run on docker #45

jonhadfield opened this issue Mar 1, 2020 · 0 comments

Comments

@jonhadfield
Copy link

UPDATE: I managed to find a solution as I wrote this issue but thought it worth sharing in case someone else comes across it


This is similar to #8 that discusses headless operation, but this may be docker specific.

Error
When running example code from: https://github.com/zalando/go-keyring#linux it returns error:
failed to unlock correct collection '/org/freedesktop/secrets/aliases/default'

Steps to reproduce

docker run --privileged -it ubuntu:latest /bin/bash
apt update && apt install -y curl dbus-x11 gnome-keyring git vim golang
go get github.com/zalando/go-keyring
vi test.go
add code example from: https://github.com/zalando/go-keyring#linux
go run test.go

gnome keyring is running

root@fed2abd272d4:/# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root      6320     1  0 15:09 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      6322     1  0 15:09 ?        00:00:00 /usr/bin/gnome-keyring-daemon --start --foreground --components=secrets
...

It seems it is possible to run headless using a python keyring library: https://keyring.readthedocs.io/en/latest/#using-keyring-on-headless-linux-systems
So, I followed the examples:

root@fed2abd272d4:/# dbus-run-session -- sh
# gnome-keyring-daemon --unlock
password
GNOME_KEYRING_CONTROL=/root/.cache/keyring-HWJLG0
SSH_AUTH_SOCK=/root/.cache/keyring-HWJLG0/ssh
# go run test.go
2020/03/01 15:12:43 secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant