Docker容器搭建并运行实现过程详解
直接拉取镜像,创建容器并运行容器一把梭哈:
dockerrun-d--restart=always\ --privileged=true\ --net=host\ --name=fastdfs\ -eIP=192.168.149.128\ -eWEB_PORT=80\ -v${HOME}/fastdfs:/var/local/fdfsregistry.cn-beijing.aliyuncs.com/tianzuo/fastdfs
其中-v${HOME}/fastdfs:/var/local/fdfs是指:
将${HOME}/fastdfs这个目录挂载到容器里的/var/local/fdfs这个目录里。
所以上传的文件将被持久化到${HOME}/fastdfs/storage/data里,
IP后面是自己的服务器公网ip或者虚拟机ip,-eWEB_PORT=80指定nginx端口
访问容器:
dockerexec-itfastdfs/bin/bash
追加文本信息到index.html文件中
echo"HelloFastDFS!">>index.html
上传此文件?
fdfs_test/etc/fdfs/client.confuploadindex.html
打印了一段信息:
ThisisFastDFSclienttestprogramv5.12 Copyright(C)2008,HappyFish/YuQing FastDFSmaybecopiedonlyunderthetermsoftheGNUGeneral PublicLicenseV3,whichmaybefoundintheFastDFSsourcekit. PleasevisittheFastDFSHomePagehttp://www.csource.org/ formoredetail. [2020-08-1217:35:41]DEBUG-base_path=/var/local/fdfs/storage,connect_timeout=30,network_timeout=60,tracker_server_count=1,anti_steal_token=0,anti_steal_secret_keylength=0,use_connection_pool=0,g_connection_pool_max_idle_time=3600s,use_storage_id=0,storageserveridcount:0 tracker_query_storage_store_list_without_group: server1.group_name=,ip_addr=我的ip,port=23000 group_name=group1,ip_addr=我的ip,port=23000 storage_upload_by_filename group_name=group1,remote_filename=M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13.html sourceipaddress:172.17.0.7 filetimestamp=2020-08-1217:35:41 filesize=30 filecrc32=421145555 examplefileurl:http://我的ip/group1/M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13.html storage_upload_slave_by_filename group_name=group1,remote_filename=M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13_big.html sourceipaddress:172.17.0.7 filetimestamp=2020-08-1217:35:41 filesize=30 filecrc32=421145555 examplefileurl:http://我的ip/group1/M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13_big.html
根据提示生成的地址就可以访问到了
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。