Docker容器搭建并運(yùn)行實(shí)現(xiàn)過程詳解
直接拉取鏡像,創(chuàng)建容器并運(yùn)行容器一把梭哈:
docker run -d --restart=always --privileged=true --net=host --name=fastdfs -e IP=192.168.149.128 -e WEB_PORT=80 -v ${HOME}/fastdfs:/var/local/fdfs registry.cn-beijing.aliyuncs.com/tianzuo/fastdfs
其中-v ${HOME}/fastdfs:/var/local/fdfs是指:
將${HOME}/fastdfs這個(gè)目錄掛載到容器里的/var/local/fdfs這個(gè)目錄里。
所以上傳的文件將被持久化到${HOME}/fastdfs/storage/data里,
IP 后面是自己的服務(wù)器公網(wǎng)ip或者虛擬機(jī)ip,-e WEB_PORT=80 指定nginx端口
訪問容器:
docker exec -it fastdfs /bin/bash
追加文本信息到index.html文件中
echo 'Hello FastDFS!'>>index.html
上傳此文件?
fdfs_test /etc/fdfs/client.conf upload index.html
打印了一段信息:
This is FastDFS client test program v5.12Copyright (C) 2008, Happy Fish / YuQingFastDFS may be copied only under the terms of the GNU GeneralPublic License V3, which may be found in the FastDFS source kit.Please visit the FastDFS Home Page http://www.csource.org/ for more detail.[2020-08-12 17: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_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0tracker_query_storage_store_list_without_group: server 1. group_name=, ip_addr=我的ip, port=23000group_name=group1, ip_addr=我的ip, port=23000storage_upload_by_filenamegroup_name=group1, remote_filename=M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13.htmlsource ip address: 172.17.0.7file timestamp=2020-08-12 17:35:41file size=30file crc32=421145555example file url: http://我的ip/group1/M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13.htmlstorage_upload_slave_by_filenamegroup_name=group1, remote_filename=M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13_big.htmlsource ip address: 172.17.0.7file timestamp=2020-08-12 17:35:41file size=30file crc32=421145555example file url: http://我的ip/group1/M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13_big.html
根據(jù)提示生成的地址就可以訪問到了
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 解決Python數(shù)據(jù)可視化中文部分顯示方塊問題2. Python基于traceback模塊獲取異常信息3. ASP編碼必備的8條原則4. python開發(fā)一個(gè)解析protobuf文件的簡(jiǎn)單編譯器5. 利用python+ffmpeg合并B站視頻及格式轉(zhuǎn)換的實(shí)例代碼6. python 繪制斜率圖進(jìn)行對(duì)比分析7. 解決Python 函數(shù)聲明先后順序出現(xiàn)的問題8. Android實(shí)現(xiàn)儀表盤控件開發(fā)9. python GUI模擬實(shí)現(xiàn)計(jì)算器10. Android自定義短信倒計(jì)時(shí)view流程分析
