|
|
在创建docker时添加些参数:
; ^6 D, H1 x: n; n% ~/ ^ # docker run --privileged -ti docker.io/centos:7 /usr/sbin/init &( E( h! X4 U9 C" l' R3 A
0 ^3 l r# A6 a+ ]6 W2 e2 `Unable to find image 'centos:7' locally8 u. k- G$ n9 Q5 R) P" j
7: Pulling from library/centos
9 r8 {4 o+ G7 g, C1 g- Z( d4 ^7dc0dca2b151: Pull complete + t- e7 j3 [! e
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322! s* W' R4 N9 `% c A) y
Status: Downloaded newer image for centos:7' }/ w5 S2 t- O5 _4 Y1 k
0 z( U$ q7 H; F4 s# Q4 s# X' n. m. P: s, x% I; R5 K, P2 [
/ J) o G8 \. e+ L
# docker run --privileged -it centos /usr/sbin/init. G6 @% R( W; V7 Y; z, a
Unable to find image 'centos:latest' locally
) t) A5 H$ C$ w, w, }! xlatest: Pulling from library/centos/ ]) F1 S9 B' e' l& I# A l: C O
7dc0dca2b151: Pull complete + n* M1 p+ S5 W2 T) P( V
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322, Q6 a& {( D: [4 E
Status: Downloaded newer image for centos:latest7 U% w; x) B- T. K8 o$ r( C( a+ x
# z0 f4 S$ u) W6 t6 t
进入到docker容器中,安装httpd软件,并启动httpd服务。0 A# m H9 M' n# Q: V
# docker exec -it dcb5c79348a0 /bin/bash
! P+ _; G. [8 n5 N* o" p8 M7 R+ S$ n2 U, d, n9 M6 Y' I
[root@dcb5c79348a0 /]# systemctl start httpd
! E! _2 M- T, Y7 @[root@dcb5c79348a0 /]# systemctl status httpd.service2 u6 }+ T$ @8 P" q
● httpd.service - The Apache HTTP Server) o+ j7 j/ c" K* k6 E8 a1 U! B( T# I( c
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
) J' D/ b- e. g0 v Active: active (running) since Thu 2018-06-21 07:38:03 UTC; 11s ago
' j: K2 L% B7 G/ ]* q" g3 X( b Docs: man:httpd(8)% `& _9 W, o; f% m/ h2 {6 S0 g
man:apachectl(8)
' m# W( R, B$ ?# d! o Main PID: 199 (httpd)
1 {8 [9 B: n( }$ l Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
: j4 J/ n7 \% @. v CGroup: /docker/dcb5c79348a0ba92f0ccf225e2f9c42810b6f8ad7884400a968c767ae5569694/system.slice/httpd.service
) A9 G" z; U. t& {( x7 a% z2 M+ F ├─199 /usr/sbin/httpd -DFOREGROUND7 f$ Y0 `" m* X( i' i3 z- H
├─200 /usr/sbin/httpd -DFOREGROUND# |6 i! l' \( Z( K% P0 Z) x
├─201 /usr/sbin/httpd -DFOREGROUND' N6 t2 l( m! a8 f2 j4 L) l2 H( v
├─202 /usr/sbin/httpd -DFOREGROUND+ Y6 L3 x% Z7 P' b1 h% @* l% {$ U
├─203 /usr/sbin/httpd -DFOREGROUND$ s. @" j4 i" V" u2 c. ?
└─204 /usr/sbin/httpd -DFOREGROUND
0 n% L& k& N, I6 ]" J5 V ‣ 199 /usr/sbin/httpd -DFOREGROUND
0 S0 w; X4 u# j6 d2 T
) h i& Y& u1 F& F" pJun 21 07:38:03 dcb5c79348a0 systemd[1]: Starting The Apache HTTP Server...: U( M) H6 w0 V
Jun 21 07:38:03 dcb5c79348a0 httpd[199]: AH00558: httpd: Could not reliably ...e" ]$ F T- b" i" J/ F' N' n7 p
Jun 21 07:38:03 dcb5c79348a0 systemd[1]: Started The Apache HTTP Server.: J9 L6 |) h; Z# c
Hint: Some lines were ellipsized, use -l to show in full.! m, b; E" e; z6 F+ L6 N
|
|