An container serving Apple Filing Protocol file sharing, Tracker (search/spotlight integration), and mDNS server for service discovery.
To quickly get started with running an [AFP] container first you can run the following command:
docker run --detach --publish 548:548 joaogsleite/afp:latest
Or, check the example docker-compose.yml
file included in this repository.
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 two share called Share which shares the containers /media/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 joaogsleite/afp:latest
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.
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 joaogsleite/afp:latest
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.
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 |
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) \
joaogsleite/afp: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%
This image includes an avahi daemon which is off by default. Enable by setting the environment variable AVAHI=1
with docker run -e AVAHI=1 ...
Service discovery works only when the Avahi daemon is on the same network as your users which is why you need to supply --net=host
flag to Docker when creating the container, but do consider that --net=host
is considered a security threat. Alternatively you can install and setup an mDNS server on the host and have this describing the AFP service for your container.
This project is based on the cptactionhank/docker-netatalk repository. That repository is not updated since 2016 and there are many pull requests pending approval. The docker entrypoint.sh
file is almost identical (with some additions from pending pull requests) but I've migrated the Dockerfile from debian to alpine.