环境要求
1,配置nfs存储卷
1,在dockerswarm集群中所有节点都确认安装nfs客户端软件
#yuminstallnfs-utilsrpcbind-y
2,在...1上搭建nfs,共享目录给dockerswarm集群中所有节点挂载
[root
nfs~]#mkdir/opt/dockervolume[rootnfs~]#vim/etc/exports/opt/dockervolume*(rw,no_root_squash,sync)[rootnfs~]#systemctlrestartrpcbindnfs-server[rootnfs~]#systemctlenblerpcbindnfs-server3,在dockerswarm集群中所有节点创建存储卷,并验证
#dockervolumeinspectnginx_volume[{CreatedAt:-06-12T13:24:09+08:00,Driver:local,Labels:{},Mountpoint:/var/lib/docker/volumes/nginx_volume/_data,Name:nginx_volume,Options:{device::/opt/dockervolume,o:addr=...1,rw,注意这里的挂载参数要有type:nfs},Scope:local}#dockervolumels
grepnginx_volumelocalnginx_volume#dockervolumecreate--driverlocal--opttype=nfs--opto=addr=...1,rw--optdevice=:/opt/dockervolumenginx_volume
2,下载镜像
在任意能上外网的机器上操作
[root
nfs~]#dockerpullricharvey/nginx-php-fpm3,准备是相关配置文件
[root
nfs~]#mkdir/root/discuz/dockerfile-p[rootnfs~]#cd/root/discuz/dockerfile准备nginx主配置文件
[root
nfsdockerfile]#vimnginx.confusernginx;worker_processesauto;error_log/var/log/nginx/error.logwarn;pid/var/run/nginx.pid;events{useepoll;worker_connections;}