Giter Club home page Giter Club logo

docker-timemachine's Introduction

docker-timemachine

A docker container to compile the lastest version of Netatalk in order to run a Time Machine server.

Running on ARM / RPi

If you want to use this on an ARM-Device (like the Raspberry Pi), you have two options:

  • Get the precompiled image (latest compilation on 11-07-2017):
    $ docker run -h timemachine --name timemachine --restart=unless-stopped -d -v /external_volume:/timemachine -it -p 548:548 -p 636:636 odarriba/timemachine-rpi
    
  • Build the image directly on your device:
    $ docker build -t timemachine-rpi:latest -f Dockerfile.rpi .
    $ docker run -h timemachine --name timemachine --restart=unless-stopped -d -v /external_volume:/timemachine -it -p 548:548 -p 636:636 timemachine-rpi
    

Installation

Step 1 - Start the Server

To download the docker container and execute it, simply run:

$ docker run -h timemachine --name timemachine --restart=unless-stopped -d -v /external_volume:/timemachine -it -p 548:548 -p 636:636 odarriba/timemachine

Replace external_volume with a local path where you want to store your data.

As the image has been started using the --restart=always flag, it will start when the computers boots up.

Step 2 - Add a User

To add a user, run:

$ docker exec timemachine add-account USERNAME PASSWORD VOL_NAME VOL_ROOT [VOL_SIZE_MB]

But take care that:

  • VOL_NAME will be the name of the volume shown on your OSX as the network drive
  • VOL_ROOT should be an absolute path, preferably a sub-path of /timemachine (e.g., /timemachine/backup), so it will be stored in the according sub-path of your external volume.
  • VOL_SIZE_MB is an optional parameter. It indicates the max volume size for that user.

Now you have a docker instance running netatalk.

Step 3 - Enable Auto Discovery

Avahi daemon is commonly used to help your computers to find the services provided by a server.

Avahi isn't built into this Docker image because, due to Docker's networking limitations, Avahi can't spread it's messages to announce the services.

If you want to enable this feature, you can install Avahi daemon on your host following these steps (Ubuntu version):

  • Install avahi-daemon: run sudo apt-get install avahi-daemon avahi-utils
  • Copy the file from avahi/nsswitch.conf to /etc/nsswitch.conf
  • Copy the service description file from avahi/afpd.service to /etc/avahi/services/afpd.service
  • Restart Avahi's daemon: sudo /etc/init.d/avahi-daemon restart

Step 4 - Configure Your Firewall

Make sure

  • your server can receive traffic on port 548 and 636 (e.g., ufw allow 548, (636 respectively)).

  • your Mac allows outgoing connections (Little Snitch?)

Step 5 - Start Using It

To start using it, follow these steps:

  • If you use Avahi, open Finder, go to Shared and connect to your server with your new username and password.

  • Alternatively (or if you don't use Avahi) from Finder press CMD-K and type afp://your-server where your-server can be your server's name or IP address (e.g., afp://my-server or afp://192.168.0.5).

  • Go to System Preferences, and open Time Machine settings.

  • Open Add or Remove Backup Disk...

  • Select your new volume.

In the example below, the Docker instance is running on server central. For USERNAME the account Backup along with a PASSWORD was created. Once connected, the account Backup is available in Time Machine settings: alt text

Advanced Usage

Configure using environment variables

You can configure the container using environment variables (for example, if you use a docker-compose environment).

There are these environment variables:

  • AFP_LOGIN: User name
  • AFP_PASSWORD: User password
  • AFP_NAME: Name of the volume
  • AFP_SIZE_LIMIT: Size in MB of the volume (optional)

Using these variables, the container will create a user at boot time (only one per container) and the data will be stored directly in the volume /timemachine, without subfolders.

FAQ

I got Docker running, my firewall is configured, but I still don't find the service in Time Machine.

Make sure you actually mount the server volume (see Step 5) before trying to find it in Time Machine settingss.

I am still having trouble ...

  • The idea of using avahi-daemon installed in the bare metal server is to avoid having to execute the container with --net=host, which a potentially insecure flag. But, as the last option to check things out, it should be fine. You just should know what you are enabling.

  • A Time Machine network disk is just a disk image in an AFP volume that supports the correct level of encryption. So to be recognised by the TimeMachine daemon, you should mount the unit manually for the first time, configure TimeMachine on your computer, and then the OS will do that for you automatically.

Why do I need to install Avahi on your host and not in the container?

Because if you don't do it this way, the discovery message won't be able to reach your computers.

Contributors

docker-timemachine's People

Contributors

odarriba avatar josef-friedrich avatar ralfbiedert avatar randominsano avatar gregturn avatar farmdawgnation avatar saesh avatar skn0tt avatar

Watchers

woshizilong avatar

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.