CumulusClips是一個(gè)開源的視頻分享(內(nèi)容管理)平臺(tái),能夠提供最佳的視頻分享功能之一類似YouTube。 在CumulusClips的幫助下,您可以開始自己的視頻分享網(wǎng)站或在您現(xiàn)有的網(wǎng)站上添加視頻部分,用戶可以注冊(cè),上傳視頻,評(píng)論視頻,評(píng)價(jià)視頻,嵌入視頻等等。
一.部署環(huán)境
centos7系列系統(tǒng),已部署docker容器,社區(qū)版部署參考官方文檔或
http://www.itdecent.cn/p/edccebf55184
二.下載相關(guān)的鏡像images
這里使用的鏡像為mysql5.7舊版穩(wěn)定版本,鏈接容器命令如下
[root@cobbler ~]# docker run --name cumulusclips-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -e MYSQL_DATABASE=cumulusclipsdb \
> -e MYSQL_USER=cumulusclipsuser -e MYSQL_PASSWORD=cumulusclipsdbpasswd -d mysql:5.7
Unable to find image 'mysql:5.7' locally
5.7: Pulling from library/mysql
27833a3ba0a5: Pull complete
864c283b3c4b: Pull complete
cea281b2278b: Pull complete
8f856c14f5af: Pull complete
9c4f38c23b6f: Pull complete
1b810e1751b3: Pull complete
5479aaef3d30: Pull complete
1d924ec3d520: Pull complete
1ab7ae63ac60: Pull complete
08aa5f3680e9: Pull complete
a832d0a0972a: Pull complete
Digest: sha256:dba5fed182e64064b688ccd22b2f9cad4ee88608c82f8cff21e17bab8da72b81
Status: Downloaded newer image for mysql:5.7
7866342b58740e35d01ba6cb7de0cc2957075b498df5692da4ecb9b108163b7e
[root@cobbler ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 98455b9624a9 2 weeks ago 372MB
hello-world latest fce289e99eb9 3 months ago 1.84kB
[root@cobbler ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7866342b5874 mysql:5.7 "docker-entrypoint.s…" 25 seconds ago Up 23 seconds 3306/tcp, 33060/tcp cumulusclips-mysql
#這里會(huì)自動(dòng)生成一個(gè)新的容器為防止和啟動(dòng)腳本沖突停止容器并刪除
[root@cobbler ~]# docker stop 7866342b5874
7866342b5874
[root@cobbler ~]# docker rm 7866342b5874
7866342b5874
創(chuàng)建初始化啟動(dòng)腳本拉取最新鏡像并進(jìn)入初始化安裝
[root@cobbler ~]# cd /
[root@cobbler /]# mkdir script
[root@cobbler /]# cd script/
[root@cobbler script]# vim cumulusclips_init.sh
docker run --name cumulusclips-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysecretpassword -e MYSQL_DATABASE=cumulusclipsdb \
-e MYSQL_USER=cumulusclipsuser -e MYSQL_PASSWORD=cumulusclipsdbpasswd -d mysql:5.7
docker run -d -p 80:80 --link cumulusclips-mysql:db quantumobject/docker-cumulusclips
[root@cobbler script]# chmod +x /script/cumulusclips_init.sh
[root@cobbler script]# ./cumulusclips_init.sh
0fa0bc4ad745d82b4d2da8f8f8924946e4bcca833d394fc804dd8c71ed4aa430
docker: Error response from daemon: driver failed programming external connectivity on endpoint cumulusclips-mysql (fb210d451788cb781968fd2a783771b3210ab49c9072b228afb14d8b82b13d69): Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use.
Unable to find image 'quantumobject/docker-cumulusclips:latest' locally
latest: Pulling from quantumobject/docker-cumulusclips
84ed7d2f608f: Pull complete
be2bf1c4a48d: Pull complete
a5bdc6303093: Pull complete
e9055237d68d: Pull complete
8578d9691ed8: Pull complete
40776e828ac9: Pull complete
5d4b933b2986: Pull complete
a05d11aced8d: Pull complete
a97048fe5b53: Pull complete
9c6ace4bb9d1: Pull complete
d61d80359236: Pull complete
bc7c0dcd17ea: Pull complete
8733f35d998f: Pull complete
f2e28ef11aa2: Pull complete
8896dff6f9db: Pull complete
a40dcf5868ac: Pull complete
299ea5f91975: Pull complete
Digest: sha256:bc44239e15d12a314dd312d1a899621f82f3f1b7e7d77eed101a14674c2c4082
Status: Downloaded newer image for quantumobject/docker-cumulusclips:latest
3e39d36f54b4ec8e82166d3e896139450896649ab38aed063718d34900622a0b
docker: Error response from daemon: driver failed programming external connectivity on endpoint pensive_noether (567d87ece9d8662718519a28a3b00df316d395aa86053d27d07b5e596e56f064): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use.
正常會(huì)啟動(dòng)2個(gè)容器如下
[root@cobbler script]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3e39d36f54b4 quantumobject/docker-cumulusclips "/sbin/my_init" 18 seconds ago Created pensive_noether
0fa0bc4ad745 mysql:5.7 "docker-entrypoint.s…" 57 seconds ago Created cumulusclips-mysql
故障排除:根據(jù)提示這里容器都已經(jīng)創(chuàng)建但是無法運(yùn)行,手動(dòng)啟動(dòng)容器報(bào)錯(cuò)如下
[root@cobbler script]# docker start 0fa0bc4ad745
Error response from daemon: driver failed programming external connectivity on endpoint cumulusclips-mysql (de4954d6c492bc8ea11313a64b1244fd09470bf17d3913df92670770a26717ab): Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use
Error: failed to start containers: 0fa0bc4ad745
[root@cobbler script]# docker start 3e39d36f54b4
Error response from daemon: driver failed programming external connectivity on endpoint pensive_noether (b5c9eac41edeb75c6c7953a4f43a8685b7e73408bdd18bd0f2462726fbe8d74a): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
Error: failed to start containers: 3e39d36f54b4
結(jié)論:服務(wù)器上http的80端口以及mysql的3306端口都已經(jīng)被占用因此無法運(yùn)行
解決方案:刪除容器并修改初始化腳本文件將端口順延1位,81以及3307
新配置文件如下
[root@cobbler script]# vim cumulusclips_init.sh
docker run --name cumulusclips-mysql -p 3307:3306 -e MYSQL_ROOT_PASSWORD=mysecretpassword -e MYSQL_DATABASE=cumulusclipsdb \
-e MYSQL_USER=cumulusclipsuser -e MYSQL_PASSWORD=cumulusclipsdbpasswd -d mysql:5.7
docker run -d -p 81:80 --link cumulusclips-mysql:db quantumobject/docker-cumulusclips
修改完成直接啟動(dòng)腳本
[root@cobbler script]# ./cumulusclips_init.sh
91a00a5a54baab44c20cfb8017d9e4b981ed26a05e496b0cd57682d9b4b30763
5da88e6aadcff4c52da5b06a895bca61346d8820ee9b00d05a470316bb224f25
[root@cobbler script]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5da88e6aadcf quantumobject/docker-cumulusclips "/sbin/my_init" 14 seconds ago Up 10 seconds 0.0.0.0:81->80/tcp epic_murdock
91a00a5a54ba mysql:5.7 "docker-entrypoint.s…" 15 seconds ago Up 13 seconds 33060/tcp, 0.0.0.0:3307->3306/tcp cumulusclips-mysql
附件docker腳本
version: '2'
volumes:
cumulusclips:
db:
services:
db:
image: mariadb
restart: always
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=rootpassword
- MYSQL_PASSWORD=cumulusclipsdbpasswd
- MYSQL_DATABASE=cumulusclipsdb
- MYSQL_USER=cumulusclipsuser
app:
image: quantumobject/docker-cumulusclips
links:
- db
ports:
- 80:80
volumes:
- cumulusclips:/var/www/html
restart: always
三.訪問頁(yè)面 http://192.168.28.150:81進(jìn)行初始化安裝

點(diǎn)擊繼續(xù)配置相關(guān)數(shù)據(jù)庫(kù)信息

相關(guān)信息如下
DataBase Host: db
DataBase Port: 3306
DataBase Name: cumulusclipsdb
DataBase User: cumulusclipsuser
DataBase Password: cumulusclipsdbpasswd
TablePrefix : tb_
配置平臺(tái)管理員相關(guān)信息

至此視頻分享平臺(tái)搭建完成
備注:
1.上傳視頻后網(wǎng)站需要時(shí)間進(jìn)行轉(zhuǎn)碼
2.如果關(guān)機(jī)或者服務(wù)停止情況下,重啟兩個(gè)容器即可,重啟數(shù)據(jù)庫(kù)容器
參考文章:
https://blog.csdn.net/Aria_Miazzy/article/details/85028663
服務(wù)器意外關(guān)機(jī)后重啟容器
首先需要查看容器ID
[root@cobbler ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5da88e6aadcf quantumobject/docker-cumulusclips "/sbin/my_init" 4 weeks ago Exited (0) 14 seconds ago epic_murdock
91a00a5a54ba mysql:5.7 "docker-entrypoint.s…" 4 weeks ago Exited (0) 4 seconds ago cumulusclips-mysql
正常情況直接啟動(dòng)相應(yīng)容器即可,但是因?yàn)橐馔怅P(guān)機(jī)造成iptales服務(wù)沒有開機(jī)自啟動(dòng),無法進(jìn)行端口轉(zhuǎn)發(fā),報(bào)錯(cuò)信息如下
[root@cobbler ~]# docker start 91a00a5a54ba
Error response from daemon: driver failed programming external connectivity on endpoint cumulusclips-mysql (3c2c957defc1563a8768e897b53de468d754b62ad63a96e5184ceae395c9a023): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3307 -j DNAT --to-destination 172.17.0.2:3306 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1))
Error: failed to start containers: 91a00a5a54ba
手動(dòng)啟動(dòng)iptables服務(wù)后啟動(dòng)容器仍然是同樣的報(bào)錯(cuò)信息
光看這個(gè)報(bào)錯(cuò): iptables: No chain/target/match by that name,就能夠看出是跟iptables有關(guān)
原因猜測(cè):如果再啟動(dòng)docker service的時(shí)候網(wǎng)關(guān)是關(guān)閉的,那么docker管理網(wǎng)絡(luò)的時(shí)候就不會(huì)操作網(wǎng)管的配置(chain docker),然后網(wǎng)關(guān)重新啟動(dòng)了,導(dǎo)致docker network無法對(duì)新container進(jìn)行網(wǎng)絡(luò)配置,也就是沒有網(wǎng)管的操作權(quán)限,做重啟處理
解決辦法:
先啟動(dòng)iptables服務(wù)組件
然后重啟docker服務(wù)
最后啟動(dòng)容器成功
[root@cobbler ~]# systemctl start iptables
[root@cobbler ~]# systemctl restart docker
[root@cobbler ~]# docker start 91a00a5a54ba
91a00a5a54ba
備注:由于docker容器需要使用iptables服務(wù)進(jìn)行端口轉(zhuǎn)發(fā),因此對(duì)于內(nèi)網(wǎng)的文件服務(wù)器samba服務(wù)造成影響,因此需要開放服務(wù)對(duì)應(yīng)的端口:137,138,139以及445
參考文章:https://www.cnblogs.com/kreo/p/4368811.html
#先檢查是否安裝了iptables
service iptables status
#安裝iptables
yum install -y iptables
#升級(jí)iptables
yum update iptables
#安裝iptables-services
yum install iptables-services
#查看iptables現(xiàn)有規(guī)則
iptables -L -n
#清空所有自定義規(guī)則
iptables -X
#清空所有默認(rèn)規(guī)則
iptables -F
[root@cobbler ~]# iptables -X
[root@cobbler ~]# iptables -F
[root@cobbler ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
#開放137,138,139以及445端口
[root@cobbler ~]# iptables -A INPUT -p tcp --dport 137 -j ACCEPT
[root@cobbler ~]# iptables -A INPUT -p tcp --dport 138 -j ACCEPT
[root@cobbler ~]# iptables -A INPUT -p tcp --dport 139 -j ACCEPT
[root@cobbler ~]# iptables -A INPUT -p tcp --dport 445 -j ACCEPT
#保存規(guī)則
[root@cobbler ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@cobbler ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:137
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:138
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:139
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:445
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
#重啟防火墻并加入開機(jī)自啟動(dòng)
[root@cobbler ~]# systemctl restart iptables
[root@cobbler ~]# systemctl enable iptables