首页 > 其他分享 >云原生之使用docker部署httpd服务

云原生之使用docker部署httpd服务

时间:2023-06-14 14:00:52浏览次数:34  
标签:原生 httpd node 28 11 container docker

(云原生之使用docker部署httpd服务)

一、检查系统版本

[root@node ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

二、检查docker状态

1.检查docker版本

[root@node ~]# docker -v
Docker version 20.10.17, build 100c701

2.检查docker状态

[root@node ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2022-10-31 03:28:51 CST; 3 days ago
     Docs: https://docs.docker.com
 Main PID: 11884 (dockerd)
    Tasks: 45
   Memory: 3.4G
   CGroup: /system.slice/docker.service
           ├─11884 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
           ├─89868 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8100 -container-ip 172.17.0.2 -container-port 8100
           ├─89875 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8100 -container-ip 172.17.0.2 -container-port 8100
           ├─95298 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3541 -container-ip 172.17.0.3 -container-port 3306
           └─95304 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3541 -container-ip 172.17.0.3 -container-port 3306

Nov 03 11:28:02 node dockerd[11884]: time="2022-11-03T11:28:02.013519308+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:02 node dockerd[11884]: time="2022-11-03T11:28:02.762364306+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:03 node dockerd[11884]: time="2022-11-03T11:28:03.262033832+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:03 node dockerd[11884]: time="2022-11-03T11:28:03.961466550+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:05 node dockerd[11884]: time="2022-11-03T11:28:05.051145634+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:06 node dockerd[11884]: time="2022-11-03T11:28:06.966059311+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:10 node dockerd[11884]: time="2022-11-03T11:28:10.473723379+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:17 node dockerd[11884]: time="2022-11-03T11:28:17.261643944+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:30 node dockerd[11884]: time="2022-11-03T11:28:30.396312249+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Nov 03 11:28:56 node dockerd[11884]: time="2022-11-03T11:28:56.355217126+08:00" level=info msg="ignoring event" container=48b7ba756f8ee7...kDelete"
Hint: Some lines were ellipsized, use -l to show in full.

三、搜索httpd镜像

[root@node ~]# docker search httpd
NAME                                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
httpd                                The Apache HTTP Server Project                  4228      [OK]       
centos/httpd-24-centos7              Platform for running Apache httpd 2.4 or bui…   44                   
centos/httpd                                                                         35                   [OK]
arm32v7/httpd                        The Apache HTTP Server Project                  11                   
solsson/httpd-openidc                mod_auth_openidc on official httpd image, ve…   2                    [OK]
clearlinux/httpd                     httpd HyperText Transfer Protocol (HTTP) ser…   2                    
hypoport/httpd-cgi                   httpd-cgi                                       2                    [OK]
dockerpinata/httpd                                                                   1                    
manageiq/httpd                       Container with httpd, built on CentOS for Ma…   1                    [OK]
publici/httpd                        httpd:latest                                    1                    [OK]
inanimate/httpd-ssl                  A play container with httpd, ssl enabled, an…   1                    [OK]
dariko/httpd-rproxy-ldap             Apache httpd reverse proxy with LDAP authent…   1                    [OK]
nnasaki/httpd-ssi                    SSI enabled Apache 2.4 on Alpine Linux          1                    
lead4good/httpd-fpm                  httpd server which connects via fcgi proxy h…   1                    [OK]
centos/httpd-24-centos8                                                              1                    
patrickha/httpd-err                                                                  0                    
httpdss/archerysec                   ArcherySec repository                           0                    [OK]
e2eteam/httpd                                                                        0                    
amd64/httpd                          The Apache HTTP Server Project                  0                    
manageiq/httpd_configmap_generator   Httpd Configmap Generator                       0                    [OK]
httpdocker/kubia                                                                     0                    
paketobuildpacks/httpd                                                               0                    
ppc64le/httpd                        The Apache HTTP Server Project                  0                    
19022021/httpd-connection_test       This httpd image will test the connectivity …   0                    
manasip/httpd                                                                        0  

四、下载httpd镜像

[root@node ~]# docker pull httpd:2.4
2.4: Pulling from library/httpd
a2abf6c4d29d: Already exists 
dcc4698797c8: Pull complete 
41c22baa66ec: Pull complete 
67283bbdd4a0: Pull complete 
d982c879c57e: Pull complete 
Digest: sha256:0954cc1af252d824860b2c5dc0a10720af2b7a3d3435581ca788dff8480c7b32
Status: Downloaded newer image for httpd:2.4
docker.io/library/httpd:2.4

五、创建httpd容器

1.创建数据目录

[root@node ~]# mkdir -p /data/httpd
[root@node ~]# cd /data/httpd/

2.运行httpd容器

[root@node httpd]# docker run -dit --name my-apache -p 8680:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4
6490b46fe58d5f9837e9fcbef8b1e7767048fffe6ce7480c3764ba43ae91f313

3.查看httpd容器状态

[root@node httpd]# docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS          PORTS                                                  NAMES
6490b46fe58d   httpd:2.4           "httpd-foreground"       27 seconds ago   Up 26 seconds   0.0.0.0:8680->80/tcp, :::8680->80/tcp                  my-apache

六、访问httpd服务

在这里插入图片描述

七、编辑index.html文件

1.编辑index.html文件

[root@node httpd]# echo "aa-my-web-linux   ---"  > index.html
[root@node httpd]# ls
index.html

2.访问网站内容

[root@node httpd]# curl 192.168.3.166:8680
aa-my-web-linux   ---

3.浏览器访问httpd服务

在这里插入图片描述

标签:原生,httpd,node,28,11,container,docker
From: https://blog.51cto.com/u_14664141/6476849

相关文章

  • docker搭建wordpress
    ==========================docker的安装与部署==========================dockerimages 查看镜像dockerps-a 查看当前已有容器状态dockerexec-it容器编码(无重复前三位即可)或容器名称=================容器有点像虚拟机docker服务秒级启动finalshell连接centos7=......
  • 解决docker中gitlab的ssh拉取代码需要密码异常的问题
    安装gitlab命令dockerrun--name='gitlab'-d--publish222:22--publish1443:443--publish18080:80--restartalways--privileged=true--volume/home/docker_mount/gitlab/config:/etc/gitlab--volume/home/docker_mount/gitlab/logs:/var/log/gitlab--v......
  • uniapp 不显示原生导航
    自定义导航栏使用注意当navigationStyle设为custom或titleNView设为false时,原生导航栏不显示//pages配置部分页面{"path":"pages/default/systemError","style":{"navigationBarTitleText":"系统异常","navigationS......
  • Docker network —— why network
      course:ManagingDockerNetworking|Pluralsight ManagingDockerNetworkingby NigelPoultonThiscoursewillteachyouhowtobuildandmanagecontainernetworks,andhowtoconfigureandmanageservicediscovery.     1.微服务=》网......
  • docker部署hbase
    1.部署hbasehbase是hadoop生态中的一员,最早搭建hbase,需要先安装hadoop,然后安装zookeeper,再安装hbase。现在通过docker可以直接安装hbase,而且容器中并不需要hadoop。安装很简单。直接拉取镜像,然后运行即可。dockerrun-d--namehbase-p2181:2181-p16010:16010-p16020:160......
  • docker常用命令
    帮助启动类命令·启动docker:systemctlstartdocker·停止docker:systemctlstopdocker·重启docker:systemctlrestartdocker·查看docker状态:systemctlstatusdocker·开机启动:systemctlenabledocker·查看docker概要信息:dockerinfo查看docker总体帮助文档:docke......
  • Docker学习笔记 -day-01
    参考资料:Docker从入门到实践Docker教程|菜鸟教程Docker基本概念镜像:类似面向对象程序设计中的类容器:类似面向对象程序设计中的对象仓库:类似Maven,Gradle包管理工具,仓库主要是用于存放镜像安装Docker以CentOS-8.5.211-x86_64为例(参考CentOS安装Docker):终端......
  • Docker搭建lnmp环境
    使用的服务器配置很低,而且快要到期了。到时候更换服务器再搭建lnmp,也挺花时间的,所以这里先未雨绸缪一波。参考自博客园首先使用命令行依次配置nginx/php-fpm/mysql,然后再使用docker-compose重新配置一次。Nginx:dockerpullnginx //简单的拉取镜像dockercreate--nametemp......
  • centos7安装docker-compose插件
    引介docker-compose是docker的一款插件,常用来定义和运行多容器的docker应用。本篇文章就来介绍一下,如何在centos7的linux系统中安装docker-compose插件。安装方式docker-compose安装方式的主要可以分为两种,一是使用docker仓库进行安装,而是手动方式安装。使用docker仓库安装使......
  • KCD技术分享:以SBOM为基础的云原生应用安全治理
    随着越来越多的企业和组织将他们的应用迁移到云上,云原生技术的应用部署和管理正在变得更加灵活和高效,但也相应地引入了一些新的安全风险。2023年4月15日,由云原生计算基金会(CNCF)发起,全球各国当地的CNCF大使、员工以及CNCF会员单位联合组织的KubernetesCommunityDays(KCD)技术沙......