源码部署apache服务
拉取镜像
[root@localhost ~]# docker pull centos:8
8: Pulling from library/centos
Digest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177
Status: Image is up to date for centos:8
docker.io/library/centos:8
创建一个带有存储卷的容器
这里我们使用的是指定存储卷方法
[root@localhost ~]# docker run -it --name httpd --network host -v /usr/src:/usr/src centos:8
上传包
[root@localhost ~]# ls /usr/src/
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz debug httpd-2.4.48.tar.gz kernels
部署
[root@localhost ~]# cd /usr/src/
[root@localhost src]# tar xf apr-1.7.0.tar.gz
[root@localhost src]# tar xf apr-util-1.6.1.tar.gz
[root@localhost src]# tar xf httpd-2.4.48.tar.gz
[root@56b673ad4dc4 /]# ls /usr/src/
apr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1 apr-util-1.6.1.tar.gz debug httpd-2.4.48 httpd-2.4.48.tar.gz kernels
//安装开发工具包
[root@56b673ad4dc4 /]# yum -y groups mark install 'Development Tools'
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream 2.1 MB/s | 8.2 MB 00:03
CentOS Linux 8 - BaseOS 2.6 MB/s | 3.5 MB 00:01
CentOS Linux 8 - Extras 11 kB/s | 10 kB 00:00
Dependencies resolved.
============================================================================