docker容器源码怎样部署httpd用存储卷部署网站

技术docker容器源码怎样部署httpd用存储卷部署网站这篇文章将为大家详细讲解有关docker容器源码怎样部署httpd用存储卷部署网站,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知

贺盛德贺盛德贺盛德贺盛德码头工是郑晓雨同学httpd。httpd。httpd。httpd。超文本协议服务云娥与云娥同在,阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥阿云哥,阿云娥阿云娥阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜阿云娜,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说,我是说。

docker容器源码部署httpd,用存储卷部署网站

创建一个httpd镜像

//哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼哼httpd。httpd。httpd。httpd。超文本协议服务是吗

[root @ localhost ~]# docker run-tid-name httpcentos

2d 693 e 16 f 3734 b 127 cbae 90d 189 c 1 B4 e 78619 a 54 ceec 912 a 82d 96 cf 4 f1 c 345

[root @ localhost ~]# docks

容器idimagecordcreatedstatupportname

2d 693和16f 4 F3 '/bin/bash '前5秒,后4秒httpd

//贺盛德贺盛德

[root @ localhost ~]# dock exec-it 2d 693和16f4f3/bin/bash

[root @ 2d 693和16f4f3/]#

//亚齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐阿齐

[root @ localhost ~]# docer CP/usr/src/apr-1。7 .0 .焦油。gz 2d 693和16f 334 f 3360/usr/src/

[root @ localhost ~]# docer CP/usr/src/apr-util-1。6 .1 .焦油。gz 2d 693和16f 3360/usr/src/

[root @ localhost ~]# docer CP/usr/src/httpd-2。4 .49 .焦油。gz 2d 693和16f 4 f 3360/usr/src/

[root @ 2d 693和16f4f3/]#ls/usr/src/

4月1日。7 .0 .焦油。gzdebug内核

4月1日。6 .1 .焦油。gzhttpd-2。4 .49 .焦油。地面零点

//云娥httpd。httpd。httpd。httpd。超文本协议服务

[root @ 2d 693和16f 4 F3/]#用户添加-r-m-s/sbin/no inapache

[root @ 2d 693和16f4f3/]#idapache

uid=998(Apache)GID=996(Apache)组=996(Apache)

[root @ 2d 693 e 16 F4 F3/]# yumkmarkinstall ' development tools '-y

[root @ 2d 693 e 16 F4 F3/]# yum-yinstallopenssl-devel cre-developerpt-devebtoogcgcc-c make

[root @ 2d 693和16f4f3/]#cd/usr/src/

[root @ 2d 693和16f 4 F3 src]# tar xfapr-1。7 .0 .焦油。gz-cnbsp

;/usr/local/
[root@2d693e16f4f3 src]# tar xf apr-util-1.6.1.tar.gz -C /usr/local/
[root@2d693e16f4f3 src]# tar xf httpd-2.4.49.tar.gz -C /usr/local/
[root@2d693e16f4f3 src]# cd /usr/local/apr-1.7.0/
[root@2d693e16f4f3 apr-1.7.0]# vi configure
cfgfile="${ofile}T"
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
    # $RM "$cfgfile"        //将此行加上注释,或者删除此行
[root@2d693e16f4f3 apr-1.7.0]# ./configure --prefix=/usr/local/apr
[root@2d693e16f4f3 apr-1.7.0]# make && make install
[root@2d693e16f4f3 local]# cd apr-util-1.6.1/
[root@2d693e16f4f3 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
[root@2d693e16f4f3 apr-util-1.6.1]# make && make install
[root@2d693e16f4f3 apr-util-1.6.1]# cd ../httpd-2.4.49/ 
[root@2d693e16f4f3 httpd-2.4.49]# ./configure --prefix=/usr/local/apache \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork
[root@2d693e16f4f3 httpd-2.4.49]# make && make install
[root@2d693e16f4f3 local]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
[root@2d693e16f4f3 local]# source /etc/profile.d/httpd.sh
[root@2d693e16f4f3 local]# ln -s /usr/local/apache/include /usr/include/apache
[root@2d693e16f4f3 local]# apachectl start
[root@2d693e16f4f3 local]# ss -anlt
State  Recv-Q Send-Q  Local Address:Port   Peer Address:Port Process                                                      
LISTEN 0      128           0.0.0.0:80          0.0.0.0:*    
[root@2d693e16f4f3 local]# cd /
[root@2d693e16f4f3 /]# 
[root@2d693e16f4f3 /]# 
[root@2d693e16f4f3 /]# vi start.sh
#! /bin/sh
/usr/local/apache/bin/apachectl start
/bin/bash
[root@2d693e16f4f3 /]# chmod +x start.sh
// 构建镜像
[root@localhost ~]# docker commit -p -c 'CMD ["/bin/bash","start.sh"]' 2d693e16f4f3 syblyw0806/httpd:v0.1
sha256:16913ce01fdceee9a389906cf385893120734b1a088b894cc5dce1a9ead252fd
[root@localhost ~]# docker images
REPOSITORY         TAG       IMAGE ID       CREATED         SIZE
syblyw0806/httpd   v0.1      16913ce01fdc   6 seconds ago   713MB
busybox            latest    d23834f29b38   6 days ago      1.24MB
centos             latest    5d0da3dc9764   2 months ago    231MB

部署nfs

需要开启一台新的虚拟机

[root@localhost ~]# yum -y install nfs-utils
[root@localhost ~]# systemctl restart nfs-server.service
[root@localhost ~]# mkdir /nfs
[root@localhost ~]# chmod 777 /nfs/
[root@localhost ~]# vim /etc/exports
/nfs 192.168.200.136(rw)
[root@localhost ~]# systemctl restart nfs-server

在有docker服务的虚拟机上一样安装nfs

[root@localhost ~]# yum -y install nfs-utils
[root@localhost ~]# showmount -e 192.168.200.137
Export list for 192.168.200.137:
/nfs 192.168.200.136

挂载

[root@localhost ~]# mount -t nfs 192.168.200.137:/nfs /var/www/html/
[root@localhost ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               883M     0  883M   0% /dev
tmpfs                  901M     0  901M   0% /dev/shm
tmpfs                  901M  8.9M  892M   1% /run
tmpfs                  901M     0  901M   0% /sys/fs/cgroup
/dev/mapper/rhel-root   47G   23G   25G  48% /
/dev/nvme0n1p1        1014M  179M  836M  18% /boot
tmpfs                  181M     0  181M   0% /run/user/0
overlay                 47G   23G   25G  48% /var/lib/docker/overlay2/0a219b8bbb04290f6b1cc1ae29f5eb1a9bc713ff12c86c86c7e13d5c7ca63a0e/merged
192.168.200.137:/nfs    47G  2.2G   45G   5% /var/www/html

创建容器并映射

[root@localhost ~]# docker run -itd --name httpd1 -p 80:80 -v /var/www/html/:/usr/local/apache/htdocs 16913ce01fdc
42e38f1db61e49fafa0682125d0425e3d41c4f2db0f48e1973dee1905a90daf3
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE          COMMAND                CREATED          STATUS         PORTS                               NAMES
42e38f1db61e   16913ce01fdc   "/bin/bash start.sh"   10 seconds ago   Up 9 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp   httpd1

上传我们要部署网站的代码

[root@localhost ~]# cd /var/www/html/
[root@localhost html]# ls
game.html  images  index.html  js  style

此时在新开的一台虚拟机查看nfs

[root@localhost ~]# ls /nfs/
game.html  images  index.html  js  style

访问测试

docker容器源码怎样部署httpd用存储卷部署网站

docker容器源码怎样部署httpd用存储卷部署网站
docker容器源码怎样部署httpd用存储卷部署网站

关于docker容器源码怎样部署httpd用存储卷部署网站就分享到这里了,希望

内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/137937.html

(0)

相关推荐

  • Eclipse如何构建WebServices

    技术Eclipse如何构建WebServices小编给大家分享一下Eclipse如何构建WebServices,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起

    攻略 2021年11月27日
  • 读书感悟100字左右,《朝花夕拾》读后感100字左右

    技术读书感悟100字左右,《朝花夕拾》读后感100字左右《朝花夕拾》读后感 《朝花夕拾》原本叫做“旧事重提”读书感悟100字左右,收录了鲁迅先生记述他童年和青年生活片段的10篇文章。本应该快乐美丽的童年,因为笼罩在那个封

    生活 2021年10月25日
  • openwrt lan口改成dhcp(openwrt wan口怎么设置)

    技术openwrt 19.7 驱动如何添加rndis模式4G模块这篇文章主要介绍openwrt 19.7 驱动如何添加rndis模式4G模块,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!在linu

    攻略 2021年12月17日
  • 怎么才能持久,如何才能获得长久的幸福

    技术怎么才能持久,如何才能获得长久的幸福美国著名的心理学家马丁塞利格曼
    说:幸福快乐的人生有三种怎么才能持久。
    第一种,是愉快的人生。
    这样的人生所拥有的快乐多得不能再多了,积极情绪多得不能再多了。学习快乐的技巧,在时间

    生活 2021年10月27日
  • Intellij IDEA智能补全的方法有哪些

    技术Intellij IDEA智能补全的方法有哪些本篇内容介绍了“Intellij IDEA智能补全的方法有哪些”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情

    攻略 2021年11月16日
  • SpringBoot中常用的注解有哪些

    技术SpringBoot中常用的注解有哪些这篇文章主要介绍了SpringBoot中常用的注解有哪些,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。一、@Sp

    攻略 2021年12月11日