|
|
在创建docker时添加些参数:
/ x( ?+ Q5 S) U; }) ^3 e- X3 {/ ~- q # docker run --privileged -ti docker.io/centos:7 /usr/sbin/init &2 d! V; l1 x1 U z" Q+ N' q
- Z U/ \% L; }/ A- d7 S
Unable to find image 'centos:7' locally
( A& D* a" e' w/ d6 {7: Pulling from library/centos6 I0 f5 E2 g! Z% c+ V1 w" s
7dc0dca2b151: Pull complete
! L# I! q* B2 h. cDigest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa53223 U$ z* y. C( r1 z h! G5 W8 u
Status: Downloaded newer image for centos:73 w7 F( N) g' ~0 B
& k0 _5 [1 t0 n8 I5 k- s1 S1 W; D/ n' {8 t
: G: X* \1 K+ ?# M* H) Q# docker run --privileged -it centos /usr/sbin/init1 x' b3 q9 M2 b1 V8 B! l2 x: l
Unable to find image 'centos:latest' locally
" B9 z' J/ ~8 W) W& glatest: Pulling from library/centos w' n' S% R0 D6 A7 L9 g! B
7dc0dca2b151: Pull complete
0 A2 j X5 p# D( WDigest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322& a, K+ b+ O# t& C
Status: Downloaded newer image for centos:latest! U; ~2 S; y' k1 ?8 B0 u# V
$ w4 i- M I% V+ A进入到docker容器中,安装httpd软件,并启动httpd服务。
/ d' x, g3 m7 N* k* D9 \4 Y# docker exec -it dcb5c79348a0 /bin/bash $ w6 C- L- X" A/ \
; n1 Y$ V7 X" J/ R8 n
[root@dcb5c79348a0 /]# systemctl start httpd0 P" g& m7 f7 o5 x0 e8 w/ A
[root@dcb5c79348a0 /]# systemctl status httpd.service! L0 F0 U, l0 Y$ {
● httpd.service - The Apache HTTP Server
# G% [$ ~1 o1 ^! m Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
7 t$ a; p E3 a$ z Active: active (running) since Thu 2018-06-21 07:38:03 UTC; 11s ago2 ~. E4 e {! j0 n% V- w4 {2 W
Docs: man:httpd(8)1 k1 I; T% ~' G# I6 o$ M! M- r, }
man:apachectl(8)- e. ^' r$ [, j u7 ~ Z7 u
Main PID: 199 (httpd) B& v# C. C( \5 ]+ |4 ?5 Z% i
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
^5 s) K6 h% W" B2 h h CGroup: /docker/dcb5c79348a0ba92f0ccf225e2f9c42810b6f8ad7884400a968c767ae5569694/system.slice/httpd.service6 c: U; R( ^0 [. Y( N& ^7 J7 w
├─199 /usr/sbin/httpd -DFOREGROUND
* ^6 e+ S* l( p3 H3 C1 V% Z; V$ ^" O ├─200 /usr/sbin/httpd -DFOREGROUND
1 e8 q7 p" T, d ├─201 /usr/sbin/httpd -DFOREGROUND
% `& g# b$ s4 H. s, V& z0 d) W ├─202 /usr/sbin/httpd -DFOREGROUND) |9 P+ x* o- i2 t/ B" M
├─203 /usr/sbin/httpd -DFOREGROUND
% B6 U, c$ e3 a( M0 f └─204 /usr/sbin/httpd -DFOREGROUND. V# X3 g! b3 ]% M; X9 y
‣ 199 /usr/sbin/httpd -DFOREGROUND1 y G6 \1 b& j; S6 r7 q T
* t, l( K$ y g* q' b6 U+ a0 _Jun 21 07:38:03 dcb5c79348a0 systemd[1]: Starting The Apache HTTP Server.../ H& L, i2 n4 w) T( z+ V2 [
Jun 21 07:38:03 dcb5c79348a0 httpd[199]: AH00558: httpd: Could not reliably ...e
- B6 u( T; b8 k2 {# gJun 21 07:38:03 dcb5c79348a0 systemd[1]: Started The Apache HTTP Server.
7 e3 ?9 c, c ?& gHint: Some lines were ellipsized, use -l to show in full.
8 Z% T9 O4 S7 h2 q% J |
|