(七)Docker搭建httpd集群

1. 单个httpd镜像

[root@Thor ~]# docker run -dit -p 1992:80 -v my_volume:/usr/local/apache2/htdocs --name httpd httpd
5026e9cc9e6df434f2d3649aee69aa348cd0971d0e4d62783d38cc7e07be4510
[root@Thor ~]# 
[root@Thor ~]# docker volume ls
DRIVER              VOLUME NAME
local               my_volume
[root@Thor ~]# 
[root@Thor ~]# docker volume help

Usage:  docker volume COMMAND

Manage volumes

Options:
      --help   Print usage

Commands:
  create      Create a volume
  inspect     Display detailed information on one or more volumes
  ls          List volumes
  prune       Remove all unused volumes
  rm          Remove one or more volumes

Run 'docker volume COMMAND --help' for more information on a command.
[root@Thor ~]# 
[root@Thor ~]# docker volume inspect my_volume
[
    {
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/my_volume/_data",
        "Name": "my_volume",
        "Options": {},
        "Scope": "local"
    }
]
[root@Thor ~]# cd /var/lib/docker/volumes/my_volume/_data
[root@Thor _data]# ls
data  test.txt
[root@Thor _data]# cp /home/aliyun.jpg ./
[root@Thor _data]# ls
aliyun.jpg  data  test.txt

[root@Thor _data]# ll
total 284
-rw-r-----  1 root              root 285872 Aug 30 20:08 aliyun.jpg
drwxr-xr-x. 2 systemd-bus-proxy root     22 Jul 17 16:59 data
-rw-r--r--. 1 root              root     20 Jul 16 16:41 test.txt
[root@Thor _data]# chmod 777 *

[root@Thor _data]# 

2. httpd集群

猜你喜欢

转载自www.cnblogs.com/walkinginthesun/p/9563745.html