Skip to content

Latest commit

 

History

History
88 lines (59 loc) · 3.49 KB

README.md

File metadata and controls

88 lines (59 loc) · 3.49 KB

Netatalk in a Docker container

An container serving Apple Filing Protocol file sharing.

I'm in the fast lane! Get me started

To quickly get started with running an Netatalk container first you can run the following command:

docker run --detach --publish 548:548 wmuizelaar/netatalk:latest

Important: This does not announce the AFP service on the network; connecting to the server should be performed by Finder's Go -> Connect Server (CMD+K) and then typing afp://[docker_host].

Default configuration of Netatalk has a share and called TimeMachine which shares the containers /media/timemachine mounting point. Host mounting a volume to this path will be the quickest way to start sharing files on your network.

docker run --detach --volume [host_path]:/media/share --volume [host_path]:/media/timemachine --publish 548:548 wmuizelaar/netatalk:latest

The slower road

With the slower roads documentation some knowledge in administering Docker and Netatalk assumed.

Configuring shares

There are two ways of configuring the Netatalk which is either by mounting a configuration file or editing the file from the container itself. Documentation of the configuration file /etc/afp.conf can be found here.

Host mounted configuration

This is quite a simple way to change the configuration by supplying an additional docker flag when creating the container.

docker run --detach --volume [host_path]:/etc/afp.conf --volume [host_path]:/media/share --volume [host_path]:/media/timemachine --publish 548:548 wmuizelaar/netatalk:latest

Container edited configuration

Other ways of enabling customizations of the Netatalk configuration file is by mounting the /etc by --volume /etc such that this directory will remain persistent between restarts and then modify the configuration file. However the first option would be the recommended way to do this.

Setting up access credentials

To setup access credentials you should supply the following environment variables from the table below.

Variable Description
AFP_USER create a user in the container and allow it access to /media/share
AFP_PASSWORD password
AFP_UID uid of the created user
AFP_GID gid of the created user

Example

docker run --detach \
    --volume /mnt/sda1/share:/media/share \
    --net "host" \
    --env AFP_USER=$(id -un) \
    --env AFP_PASSWORD=secret \
    --env AFP_UID=$(id -u) \
    --env AFP_GID=$(id -g) \
    wmuizelaar/netatalk:latest

This replaces all occurrences of %USER% in afp.conf with AFP_USER

[Global]
log file = /var/log/netatalk.log

[Share]
path = /media/share
valid users = %USER%

Contributions

This image has been created with the best intentions and an expert understanding of docker, but it should not be expected to be flawless. Should you be in the position to do so, I request that you help support this repository with best-practices and other additions.

If you see out of date documentation, lack of tests, etc., you can help out by either

  • creating an issue and opening a discussion, or
  • sending a pull request with modifications

This work is made possible with the great services from Docker and GitHub.