Docker下打包FastDFS鏡像

官方地址:https://github.com/happyfish100/fastdfs

一、先下載個包,然後解壓(自己找個目錄下載即可)

[root@localhost soft]# wget https://github.com/happyfish100/fastdfs/archive/master.zip
--2019-09-16 05:26:36--  https://github.com/happyfish100/fastdfs/archive/master.zip
Resolving github.com (github.com)... 13.250.177.223
Connecting to github.com (github.com)|13.250.177.223|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/happyfish100/fastdfs/zip/master [following]
--2019-09-16 05:26:37--  https://codeload.github.com/happyfish100/fastdfs/zip/master
Resolving codeload.github.com (codeload.github.com)... 13.229.189.0
Connecting to codeload.github.com (codeload.github.com)|13.229.189.0|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘master.zip’

    [    <=>                                                                                                                                                                                            ] 482,045      645KB/s   in 0.7s   

2019-09-16 05:26:38 (645 KB/s) - ‘master.zip’ saved [482045]

[root@localhost soft]# unzip master.zip 
Archive:  master.zip
14edb44071b27599a5fc8c818b643eed6fe15e11
   creating: fastdfs-master/
....

二、進入fastdfs-master/docker/dockerfile_network目錄,執行打包命令

[root@localhost soft]# cd fastdfs-master/docker/dockerfile_network
[root@localhost dockerfile_network]# 

打包(注意,你的宿主機內存至少要2G,不然會報錯如下:)我之前只分配給宿主機1G內存,明顯不夠用。

好,執行命令打包:(注意最後有個點)

[root@localhost dockerfile_network]# docker build -t local/fastdfs:latest .
Sending build context to Docker daemon   68.1kB
Step 1/13 : FROM centos
 ---> 67fa590cfc1c
Step 2/13 : ADD conf/client.conf /etc/fdfs/
 ---> Using cache
 ---> f6d4d01d7cf4
Step 3/13 : ADD conf/http.conf /etc/fdfs/
 ---> Using cache
 ---> 09b5d6e42010
Step 4/13 : ADD conf/mime.types /etc/fdfs/
 ---> Using cache
 ---> 01ba930f4e2a
Step 5/13 : ADD conf/storage.conf /etc/fdfs/
 ---> Using cache
 ---> 628d5f17543d
Step 6/13 : ADD conf/tracker.conf /etc/fdfs/
 ---> Using cache
 ---> b62b681c8ee8
Step 7/13 : ADD fastdfs.sh /home
 ---> Using cache
 ---> 6f0ffb43c5fc
Step 8/13 : ADD conf/nginx.conf /etc/fdfs/
 ---> Using cache
 ---> 6e2dded720b5
Step 9/13 : ADD conf/mod_fastdfs.conf /etc/fdfs
 ---> Using cache
 ---> 6feff4c6bb23
Step 10/13 : RUN yum install git gcc gcc-c ++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y   &&    cd /usr/local/src    &&    git clone https://github.com/happyfish100/libfastcommon.git --depth 1          &&    git clone https://github.com/happyfish100/fastdfs.git --depth 1      &&    git clone https://github.com/happyfish100/fastdfs-nginx-module.git --depth 1     &&    wget http://nginx.org/download/nginx-1.15.4.tar.gz      &&    tar -zxvf nginx-1.15.4.tar.gz      &&    mkdir /home/dfs     &&    cd /usr/local/src/    &&    cd libfastcommon/     &&    ./make.sh && ./make.sh install    &&    cd ../    &&    cd fastdfs/     &&    ./make.sh && ./make.sh install    &&    cd ../    &&    cd nginx-1.15.4/    &&    ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/     &&    make && make install    &&    chmod +x /home/fastdfs.sh
 ---> Using cache
 ---> 59424d66e1a1
Step 11/13 : VOLUME /etc/fdfs
 ---> Using cache
 ---> d72d68fd5ebf
Step 12/13 : EXPOSE 22122 23000 8888 80
 ---> Using cache
 ---> f0c2d84a954e
Step 13/13 : ENTRYPOINT ["/home/fastdfs.sh"]
 ---> Using cache
 ---> fc76c652493b
Successfully built fc76c652493b
Successfully tagged local/fastdfs:latest

(額,這是我第二次打包,我第一次打包輸出好多內容的,你們自行體會,你們應該能看見  ---> Using cache 利用了緩存)

 

到這裏,鏡像就打包好了。後面告訴你怎麼玩。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章