master ab574e99ea01 cached
5 files
9.4 KB
2.6k tokens
1 requests
Download .txt
Repository: cptactionhank/docker-netatalk
Branch: master
Commit: ab574e99ea01
Files: 5
Total size: 9.4 KB

Directory structure:
gitextract_3113483c/

├── Dockerfile
├── LICENSE
├── README.md
├── afp.conf
└── docker-entrypoint.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: Dockerfile
================================================
FROM debian:jessie
ENV NETATALK_VERSION 3.1.11

ENV DEPS="build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev libmysqlclient-dev libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libtracker-sparql-1.0-dev libtracker-miner-1.0-dev file"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
 && apt-get install \
        --no-install-recommends \
        --fix-missing \
        --assume-yes \
        $DEPS \
        tracker \
        avahi-daemon \
        curl wget \
        &&  wget      "http://ufpr.dl.sourceforge.net/project/netatalk/netatalk/${NETATALK_VERSION}/netatalk-${NETATALK_VERSION}.tar.gz" \
        &&  curl -SL  "http://ufpr.dl.sourceforge.net/project/netatalk/netatalk/${NETATALK_VERSION}/netatalk-${NETATALK_VERSION}.tar.gz" | tar xvz

WORKDIR netatalk-${NETATALK_VERSION}

RUN ./configure \
        --prefix=/usr \
        --sysconfdir=/etc \
        --with-init-style=debian-systemd \
        --without-libevent \
        --without-tdb \
        --with-cracklib \
        --enable-krbV-uam \
        --with-pam-confdir=/etc/pam.d \
        --with-dbus-sysconf-dir=/etc/dbus-1/system.d \
        --with-tracker-pkgconfig-version=1.0 \
        &&  make \
         &&  make install \
          &&  apt-get --quiet --yes purge --auto-remove \
        $DEPS \
        tracker-gui \
        libgl1-mesa-dri \
        &&  DEBIAN_FRONTEND=noninteractive apt-get install --yes \
        libevent-2.0 \
        libavahi-client3 \
        libevent-core-2.0 \
        libwrap0 \
        libtdb1 \
        libmysqlclient18 \
        libcrack2 \
        libdbus-glib-1-2 \
        &&  apt-get --quiet --yes autoclean \
         &&  apt-get --quiet --yes autoremove \
          &&  apt-get --quiet --yes clean \
           &&  rm -rf /netatalk* \
            &&  rm -rf /usr/share/man \
             &&  rm -rf /usr/share/doc \
              &&  rm -rf /usr/share/icons \
               &&  rm -rf /usr/share/poppler \
                &&  rm -rf /usr/share/mime \
                 &&  rm -rf /usr/share/GeoIP \
                  &&  rm -rf /var/lib/apt/lists* \
                   &&  mkdir /media/share

COPY docker-entrypoint.sh /docker-entrypoint.sh
COPY afp.conf /etc/afp.conf
ENV DEBIAN_FRONTEND=newt

CMD ["/docker-entrypoint.sh"]


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2014 Martin Aksel Jensen, 2015 Ragnar Rova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
# Netatalk in a Docker container

An container serving [Apple Filing Protocol](https://en.wikipedia.org/wiki/Apple_Filing_Protocol) file sharing, Tracker (search/spotlight integration), and mDNS server for service discovery.

## 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:

```bash
docker run --detach --publish 548:548 cptactionhank/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 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.

```bash
docker run --detach --volume [host_path]:/media/share --volume [host_path]:/media/timemachine --publish 548:548 cptactionhank/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](http://netatalk.sourceforge.net/3.1/htmldocs/afp.conf.5.html).

#### Host mounted configuration

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

```bash
docker run --detach --volume [host_path]:/etc/afp.conf --volume [host_path]:/media/share --volume [host_path]:/media/timemachine --publish 548:548 cptactionhank/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

```bash
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) \
    cptactionhank/netatalk:latest
```

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

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

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

### Service discovery

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.

## Acknowledgments

Thanks to @rrva for his work updating this image to [Netatalk] version 3.1.8 and slimming down this image for everyone to enjoy.

## 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].

[Netatalk]: http://netatalk.sourceforge.net/
[Docker]: https://www.docker.com/
[GitHub]: https://www.github.com/
[Avahi]: http://www.avahi.org/


================================================
FILE: afp.conf
================================================
[Global]
; output log entries to stdout instead of syslog
; it is the docker way where the engine in turn
; can direct the log output to a storage backend
log file = /dev/stdout

; enable guest access as well as user accounts
uam list = uams_guest.so uams_dhx2.so uams_dhx.so

[Share]
path = /media/share
; when the environment variable `AFP_USER` is not
; provided valid users list will be empty and
; thus be available for both guests and
; authenticated users
valid users = %USER%

[Time Machine]
path = /media/timemachine
time machine = yes



================================================
FILE: docker-entrypoint.sh
================================================
#!/bin/bash

if [ ! -z "${AFP_USER}" ]; then
    if [ ! -z "${AFP_UID}" ]; then
        cmd="$cmd --uid ${AFP_UID}"
    fi
    if [ ! -z "${AFP_GID}" ]; then
        cmd="$cmd --gid ${AFP_GID}"
        groupadd --gid ${AFP_GID} ${AFP_USER}
    fi
    adduser $cmd --no-create-home --disabled-password --gecos '' "${AFP_USER}"
    if [ ! -z "${AFP_PASSWORD}" ]; then
        echo "${AFP_USER}:${AFP_PASSWORD}" | chpasswd
    fi
fi

if [ ! -d /media/share ]; then
  mkdir /media/share
  echo "use -v /my/dir/to/share:/media/share" > readme.txt
fi
chown "${AFP_USER}" /media/share

if [ ! -d /media/timemachine ]; then
  mkdir /media/timemachine
  echo "use -v /my/dir/to/timemachine:/media/timemachine" > readme.txt
fi
chown "${AFP_USER}" /media/timemachine

sed -i'' -e "s,%USER%,${AFP_USER:-},g" /etc/afp.conf

echo ---begin-afp.conf--
cat /etc/afp.conf
echo ---end---afp.conf--

mkdir -p /var/run/dbus
rm -f /var/run/dbus/pid
dbus-daemon --system
if [ "${AVAHI}" == "1" ]; then
    sed -i '/rlimit-nproc/d' /etc/avahi/avahi-daemon.conf
    avahi-daemon -D
else
    echo "Skipping avahi daemon, enable with env variable AVAHI=1"
fi;

exec netatalk -d
Download .txt
gitextract_3113483c/

├── Dockerfile
├── LICENSE
├── README.md
├── afp.conf
└── docker-entrypoint.sh
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (10K chars).
[
  {
    "path": "Dockerfile",
    "chars": 2385,
    "preview": "FROM debian:jessie\nENV NETATALK_VERSION 3.1.11\n\nENV DEPS=\"build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb"
  },
  {
    "path": "LICENSE",
    "chars": 1104,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2014 Martin Aksel Jensen, 2015 Ragnar Rova\n\nPermission is hereby granted, free of c"
  },
  {
    "path": "README.md",
    "chars": 4448,
    "preview": "# Netatalk in a Docker container\n\nAn container serving [Apple Filing Protocol](https://en.wikipedia.org/wiki/Apple_Filin"
  },
  {
    "path": "afp.conf",
    "chars": 546,
    "preview": "[Global]\n; output log entries to stdout instead of syslog\n; it is the docker way where the engine in turn\n; can direct t"
  },
  {
    "path": "docker-entrypoint.sh",
    "chars": 1151,
    "preview": "#!/bin/bash\n\nif [ ! -z \"${AFP_USER}\" ]; then\n    if [ ! -z \"${AFP_UID}\" ]; then\n        cmd=\"$cmd --uid ${AFP_UID}\"\n    "
  }
]

About this extraction

This page contains the full source code of the cptactionhank/docker-netatalk GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (9.4 KB), approximately 2.6k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!