1
Latest Samba + latest Avahi in Docker for better sharing experience
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2020-04-18 19:37:57 +04:00
examples Add examples, update README and LICENSE 2020-04-18 19:37:57 +04:00
.dockerignore Add examples, update README and LICENSE 2020-04-18 19:37:57 +04:00
.drone.yml Initial commit 2020-04-18 17:06:41 +04:00
.gitignore Initial commit 2020-04-18 17:06:41 +04:00
Dockerfile Change volumes 2020-04-18 18:09:29 +04:00
entrypoint.sh Update entrypoint 2020-04-18 18:27:09 +04:00
LICENSE Add examples, update README and LICENSE 2020-04-18 19:37:57 +04:00
README.md Add examples, update README and LICENSE 2020-04-18 19:37:57 +04:00

Samba + Avahi in Docker container

This repository contains sources for fat0troll/samba-with-avahi - Docker container for as simple as possible sharing experience. After tiny tinkering you will get running Samba, ready to be advertized to local network via Avahi (and to host Time Machine backups for example).

Note 1: This container requires host or macvlan network type, and will not work in bridge (default mode) network. See examples/docker-compose.yml for details. If you can/want to make it work in bridge mode, PRs are welcome (see Note 3).

Note 2: This container is tested under Linux and built for linux/amd64 only. That's because this is the only architecture used in my servers at the time. If you want to, you can send PR with changes for building image for other architectures.

Note 3: The repo on Github is a mirror, and main development is done at source.hodakov.me. You may send PR where you want: I will accept on both, but will merge it manually, if it's from Github.

Preparations

There is no custom scripts or similar, this container consumes standart configuration files from Samba and Avahi. Example configuration file for Samba is included in examples/samba directory. Due to licensing issues Avahi example configuration files isn't included in this repository, so you need to grab it manually. You can do this by passing these commands:

$ docker create --name avahi-config fat0troll/samba-with-avahi
$ docker cp avahi-config:/etc/avahi .
$ docker rm avahi-config

In the generated config files for Avahi you may add/remove your services (under services folder), and you should disable DBus otherwise it will not start at all. Add this to avahi-daemon.conf first section:

enable-dbus=no

Environment variables

There is one set of environment variables this container consumes: USER* (where * is replaced with a number, but technically it may be everything). The format of variables is username,group,UID: you can create inside a container user with your host UID and it will write files to your share locations seamlessly with host. Example of env file with some defined users is located in examples directory.

Starting from command-line example

$ docker run -it --name samba --net=host \
	-v /path/to/avahi/configs:/etc/avahi \
	-v /path/to/samba/configs:/etc/samba \
	-v /path/to/samba/lib:/var/lib/samba \
	-v /path/to/shares:/data \
	fat0troll:avahi-with-docker

Starting from docker stack example

See examples/docker-compose.yaml. This file may be deployed by command:

$ docker stack deploy -c examples/docker-compose.yaml samba