| FROM centos:7 |
| |
| RUN echo -e "[salt]\nname=salt\nbaseurl=https://archive.repo.saltproject.io/yum/redhat/7/x86_64/3000/\nenabled=1\ngpgcheck=0\n" >/etc/yum.repos.d/salt.repo &&\ |
| curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo &&\ |
| ls /etc/yum.repos.d/*.repo|xargs -I {} sed -i s/mirrorlist.centos.org/mirrors.aliyun.com/g {} &&\ |
| 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 |
| |
启动
| docker run -d --name salt --hostname=salt -p8000:8000 -p4505:4505 -p4506:4506 -v /data:/data 1209233066/salt:master-api tail -f /dev/null |
| token=`curl -sk http://127.0.0.1:8000/login -H 'Accept: application/x-yaml' -d username='pcloud' -d password='Cmb@2018' -d eauth='pam'|awk '/token/{print $2}'` |
| curl -sk http://127.0.0.1:8000 -H "Accept: application/json" -H "X-Auth-Token: $token" -d client="local" -d tgt="salt" -d fun="test.ping" |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2022-10-19 静态pod