Giter Club home page Giter Club logo

ibrdtn-container's Introduction

IBRDTN - Dockerfile ๐Ÿณ

Dockerfile to build a docker image for the Bundle protocol implementation IBRDTN. The image use debian:stretch-slim as base image. We leverage Github infrastructure to multi-arch builds.

Prerequisites

  • Install Docker: Follow the official tutorial. Docker version used in this project: v19.03.13, build 4484c46d9d.
  • Host machine settings:
    • A host computer running following operational system: Linux Ubuntu 18.04.5 LTS or greater.

      or

    • If deploying services in a Raspberry Pi, use the following operational system: Raspberry Pi OS (32-bit) Lite, version August 2020 release date 2020-08-20, kernel version 5.4;

Usage

The docker image built in this repository is disponible at Docker Hub. The image can be used in following architectures: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64.

To create a docker container run the following command in terminal (assuming that you are using a GNU/Linux host):

docker run -d -it --name CONTAINER_NAME
-v /etc/timezone:/etc/timezone:ro 
-v /etc/localtime:/etc/localtime:ro 
--network=host
dzvid/ibrdtn:latest

Volumes

Depending on IBRDTN configuration, you may want to load your custom ibrdtn.config, persistent storage of bundles and/or Register IBRDTN daemon logs. Three directories have been created in the image to be used for configuration, persistent storage and logs:

   /ibrdtn/config
   /ibrdtn/bundles
   /ibrdtn/logs
  • Using volume for IBRDTN configuration file (ibrdtn.conf):

    1. Create your custom IBRDTN configuration file on a suitable volume on your host system, e.g. /host-path/your-custom-ibrdtn.conf
    2. Start your ibrdtn container like this:
    docker run -d -it --name CONTAINER_NAME
    -v /host-path/your-custom-ibrdtn.conf:/ibrdtn/config/ibrdtn.conf
    -v /etc/timezone:/etc/timezone:ro 
    -v /etc/localtime:/etc/localtime:ro 
    --network=host
    dzvid/ibrdtn:latest
  • Using volume for IBRDTN permanent storage of bundles:

    1. Create your custom IBRDTN bundles directory on a suitable volume on your host system, e.g. /host-path/bundles
    2. Start your ibrdtn container like this:
    docker run -d -it --name CONTAINER_NAME
    -v /host-path/bundles:/ibrdtn/bundles
    -v /etc/timezone:/etc/timezone:ro 
    -v /etc/localtime:/etc/localtime:ro 
    --network=host
    dzvid/ibrdtn:latest
  • Using volume for IBRDTN logs:

    1. Create your custom IBRDTN logs directory on a suitable volume on your host system, e.g. /host-path/log
    2. Start your ibrdtn container like this:
    docker run -d -it --name CONTAINER_NAME
    -v /host-path/log:/ibrdtn/log
    -v /etc/timezone:/etc/timezone:ro 
    -v /etc/localtime:/etc/localtime:ro 
    --network=host
    dzvid/ibrdtn:latest

    You can use all volumes at once:

    docker run -d -it --name CONTAINER_NAME -v /host-path/ibrdtn.conf:/ibrdtn/config/ibrdtn.conf -v /host-path/ibrdtn/bundles:/ibrdtn/bundles -v /host-path/log:/ibrdtn/log -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro --restart always --network=host dzvid/ibrdtn:latest

IBRDTN debug mode

To create a container with IBRDTN debugging enabled, it is necessary to overwrite the image entrypoint, using docker --entrypoint flag for this, replacing DEBUG_VALUE with desired IBDTN debug level:

--entrypoint='/bin/bash' dzvid/ibrdtn:latest  -c 'dtnd -c /ibrdtn/config/ibrdtn.conf -d DEBUG_VALUE'

So create a container like this:

docker run -d -it --name CONTAINER_NAME
-v /etc/timezone:/etc/timezone:ro 
-v /etc/localtime:/etc/localtime:ro 
--network=host
--entrypoint='/bin/bash' dzvid/ibrdtn:latest  -c 'dtnd -c /ibrdtn/config/ibrdtn.conf -d DEBUG_VALUE'

To create using all volumes with debugging enabled:

docker run -d -it --name CONTAINER_NAME -v /host-path/ibrdtn.conf:/ibrdtn/config/ibrdtn.conf -v /host-path/ibrdtn/bundles:/ibrdtn/bundles -v /host-path/log:/ibrdtn/log -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro --restart always --network=host --entrypoint='/bin/bash' dzvid/ibrdtn:latest  -c 'dtnd -c /ibrdtn/config/ibrdtn.conf -d DEBUG_VALUE'

Build image

Local build

  1. Clone this repository to your machine:

    git clone [email protected]:dzvid/ibrdtn-container.git
  2. Build the image:

    docker build . -t insert_tag_name

Multi-arch build using GitHub Action: docker/build-push-action

docker/build-push-action is a GitHub Action to build and push Docker images with Buildx to Docker hub. This repository has continuous integration (CI) using GitHub Actions enabled, the workflow is described in the configuration file .github/workflows/build-image.yml. The workflow is triggered once a push is made to master branch or manually acessing Actions in menu, selecting the workflow and re-running jobs. For Github Actions be able to push the imagens to Docker hub, it is necessary to configure Docker hub access credentials in the repository secrets:

  1. Go to your Docker Hub security settings to create a new access token: docker-hub-token
  2. After creating the access token, go to your repository settings, and in the Secrets section create the following environment variables:
    • DOCKERHUB_TOKEN: The token generated in Docker Hub in step 1;
    • DOCKERHUB_USERNAME: Your Docker Hub username.
  3. Select the architectures you want to target in the file .github/workflows/build-image.yml. The following architectures are targeted by default: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64.
  4. Push changes to your repository and wait for CI to build and push image to Docker Hub.

Local Multi-arch build

For local multi-arch build, please refer to this link: Getting started with Docker for Arm on Linux. It has all the instructions necessary to build Docker images for architectures different from the host machine.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the dev branch (git push origin feature/AmazingFeature)
  5. Open a pull request

License

The repository code/resources are licensed under Apache 2.0 license.

Acknowledgements

ibrdtn-container's People

Contributors

dzvid avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

fiveghz

ibrdtn-container's Issues

Verify how to bind to correct network interface and configure port fowarding

  • It is necessary for the container to bind to a specific network interface so IBRDTN can be able to execute neighbor discovery, etc;
  • It is necessary to map the host and container ports so data can be exchanged, necessary to verify the ports used by IBRDTN that need to be mapped to host, at the moment the only port exposed is 4550 thats used by the API, but cant establish connection.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.