I have build my own image and push it to my registry in the swarm, to create an service on base of the image.
#dockerfile
FROM ubuntu:latest
RUN apt update -qq && apt install -qqy samba
RUN useradd -ms /bin/bash -p "$1$Ka9zKZwA$G70Ozk7eUjIzUZcuTAu44." docker
RUN (echo "sysadmin"; sleep 5; echo "passwd" ) | smbpasswd -s -a docker
RUN mkdir /mnt/share
RUN echo [docker] >> /etc/samba/smb.conf
RUN echo comment = share for docker >> /etc/samba/smb.conf
RUN echo path = /mnt/tidepod/ >> /etc/samba/smb.conf
RUN echo browseable = yes >> /etc/samba/smb.conf
RUN echo valid user = docker >> /etc/samba/smb.conf
RUN echo writeable = yes >> /etc/samba/smb.conf
RUN echo create mask = 0777 >> /etc/samba/smb.conf
RUN echo directory mask = 0777 >> /etc/samba/smb.conf
EXPOSE 139/tcp
EXPOSE 445/tcp
CMD service smbd start && tail -f /dev/null
If I try to run the image as singel container it works and the share is accesable.
But when I try to create the service with an stackfile the service starts and shutdown imidently.
#stackfile
version: "3.6"
services:
swarm-share:
image: registry.de:5000/swarm-share
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
volumes:
- /mnt/share:/mnt/share
ports:
- "139:139"
- "445:445"
How can I create the service?