Docker容器搭建并運行實現(xiàn)過程詳解
直接拉取鏡像,創(chuàng)建容器并運行容器一把梭哈:
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這個目錄掛載到容器里的/var/local/fdfs這個目錄里。
所以上傳的文件將被持久化到${HOME}/fastdfs/storage/data里,
IP 后面是自己的服務(wù)器公網(wǎng)ip或者虛擬機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.12 Copyright (C) 2008, Happy Fish / YuQing FastDFS may be copied only under the terms of the GNU General Public 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: 0 tracker_query_storage_store_list_without_group: server 1. 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 source ip address: 172.17.0.7 file timestamp=2020-08-12 17:35:41 file size=30 file crc32=421145555 example file url: http://我的ip/group1/M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13.html storage_upload_slave_by_filename group_name=group1, remote_filename=M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13_big.html source ip address: 172.17.0.7 file timestamp=2020-08-12 17:35:41 file size=30 file crc32=421145555 example file url: http://我的ip/group1/M00/00/00/rBEAB180KG2Ab6N2AAAAHhkaK9M13_big.html

根據(jù)提示生成的地址就可以訪問到了
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
centos修改docker網(wǎng)絡(luò)配置方法分享
本文給大家分享的是centos修改docker網(wǎng)絡(luò)配置的方法,非常的實用,有需要的小伙伴可以參考下2017-03-03
Windows/Mac系統(tǒng)Docker方式安裝Mysql(包含utf8)
本文主要介紹了Windows/Mac系統(tǒng)Docker方式安裝Mysql(包含utf8),文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-11-11
Centos7安裝docker compse踩過的坑及解決方法
本文,我們介紹如何在centos7環(huán)境下安裝docker-compose, 記錄下安裝過程步驟以及遇到的問題還有解決辦法,感興趣的朋友參考下吧2018-01-01
docker容器中布置靜態(tài)網(wǎng)站的實現(xiàn)
這篇文章主要介紹了docker容器中布置靜態(tài)網(wǎng)站的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2021-01-01
SpringCloud基于Docker和Docker-Compose的項目部署過程
本文介紹了如何卸載舊版本Docker、更新系統(tǒng)、安裝Docker及其依賴,并設(shè)置國內(nèi)鏡像源以加快下載速度,詳細說明了如何安裝Docker Compose、配置鏡像加速器,并展示了如何使用Docker Compose部署SpringCloud項目,提供了更新和重啟容器的方法2024-10-10

