-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add Dockerfile to build and run btcd on Docker. #1465
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dockerfiles are super cool! Documentation in the README would also be cool.
Since the commands create a volume and this is basically the .btcd
directory, it might also be good to add something on how to delete the volume.
The data
directory can get pretty big, and docker isn't the first place people look when trying to free up disk space.
There are dockerfiles for btcd out there but an official one would be good and many of the others are out of date.
I do get warnings when running the two commands though:
Error creating a default config file: open /sample-btcd.conf: no such file or directory
2019-09-05 14:44:35.338 [WRN] BTCD: open /root/.btcd/btcd.conf: no such file or directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for all the nitpicks - good job on the docs!
Once the ports are right this looks good
@legacycode yes it would and it would be nice to get those for ARM too. That why I think that Dockerfile should be updated to allow build for other platforms too. You can see from ruimarinho/docker-bitcoin-core#90 how I implemented that for bitcoind. On this one you basically need run go install commands with I also added some small nits about compose file styling on docs as those are yaml files. Not Dockerfile. |
@olljanat i implemented your suggestions and squashed my PR into one commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@legacycode Thanks. Run nicely on Raspberry Pi 3B+ 🎉
@jcvernaleo (as per #1530)
|
I would recommend not using root as the user. RUN groupadd -g 999 btcd && useradd -r -u 999 -g btcd btcd
USER btcd |
Is there any real benefit to this? One significant downside is that |
@torkelrogstad i realized this is not a priority. |
Which user the container runs as does not matter for access to the volume from the outside. All access still has to go through the Docker daemon, which enforces that no on else can read it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpicks, but looks good overall!
Regarding, root vs non-root, all the popular Dockerfiles for bitcoind use a non-root user, but again bitcoind needs to secure a native wallet unlike btcd. Let's not allow it to block this PR, but we may need to revisit this topic again. I see it as a tradeoff between best-practice vs convenience.
If we merge your other PR (#1468) first, you may need to adapt the formatting for this one a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
|
||
ARG ARCH=amd64 | ||
|
||
FROM golang:1.14-alpine3.12 AS build-container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be 1.15, but not worth holding this up over
As an aside, would be nice to include a docker image in future releases, but again outside of scope. LGTM |
Hi team,
i created the following Dockerfile that builds and runs btcd in a small (55MB) Alpine container. The /root/.btcd folder is mounted to a named docker volume by default. Any additional btcd argument can be passed by adding it at the end of the docker command. Very simple.
Please check the comments in the Dockerfile on how to build and run the container. It would be great to see it in the official repository and to have an official container on Docker Hub.
Best regards
/legacycode