Adding Docker/docker-compose files #13542

pull stakauskas wants to merge 1 commits into bitcoin:master from stakauskas:docker changing 5 files +255 −0
  1. stakauskas commented at 10:36 AM on June 27, 2018: none

    Ability to build and run bitcoin from Docker. Builds docker image with bitcoin and DB4 4.8.30.NC, starts with docker-compose. Easy to modify startup parameters or add configuration files and scale containers. Image uses CentOS and gosu to start bitcoin as bitcoin user (PID 1).

  2. Adding Docker/docker-compose files d33e48e7d1
  3. fanquake added the label Build system on Jun 27, 2018
  4. fanquake added the label Scripts and tools on Jun 27, 2018
  5. fanquake removed the label Build system on Jun 27, 2018
  6. fanquake commented at 10:45 AM on June 27, 2018: member

    #10903 was the last time this was suggested. The conclusion then was that this isn't necessarily something we want to maintain here, and would probably be better suited to an external repo.

    See: https://github.com/Sjors/docker-bitcoin-core https://github.com/NicolasDorier/docker-bitcoin https://github.com/jamesob/docker-bitcoind

    for some examples of such repositories. @stakauskas What's your motivation for adding the Dockerfiles here?

  7. MarcoFalke commented at 10:51 AM on June 27, 2018: member

    Agree with @fanquake

  8. promag commented at 11:17 AM on June 27, 2018: member

    NACK for the same reasons.

  9. stakauskas commented at 11:21 AM on June 27, 2018: none

    It was first created as an addition to ElementsProject in - https://github.com/ElementsProject/elements/pull/372 , thus appeared here.

    Though having Docker images could be beneficial for community wanting to run software in containers and one image would target Windows/Mac/Linux instead of having separate packages for each of them.

  10. NicolasDorier commented at 12:50 PM on June 27, 2018: contributor

    I think maintaining several Dockerfile like this as one big advantage: We can use those as part of the CI to be sure bitcoind build correctly on the different OS which should be supported by Bitcoin, as well as running the tests on different distro. (Actually I think this is what we do for now only on ubuntu?) @sipsorcery for example maintain a dockerfile for building on Windows via msvc, and configured CI to run it. This way he can warn you when something break Windows msvc build. Even if you are not fan of windows, I think you will see the advantage to have it for your favorite linux distro instead of relying on outdated documentation and untested dev environment.

    It is also way more useful than maintaining a documentation, as anybody can reproduce the build on their environment just by reading the dockerfile related to their OS.

    See this as a documentation which can be checked automatically during CI.

    It also has the advantage that people can easily distribute their own bitcoin core image with their favorite freshly backed commits.

    My repo https://github.com/NicolasDorier/docker-bitcoin is good if you want just an official release, but I totally see the advantage of providing dockerfiles which build from sources.

    It is big ACK for me. It is better than trying to maintain a documentation, but serve also other purposes.

  11. promag commented at 3:17 PM on June 27, 2018: member

    I consider these different:

    • Dockerfile(s) to build the official image - usually in a separate repository with multiple versions/variants - and usually download the office source code;
    • docker-compose to launch 3rd party services to aid development - not relevant here I think.
    • docker-compose + multiple Dockerfile to build from local source in different flavours - usually to aid development or CI.
  12. promag commented at 3:20 PM on June 27, 2018: member

    It also has the advantage that people can easily distribute their own bitcoin core image with their favorite freshly backed commits.

    This is also possible with external Dockerfile.

  13. stakauskas commented at 3:39 PM on June 27, 2018: none

    I'd compare Dockerfile to RPM spec and docker-compose as a way to manage your containers, e.g systemctl/systemd for services, just portable across different OS versions. While you can run any docker image with 'docker run', it's much easier to start with docker-compose, which allows easier and faster configuration for running containers. In this case testnet/mainnet nodes can be started within one go, scale if needed. Network isolation/ports management provided out of the box, if you wanted 3 nodes, you do not need to change configuration for port mapping, as compose will assign random host -> same port in container, etc...

  14. MarcoFalke commented at 3:54 PM on June 27, 2018: member

    I don't see what advantage a dockerfile gives us to our existing processes. Note that it is already possible to build any commit from source deterministically by using it's gitian descriptor. Using a dockerfile to create a docker image as opposed to using gitian to create a binary wouldn't be deterministic any more.

    Also note that the actual build step is just a single line ./configure && make. Installing the dependencies is what differs per dist and usually the cause of issues. Instead of having a Dockerfile for each distribution, it seems easier to me to just list the dependencies in a readme (and maybe a one-liner for common distributions to install all dependencies)

    Note that on travis we already use docker, but I don't see how a Dockerfile would simplify anything there.

    If there is a valid use case for a Dockerfile that makes our process easier, I am all in, otherwise I think this will lead to a maintenance burden and nit-picking, because everyone has their own use case and wants the Dockerfile to match that use case.

  15. MarcoFalke commented at 4:02 PM on June 27, 2018: member

    RPM spec

    Sorry for ot, but we had someone contribute an rpm spec file and then it would just sit there unmaintained and now it is unclear what to do with it: #13137

    I think we want to avoid doing the same with a Dockerfile.

  16. stakauskas commented at 4:57 PM on June 27, 2018: none

    Installing the dependencies is what differs per dist and usually the cause of issues. Instead of having a Dockerfile for each distribution, it seems easier to me to just list the dependencies in a readme (and maybe a one-liner for common distributions to install all dependencies)

    There's no need to have Dockerfile per each distribution, though it's possible and not difficult to maintain. After choosing base image, the whole lifecycle of running(also removing/updating/etc) software is as easy as choosing image:tag, bitcoin:version, instead of downloading package for Windows/Linux/Mac and figuring out deps individually.

  17. NicolasDorier commented at 7:27 AM on June 28, 2018: contributor

    Instead of having a Dockerfile for each distribution, it seems easier to me to just list the dependencies in a readme (and maybe a one-liner for common distributions to install all dependencies)

    I disagree with this point. This result in outdated documentation, and additional support when somebody complains that it does not work because some outdated dependencies on their system, also it never get tested and too often people break builds without knowing. @sipsorcery very often report Windows msvc breaks as issues and PR. Those could be easily detected if dockerfile were used and built during CI.

  18. skwp commented at 8:31 PM on July 9, 2018: none

    As someone new to bitcoin compilation, I found getting a gitian build up and running quite complicated, especially on an OSX machine trying to use virtualization.

    I get the motivations around providing Dockerfiles in external projects but that means there is no (obvious) "source of truth" for getting started. If we want more devs poking at bitcoin I think it would be good that there was an official Dockerfile here that just gave you a build that you could play with locally (the intention being development, not production). That way you could test your changes easily. I was about to submit one but then saw this effort and decided to pile on my comment.

    I greatly support making it easier for new devs to get a local image running and docker provides exactly that.

    A few prior comments may not be entirely familiar with how docker works. We need provide only one file and that file will be universal and will not require any maintenance as it will self-document all the dependencies. A CI build could be used to verify that the container builds and produces the bitcoind binary, which is all that's necessary to make sure nothing is broken as far as deps go. In this regard it's much simpler than an rpm spec and not directly comparable.

  19. in Dockerfile:10 in d33e48e7d1
       5 | +ENV GOSU_URL https://github.com/tianon/gosu/releases/download
       6 | +ENV GOSU_APP ${GOSU_URL}/${GOSU_VERSION}/gosu-${GOSU_ARCH}
       7 | +ENV GOSU_ASC ${GOSU_URL}/${GOSU_VERSION}/gosu-${GOSU_ARCH}.asc
       8 | +ENV DB4_VERSION 4.8.30.NC
       9 | +ENV DB4_HASH 12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef
      10 | +ENV DB4_URL http://download.oracle.com/berkeley-db/db-${DB4_VERSION}.tar.gz
    


    MarcoFalke commented at 11:03 AM on July 10, 2018:

    Wouldn't it make more sense to only have a minimum set of build dependencies and then build the Bitcoin Core dependencies from ./depends/?

  20. in Dockerfile:94 in d33e48e7d1
      89 | +RUN set -x \
      90 | +    && cd /usr/src/bitcoin \
      91 | +    && ./autogen.sh \
      92 | +    && ./configure --with-gui=no \
      93 | +    && make -j$(nproc) \
      94 | +    && make install \
    


    MarcoFalke commented at 11:13 AM on July 10, 2018:

    If there goal is to provide an easy entry point for development, ci or testing, the install step shouldn't be run as part of the image creation, I believe. It should instead be provided though the docker compose entrypoint. See for example the work by @jamesob https://github.com/bitcoin/bitcoin/pull/10903/files

  21. MarcoFalke commented at 11:17 AM on July 10, 2018: member

    Concept ACK, if this helps people to run tests, ci and generally makes it easier to bootstrap a development environment. Though, we shouldn't provide any ways to run this in production, since there are already statically linked, gitian-built binaries available. If you need those releases wrapped into a dockerfile, there is already https://github.com/NicolasDorier/docker-bitcoin/tree/master/core

  22. stakauskas commented at 12:57 PM on July 10, 2018: none

    Concept ACK, if this helps people to run tests, ci and generally makes it easier to bootstrap a development environment.

    The initial pull request emerged and divided into two groups dev/prod. Initially it was created as an alternative to running standalone binaries in favor of running it in containerised setup. If it's completely for dev purposes (which is a good start) I'll modify Dockerfile and related files accordingly so it could be more suitable for the purpose.

  23. skwp commented at 6:03 PM on July 10, 2018: none

    Going to chime in again to slightly disagree with "we shouldn't provide docker for production", again due to the "source of truth" argument. If you google bitcoin on docker you get a variety of blog posts and repos. It's not that hard to provide a dockerfile and make sure it's working which ensures that it's as easy as possible to run a node. If more nodes is what we want, then providing a production friendly way to spin one up is not a bad idea.

  24. promag commented at 6:22 PM on July 10, 2018: member

    -1 to provide production images here. I think we shouldn't influence deployment.

    +1 in providing docker compose services to build and test with diferent toochain and configurations.

    +1 in providing official docker images (not sure how to tackle that) elsewhere.

  25. jtimon commented at 11:47 PM on July 10, 2018: contributor

    Concept ACK. This is contrib anyway, if it goes unmaintained it can always be simply removed.

  26. NicolasDorier commented at 4:54 AM on July 11, 2018: contributor

    @jtimon it can't be unmaintained if included inside CI. Having a docker failing to build is equivalent to having an out of date documentation: the documentation need to be fixed, or the committer need to not break things.

  27. NicolasDorier commented at 4:55 AM on July 11, 2018: contributor

    @sipsorcery you might be interested to follow this PR.

  28. promag commented at 6:48 AM on July 11, 2018: member
  29. MarcoFalke commented at 10:41 AM on July 11, 2018: member

    I believe providing a dockerfile for production use can be done independently (in a different pull request) of providing a dockerfile for development/testing purposes?

  30. MarcoFalke added the label Tests on Jul 11, 2018
  31. MarcoFalke commented at 10:43 AM on July 11, 2018: member

    If this pull request is to be used to add a devel dockerfile, I'd suggest prefixing the title with "test" or "qa".

  32. stakauskas commented at 3:49 PM on July 11, 2018: none

    If this pull request is to be used to add a devel dockerfile, I'd suggest prefixing the title with "test" or "qa".

    Files in this pull request would match the prod setup. We use it the way it is to run and scale nodes in prod environment. I'd suggest that better way would be to create a separate pull req for development environment as it will differ significantly and close this if there's no need for prod env. Though, I would agree @skwp that official production friendly docker environment would be nice to have. As for someone having resources it's as easy as one command to run x prod/test nodes in the current containerised infrastructure. And I don't see how it would influence deployment as mentioned by @promag apart from the fact that it would make it much easier to deploy and manage.

  33. promag commented at 3:58 PM on July 11, 2018: member

    I mean, should we promote deployments with docker? The way I see, that would be the case if a dockerfile is added.

  34. stakauskas commented at 4:07 PM on July 11, 2018: none

    I mean, should we promote deployments with docker? The way I see, that would be the case if a dockerfile is added.

    It wouldn't be a promotion, it would just be an ability for people to choose another variant to running the software. Most of the projects provides official Dockerfiles/docker images in addition to the traditional released binaries. It would also make it easy to have official way to run bitcoin nodes in a container native infrastructures which is quite common approach by todays standards; and possibly attract much more people running nodes, with having official way to do it.

  35. TheBlueMatt commented at 1:12 AM on July 13, 2018: member

    We now also have an external "packaging" repo at https://github.com/bitcoin-core/packaging where things like this may make more sense, just to add to the discussion.

    On July 11, 2018 4:07:37 PM UTC, paulius notifications@github.com wrote:

    I mean, should we promote deployments with docker? The way I see, that would be the case if a dockerfile is added.

    It wouldn't be a promotion, it would just be an ability for people to choose another variant to running the software. Most of the projects provides official Dockerfiles/docker images in addition to the traditional released binaries. It would also make it easy to have official way to run bitcoin nodes in a container native infrastructures which is quite common approach by todays standards. It would possibly attract much more people running nodes, with having official way to do it.

    -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/bitcoin/bitcoin/pull/13542#issuecomment-404225134

  36. stakauskas commented at 12:15 PM on July 13, 2018: none

    @TheBlueMatt Agreed, moving Docker related stuff to bitcoin-core/packaging would make sense.

  37. jtimon commented at 4:16 PM on July 13, 2018: contributor

    @TheBlueMatt Agreed, moving Docker related stuff to bitcoin-core/packaging would make sense.

    That would solve the "6 people maintaining the same thing independently" problem too. Fine with me. To me the most important part is avoiding that work duplication.

  38. MarcoFalke commented at 4:31 PM on July 13, 2018: member

    Could you adjust this pull request to be just a patch that adds a link in some doc to https://github.com/bitcoin-core/packaging/blob/master/docker/README.md ?

  39. MarcoFalke commented at 4:32 PM on July 13, 2018: member

    And everyone who is interested in this should go and review https://github.com/bitcoin-core/packaging/pull/2

  40. NicolasDorier commented at 8:54 AM on July 16, 2018: contributor

    I really dislike adding on bitcoin-core/packaging... the whole point is having that run as part of the CI. By moving on separate repo, it makes sure it will never be part of CI because you can't build with the specific commit you pulled via COPY . .

    It is quite useless there I think. :(

  41. DrahtBot closed this on Aug 25, 2018

  42. DrahtBot commented at 8:55 PM on August 25, 2018: member

    <!--5d09a71f8925f3f132321140b44b946d-->The last travis run for this pull request was 59 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened.

  43. DrahtBot reopened this on Aug 25, 2018

  44. in contrib/docker/README.md:1 in d33e48e7d1
       0 | @@ -0,0 +1,119 @@
       1 | +Docker setup
    


    practicalswift commented at 2:20 PM on September 11, 2018:

    FWIW, various markdown nits suggested by mdl:

    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:1: MD002 First header should be a top level header
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:4: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:9: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:13: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:17: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:24: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:34: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:38: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:49: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:53: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:57: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:61: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:63: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:73: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:75: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:82: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:95: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:99: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:108: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:112: MD003 Header style
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:19: MD009 Trailing spaces
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:115: MD009 Trailing spaces
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:17: MD022 Headers should be surrounded by blank lines
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:75: MD022 Headers should be surrounded by blank lines
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:82: MD022 Headers should be surrounded by blank lines
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:112: MD022 Headers should be surrounded by blank lines
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:112: MD024 Multiple headers with the same content
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:18: MD031 Fenced code blocks should be surrounded by blank lines
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:76: MD031 Fenced code blocks should be surrounded by blank lines
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:83: MD031 Fenced code blocks should be surrounded by blank lines
    job=2018-09-11-16-17-08 pr=13542 mdl: contrib/docker/README.md:113: MD031 Fenced code blocks should be surrounded by blank lines
    
  45. in contrib/docker/docker-entrypoint.sh:5 in d33e48e7d1
       0 | @@ -0,0 +1,12 @@
       1 | +#!/bin/bash
       2 | +set -e
       3 | +
       4 | +if [[ "$1" = "bitcoind" ]]; then
       5 | +    exec gosu bitcoin bitcoind ${*:2}
    


    practicalswift commented at 2:21 PM on September 11, 2018:
    SC2086: Double quote to prevent globbing and word splitting.
    

    Applies also below :-)

  46. in contrib/docker/docker-compose.yml:1 in d33e48e7d1
       0 | @@ -0,0 +1,18 @@
       1 | +version: '3.6'
    


    practicalswift commented at 8:14 AM on September 23, 2018:
    2018-09-22 22:07:50 yamllint(pr=13542): contrib/docker/docker-compose.yml:1:1: [warning] missing document start "---" (document-start)
    
  47. fanquake commented at 5:24 AM on October 20, 2018: member

    As mentioned above, this is now being added to bitcoin-core/packaging/ in https://github.com/bitcoin-core/packaging/pull/2. Closing this PR for now.

  48. fanquake closed this on Oct 20, 2018

  49. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me