Skip to content

Running within Docker

Ludovic Fauvet edited this page Nov 7, 2018 · 2 revisions

Prebuilt binary image

Mirrorbits does not yet have an official image in docker hub. The next release will be supported.

Dockerfile

The repository contains a Dockerfile to dockerize the mirrorbits server and the CLI. Everything is self contained and it is a great way for testing and development since you do not need to setup a complete environment by hand.

The only external components required on the host machine are a Redis container and the path to a repository that will be mounted inside the mirrorbits container.

First step, we need a Docker network:

$ docker network create mirrorbits

Then a redis server:

$ docker run --name redis --net mirrorbits -d redis

Then we need to build the mirrorbits docker image. From within the mirrorbits source directory:

$ docker build -t mirrorbits .

Now we need to start the container in the same network:

Just replace /path/to/repo in the following line:

$ docker run --name mirrorbits --net mirrorbits -p 8080:8080 -v /path/to/repo:/srv/repo -i -t mirrorbits

Same thing but you can also provide your own configuration file:

$ docker run --name mirrorbits --net mirrorbits -p 8080:8080 -v /path/to/repo:/srv/repo -v /path/to/mirrorbits.conf:/etc/mirrorbits.conf -i -t mirrorbits

Mirrorbits should start indexing your repository and should be listening on port localhost:8080.

To validate that the container is running correctly, you can open your web browser to http://localhost:8080/?mirrorstats, this should display an empty world map.

Finally you can use the CLI to add your first mirror:

$ docker exec -i -t mirrorbits /bin/bash
$ mirrorbits version
Version: v0.4-78-g7e02f1b-dirty
Build: 7e02f1b-master
GoVersion: go1.11.2
Operating System: linux
Architecture: amd64
Gomaxprocs: 8
$ mirrorbits add

Usage: mirrorbits add [OPTIONS] IDENTIFIER

Add a new mirror
[...]
Clone this wiki locally