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

docker: add nsswitch.conf to base layer #1999

Merged
merged 1 commit into from
Aug 4, 2020
Merged

Conversation

rvl
Copy link
Contributor

@rvl rvl commented Aug 4, 2020

Overview

Configures the docker image to use /etc/hosts ahead of DNS.

This works around the issue of the CLI being hardcoded to use localhost.

Comments

Before:

docker run --network host --rm -ti --entrypoint=bash inputoutput/cardano-wallet:2020.7.28-shelley
bash-4.4# ping localhost
PING localhost(localhost.lan (::1)) 56 data bytes
64 bytes from localhost.lan (::1): icmp_seq=1 ttl=64 time=0.043 ms
64 bytes from localhost.lan (::1): icmp_seq=2 ttl=64 time=0.087 ms
64 bytes from localhost.lan (::1): icmp_seq=3 ttl=64 time=0.092 ms
^C
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2043ms
rtt min/avg/max/mdev = 0.043/0.074/0.092/0.022 ms
bash-4.4# cat /etc/nsswitch.conf
cat: /etc/nsswitch.conf: No such file or directory

After:

docker run --network host --rm -ti --entrypoint=bash inputoutput/cardano-wallet:2020.7.28-shelley
bash-4.4# ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.047 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.081 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.078 ms
^C
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2062ms
rtt min/avg/max/mdev = 0.047/0.068/0.081/0.015 ms
bash-4.4# cat /etc/nsswitch.conf
hosts: files dns

Before:
    docker run --network host --rm -ti --entrypoint=bash inputoutput/cardano-wallet:2020.7.28-shelley
    bash-4.4# ping localhost
    PING localhost(localhost.lan (::1)) 56 data bytes
    64 bytes from localhost.lan (::1): icmp_seq=1 ttl=64 time=0.043 ms
    64 bytes from localhost.lan (::1): icmp_seq=2 ttl=64 time=0.087 ms
    64 bytes from localhost.lan (::1): icmp_seq=3 ttl=64 time=0.092 ms
    ^C
    --- localhost ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2043ms
    rtt min/avg/max/mdev = 0.043/0.074/0.092/0.022 ms
    bash-4.4# cat /etc/nsswitch.conf
    cat: /etc/nsswitch.conf: No such file or directory

After:

    docker run --network host --rm -ti --entrypoint=bash inputoutput/cardano-wallet:2020.7.28-shelley
    bash-4.4# ping localhost
    PING localhost (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.047 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.081 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.078 ms
    ^C
    --- localhost ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2062ms
    rtt min/avg/max/mdev = 0.047/0.068/0.081/0.015 ms
    bash-4.4# cat /etc/nsswitch.conf
    hosts: files dns
@rvl rvl added IMPROVEMENT Mark a PR as an improvement, for auto-generated CHANGELOG BUG:MINOR labels Aug 4, 2020
@rvl rvl self-assigned this Aug 4, 2020
@rvl rvl added this to In Progress in Adrestia Aug 4, 2020
Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

LGTM. What about also changing the BaseUrl constructed in the CLI to not use localhost?

@KtorZ KtorZ merged commit 204a59b into master Aug 4, 2020
@KtorZ KtorZ deleted the rvl/docker-nsswitch branch August 4, 2020 13:14
@rvl
Copy link
Contributor Author

rvl commented Aug 5, 2020

The issue for that is (was) #949.

@KtorZ KtorZ moved this from In Progress to Closed in Adrestia Aug 5, 2020
@runeksvendsen
Copy link
Contributor

This works around the issue of the CLI being hardcoded to use localhost.

How do I work around this issue, exactly?

@rvl
Copy link
Contributor Author

rvl commented Sep 21, 2021

Hello @runeksvendsen. There is currently no way to use the cardano-wallet CLI client with a non-localhost server.

If you need to call the API of a cardano-wallet server running on another host, you can:

  1. Use curl to make your API requests instead of cardano-wallet.
  2. port forward the remote server to a localhost port, then use cardano-wallet --port=PORT

Just make sure that the API server is running with the correct --listen-address option.

The changes in this PR achieved something different to what you probably want. This PR makes it at least possible to use the cardano-wallet CLI client inside the same Docker container which the server is running on.

@CharlesMorgan-IOHK CharlesMorgan-IOHK removed this from Closed in Adrestia Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IMPROVEMENT Mark a PR as an improvement, for auto-generated CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants