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

Fix typo in Docker example #890

Closed
wants to merge 1 commit into from
Closed

Fix typo in Docker example #890

wants to merge 1 commit into from

Conversation

sethforprivacy
Copy link

This typo breaks the Docker command, as hsd is expecting an =.

This typo breaks the Docker command, as `hsd` is expecting an `=`.
@Falci
Copy link
Member

Falci commented Apr 21, 2024

I have a server running it with --http-host '::' and it works fine.

@sethforprivacy
Copy link
Author

Running the image here, hsd crashed on startup claiming that the http-host arg didn't exist due to the space instead of =.

As soon as I made it match every other config value is supposed to be passed in it started right up without issues.

@Falci
Copy link
Member

Falci commented Apr 21, 2024

Tested again with the following code:

docker run --name hsd \
    --publish 12037:12037 \
    --volume /tmp/hsd:/root/.hsd \
    ghcr.io/handshake-org/hsd:latest \
    --http-host 0.0.0.0 \
    --api-key=foo

And it worked with or without the =.

Also, checked bcfg and it seems to support both space or =.

There's no harm in merging this PR, but I don't see how this could be root of the problem you faced, unless there's a bigger issue with bcfg.

@sethforprivacy
Copy link
Author

sethforprivacy commented Apr 21, 2024

Ah, perhaps it's a difference in how Docker Compose's command arg parses these?

Will share the format I used shortly that had issues.

Edit: Here is the format I used that errored out:

  hsd:
    image: ghcr.io/handshake-org/hsd:latest
    restart: unless-stopped
    container_name: hsd
    volumes:
      - hsd-data:/root/.hsd
    ports:
      - 127.0.0.1:12037:12037
      - 12038:12038
      - 127.0.0.1:12039:12039
      - 44806:44806
    command:
      - "--http-host 0.0.0.0"
      - "--api-key=foo"

@rithvikvibhu
Copy link
Member

I think similar to Dockerfile CMD, the command, an array, should be split and separated by spaces: https://docs.docker.com/reference/dockerfile/#cmd

So if you want to use spaces in the compose file, then it should look like

commands:
    - "--http-host"
    - "0.0.0.0"
    - "--api-key"
    - "foo"

Or of course, like the previous comment, using = in a single line will work since it's still 1 argument passed to hsd/bcfg.

This behaviour applies to any executable/program receiving arguments, not just hsd/bcfg.

Since the current example in INSTALL.md is with docker CLI (and not Compose), I don't think it's wrong; space is perfectly acceptable.

However, adding a new Compose example below this one would be helpful. It can use = which brings the keys and values on the same line making it easier to read.

@sethforprivacy
Copy link
Author

Good catch, @rithvikvibhu, has been so long since I used docker run instead of Compose I had forgotten that difference.

Will open a PR adding an example instead!

@sethforprivacy sethforprivacy deleted the patch-1 branch April 22, 2024 10:33
@sethforprivacy
Copy link
Author

Related PR: #891

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

Successfully merging this pull request may close these issues.

3 participants