FROM centos:7
RUN curl -fsSL https://repo.saltproject.io/py3/redhat/7/x86_64/3004.repo | tee /etc/yum.repos.d/salt.repo && \
sed -i "s/repo.saltproject.com/mirrors.aliyun.com\/saltstack/g" /etc/yum.repos.d/salt.repo &&\
yum install salt-master salt-minion salt-api -y &&\
echo "auto_accept: True" >>/etc/salt/master &&\
useradd -M -s /sbin/nologin pcloud &&\
echo "pcloud:Cmb@2018" | chpasswd
COPY api.conf /etc/salt/master.d/api.conf
COPY auth.conf /etc/salt/master.d/auth.conf
COPY eauth.conf /etc/salt/master.d/eauth.conf
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
tee entrypoint.sh <<EOF
#!/bin/bash
start(){
salt-master -d
salt-minion -d
salt-api -d
}
start
exec "\$@"
EOF
tee api.conf <<EOF
rest_cherrypy:
host: 0.0.0.0
port: 8000
debug: False
disable_ssl: True
log.error_file: /var/log/salt/saltapi-err.log
EOF
tee auth.conf <<EOF
external_auth:
pam:
pcloud:
- .*
- '@wheel'
- '@runner'
- '@jobs'
EOF
tee eauth.conf <<EOF
external_auth:
pam:
pcloud:
- .*
- '@wheel'
- '@runner'
EOF
chmod +x entrypoint.sh
docker build . -t 1209233066/salt:master-api
curl -sk http://175.178.65.213:8000/login -H 'Accept: application/x-yaml' -d username='pcloud' -d password='Cmb@2018' -d eauth='pam'
curl -sk http://175.178.65.213:8000 -H 'Accept: application/json' -H 'X-Auth-Token: 0e8de03fc40ba55d913ed4aeb81b75b5bb1a4653' -d client='local' -d tgt='salt' -d fun='test.ping'
docker run -d --name salt --hostname=salt -p8000:8000 -p4505:4505 -p4506:4506 -v /data:/data 1209233066/salt:master-api tail -f /dev/null
标签:repo,etc,api,master,conf,salt From: https://www.cnblogs.com/wangend/p/17775339.html