├── Dockerfile ├── docker-compose.yml └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | RUN apk add --update \ 4 | samba-common-tools \ 5 | samba-client \ 6 | samba-server \ 7 | && rm -rf /var/cache/apk/* 8 | 9 | VOLUME ["/etc", "/var/cache/samba", "/var/lib/samba", "/var/log/samba",\ 10 | "/run/samba"] 11 | 12 | ENTRYPOINT ["smbd", "--foreground", "--debug-stdout", "--no-process-group"] 13 | CMD [] 14 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | services: 4 | samba: 5 | build: . 6 | container_name: samba 7 | environment: 8 | TZ: 'CST6CDT' 9 | networks: 10 | - default 11 | ports: 12 | - "137:137/udp" 13 | - "138:138/udp" 14 | - "139:139/tcp" 15 | - "445:445/tcp" 16 | read_only: true 17 | tmpfs: 18 | - /tmp 19 | restart: unless-stopped 20 | stdin_open: true 21 | tty: true 22 | volumes: 23 | - /etc/samba:/etc/samba:ro 24 | - /var/lib/samba:/var/lib/samba 25 | - /etc/passwd:/etc/passwd:ro 26 | - /etc/shadow:/etc/shadow:ro 27 | # - /share1:/share1 28 | # - /share2:/share2:ro 29 | 30 | networks: 31 | default: 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Convert an existing Samba server to Docker 2 | 3 | This Docker Compose configuration can be used to convert an existing 4 | Samba server over to Docker with little effort. Just edit the 5 | `docker-compose.yml` file to add your shares, set the timezone 6 | `TZ` variable if desired, then bring the server up: 7 | 8 | docker-compose up -d --build 9 | 10 | This assumes you have a working Samba installation, with configuration 11 | in `/etc/samba` and library files in `/var/lib/samba`. If the paths 12 | on the host machine are different, just edit them in the Compose file. 13 | 14 | Based on/inspired by [dperson/samba](https://github.com/dperson/samba), 15 | but modified to work with/convert existing (bare metal) installations 16 | of Samba. 17 | 18 | ## Blog post 19 | 20 | Please see my [blog post](https://alexlubbock.com/convert-samba-docker) 21 | for the background behind this implementation, the pros and cons 22 | compared to the [dperson/samba](https://github.com/dperson/samba) 23 | version, and further notes on configuration. 24 | --------------------------------------------------------------------------------