|
|
在创建docker时添加些参数:( W" j* l. a' k; s
# docker run --privileged -ti docker.io/centos:7 /usr/sbin/init &# Y: @# g' }1 B3 C! v; I
, u3 T) U. A u1 C) ^8 q2 K9 D
Unable to find image 'centos:7' locally$ } z4 p5 W- v
7: Pulling from library/centos2 e+ {3 L$ @3 b. }, i, D" @
7dc0dca2b151: Pull complete
0 m/ M/ C/ Q+ Y2 K+ D+ y; rDigest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa53220 w2 l" G- O I! S0 D! G0 R
Status: Downloaded newer image for centos:78 w: t: B" t! T6 N" T' Q
& V ]( s7 {3 r: S. R" Q9 ~1 t9 D
2 b t3 u: D/ w+ G4 O8 A* A. B7 T; {6 j
# docker run --privileged -it centos /usr/sbin/init
( T9 i) I6 M4 r: m* j7 HUnable to find image 'centos:latest' locally
% y/ } }2 X; a7 N1 L/ P/ Ulatest: Pulling from library/centos
% ^; q1 \$ I# c4 d* j# I6 _! p7dc0dca2b151: Pull complete 6 u0 J- \; m8 b. h, z# ^1 {
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
a1 Y5 K& ?9 I F) t! w! mStatus: Downloaded newer image for centos:latest8 } I( @2 }* C( y
1 ^4 G3 `7 X4 R/ f
进入到docker容器中,安装httpd软件,并启动httpd服务。% W, m6 Z8 ], `, D- ~; d0 Q
# docker exec -it dcb5c79348a0 /bin/bash M g: m D7 E0 Z
3 l0 D3 V: D8 E2 `[root@dcb5c79348a0 /]# systemctl start httpd2 N9 B' c8 d5 K7 f+ C3 J
[root@dcb5c79348a0 /]# systemctl status httpd.service2 [/ H7 `4 W4 y) y: i9 k
● httpd.service - The Apache HTTP Server
% t. h; y4 C/ ~0 A+ a* L Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)( c1 _! `! ~/ \
Active: active (running) since Thu 2018-06-21 07:38:03 UTC; 11s ago
& m* z; f, y# J Docs: man:httpd(8)
" [' J+ t% k0 F& B& s" i9 }" G2 ^ man:apachectl(8)8 L) |4 {' p( ~& G- d. @
Main PID: 199 (httpd)1 d$ r- v, }/ {, I* k. x
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"' N* } k0 A% g* Y% J, M/ w) e# T" ]$ m
CGroup: /docker/dcb5c79348a0ba92f0ccf225e2f9c42810b6f8ad7884400a968c767ae5569694/system.slice/httpd.service
- t* |8 _6 a3 ~3 |4 a* [ ├─199 /usr/sbin/httpd -DFOREGROUND
6 G4 D6 a2 ?2 r5 ]' T# [+ P ├─200 /usr/sbin/httpd -DFOREGROUND
6 \' N) ^- e* L: N ├─201 /usr/sbin/httpd -DFOREGROUND; Z4 B1 E( l8 b
├─202 /usr/sbin/httpd -DFOREGROUND
3 @3 P$ |: k' f% L4 Z7 T! J ├─203 /usr/sbin/httpd -DFOREGROUND$ F8 e0 t- h" H9 h# }* }3 }& H0 ^
└─204 /usr/sbin/httpd -DFOREGROUND+ v7 U: p0 H( l) c7 E$ F
‣ 199 /usr/sbin/httpd -DFOREGROUND i0 L. n+ @. Q$ ~# T6 I9 h
% O& q' }' m. D3 o" O% |Jun 21 07:38:03 dcb5c79348a0 systemd[1]: Starting The Apache HTTP Server... [4 ?+ F8 i. n; H
Jun 21 07:38:03 dcb5c79348a0 httpd[199]: AH00558: httpd: Could not reliably ...e; k9 d- u: v) l1 R& p
Jun 21 07:38:03 dcb5c79348a0 systemd[1]: Started The Apache HTTP Server.
2 u) s1 J8 k3 c: Z1 d. qHint: Some lines were ellipsized, use -l to show in full.
: C3 y5 u) \0 G& } |
|