编译安装部署网站,存储卷挂载
基于容器的方式做一个apache编译安装的镜像,要求通过此镜像能够部署一个web站点, 站点的内容去源码
之家找,通过存储卷挂载到容器里面,最后成功访问
[root@slave ~]# cd web/
[root@slave web]# ls
chuzhen.html images js kexue.html pic zhuanjia.html
css index.html keshi.html kexuelist.html rongyu.html
html5大气医院网站源码 jianjie.html keshimx.html news.html uploadfiles
html5大气医院网站源码.zip jiuzhen.html keshiys.html newslist.html ys.html
[root@slave web]# rm html5大气医院网站源码
rm: cannot remove 'html5大气医院网站源码': Is a directory
[root@slave web]# rm -rf html5大气医院网站源码
[root@slave web]# rm -rf html5大气医院网站源码.zip
[root@slave web]# ls
chuzhen.html index.html js keshiys.html news.html rongyu.html zhuanjia.html
css jianjie.html keshi.html kexue.html newslist.html uploadfiles
images jiuzhen.html keshimx.html kexuelist.html pic ys.html
[root@slave web]#
[root@slave ~]# docker run -d --name web -v /root/web:/usr/local/apache/htdocs -p 80:80 ac64e3db3533
976673e6880695af78e787da236b34d77bc6cbc07cf36f412dfc19f3d87bd190
[root@slave ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:80 [::]:*
LISTEN 0 128 [::]:22 [::]:*
[root@slave web]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
976673e68806 ac64e3db3533 "/mr.sh" 13 minutes ago Exited (137) 5 minutes ago web
[root@slave web]# docker tag ac64e3db3533 marui123/test:v6.66
[root@slave web]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
marui123/httpd 1.0 ac64e3db3533 3 hours ago 696MB
marui123/test v6.66 ac64e3db3533 3 hours ago 696MB
[root@slave web]# docker push marui123/test:v6.66
The push refers to repository [docker.io/marui123/test]
d13106674366: Mounted from marui123/httpd
74ddd0ec08fa: Mounted from marui123/httpd
v6.66: digest: sha256:68f785a775d7398139830684030b509acfa4f36cb2eef66b790b88f386eb8baa size: 742
[root@slave web]#