|
|
[root@compute01 ~]# cat /etc/systemd/system/docker.service.d/proxy.conf / r0 G* e/ w4 I, g5 [7 @
[Service]% d7 i& h7 ?# O) T, f( ~
Environment="HTTP_PROXY=http://192.168.2.158:7890/") T! w+ a$ v: [- A
Environment="HTTPS_PROXY=http://192.168.2.158:7890/") Z+ q3 r% L; o% g2 s' A
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
5 z! I2 H, h, N% e. z+ U- k
6 q1 J% F( G) f9 A重启docker服务生效: systemctl restart docker.service ! @! G0 E' J7 V0 t; F# d0 L
[root@compute01 ~]# docker info * S d7 c( F" E1 k4 l, W
Client:- q7 T" h) |# |
Context: default+ U% J c; J( D$ j" G5 _9 ]5 q
Debug Mode: false$ N! g8 p* V9 J' S
Plugins:/ P K, l: u2 V+ T- A* g4 E/ f I
app: Docker App (Docker Inc., v0.9.1-beta3)
* s | k; l; P; f; u buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
) k ]: f# m2 J- A9 \ scan: Docker Scan (Docker Inc., v0.8.0)Server:
: Y: t; C% \1 T7 n- R7 T6 ] Containers: 08 M+ Q$ K% }4 Z' U: d: N7 }7 K
Running: 01 P) g' q- W0 C3 M
Paused: 0* b5 y+ y7 a4 _: p, M+ D
Stopped: 0
: k8 s1 n; j, a, k% G Images: 0
b' ^& }7 \" X) u; s; M$ X9 X% Z Server Version: 20.10.7
7 M; _( N, m1 [ Storage Driver: overlay2
* U5 e: m ]5 K% r* L Backing Filesystem: xfs8 Z8 L2 c* x% v" D& f7 ?
Supports d_type: true
. K# t; Y1 ?5 S$ M8 V Native Overlay Diff: true/ D% z6 b! L$ q4 V" p3 H) n J7 g
userxattr: false
% B6 ?) q" K5 ]" s I1 m/ e Logging Driver: json-file& }9 Z) Q/ W4 A" r2 n1 D
Cgroup Driver: cgroupfs
3 e' F# t& O" F5 ?( H0 E# k Cgroup Version: 1
5 Q3 D0 c8 ^& a& W; a3 Q$ f Plugins:
8 ?: _ m1 @# c, l6 H* J Volume: local( d% @6 s9 d5 r- v4 B) o* Y
Network: bridge host ipvlan macvlan null overlay4 p1 W; |/ N0 ]6 Z+ b; X$ C
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
- z4 o# t' k; | Swarm: inactive: K) N( S$ o4 H( h1 [* S% i
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
U$ q4 V+ O3 W* @3 Z Default Runtime: runc7 C9 z0 W7 d0 Z/ \' M
Init Binary: docker-init
3 o" @0 _0 e) T+ f r8 j) X containerd version: 7eba5930496d9bbe375fdf71603e610ad737d2b2
+ b! r) K0 z$ H+ L, v) c1 f; a runc version: v1.0.0-0-g84113ee
" g6 j% S3 g! N {* w$ p4 A init version: de40ad0
& {2 }! P n1 D, e/ O$ i Security Options:
: x }4 K' _( { seccomp9 C* H% ^, j# d M0 {
Profile: default) l# e. S9 S) R6 A
Kernel Version: 3.10.0-1160.31.1.el7.x86_64
# U1 h+ [% i2 L3 p4 C Operating System: CentOS Linux 7 (Core)0 W/ d* {5 C4 |, m# L: w* u
OSType: linux
2 e" F0 r" g& t5 c; i7 C) U: y Architecture: x86_646 i: Y) y# z: a! v
CPUs: 32
, j& n- H$ i, I" o- m$ i. J- b Total Memory: 125.7GiB
+ |# U, a0 |' V. w Name: compute01
$ h! ?+ O h8 e; E! V& F3 i% G ID: AFW3:TFZH:XZUS:OH53:CCMW:WWK5:54TT:7QUV:TWQB:D3YZ:34HT:467T6 k8 Z1 D' H( r4 ^7 G
Docker Root Dir: /var/lib/docker
: f; n y i& T8 b, `% l+ c* U Debug Mode: false
' C, W' X7 W# r# }. m HTTP Proxy: http://192.168.2.158:7890/
: l8 ^2 j( |/ ^/ }3 O HTTPS Proxy: http://192.168.2.158:7890// I) Y: B% A. H; M# N* C" k; q y0 Q
No Proxy: localhost,127.0.0.1,.example.com
, y) ~2 K$ l& a& D d; x. g; R/ _( i Registry: https://index.docker.io/v1/
" e% L4 d8 o0 a9 _! ^) u. t- | Labels:- x m6 A) N6 s3 K7 U
Experimental: false
3 T) J5 Y, W) m, C) R Insecure Registries:
" e. |) h) l3 N6 e! Q. Q5 x7 ~ 127.0.0.0/8
3 q. I/ I/ k! U! J) v8 s Live Restore Enabled: false& A: ]$ j% z6 F% r: c8 e4 ^
. p/ i' m% J+ J, q5 ]3 ~% K% M6 }3 ^1 [# [0 G7 \2 E
当不再使用时,我们需要取消这个代理:[root@compute01 ~]# cat /etc/systemd/system/docker.service.d/proxy.conf 4 E! y7 o/ {/ ^( Y5 k- ~( Q
#[Service]" n% E( G# E M- E+ ~, N" B
#Environment="HTTP_PROXY=http://192.168.2.158:7890/"
0 h% P- K+ v9 y: ]& z#Environment="HTTPS_PROXY=http://192.168.2.158:7890/"
8 ^1 l5 n7 F- Z3 \4 t#Environment="NO_PROXY=localhost,127.0.0.1,.example.com"( \4 H b: x8 \% y) l" X
$ t, L; [( o7 a重启docker服务:[root@compute01 ~]# systemctl daemon-reload systemctl restart docker.service
3 i! P w% k0 H6 n8 A' K- {' ?) W5 Z( P. p
[root@compute01 ~]# docker info 6 L! Z0 J- c8 q( r: T& d
Client:# ^% [0 v( \3 p1 |& G1 x# f
Context: default' v/ B# p4 w& @# G% y$ C3 ~
Debug Mode: false3 h# t" @1 q/ B$ U8 v5 _: h9 T
Plugins:' t1 P) Y( X4 x, }7 I- L5 `
app: Docker App (Docker Inc., v0.9.1-beta3)# C: q; m$ e& g( I
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
0 l, p& Y% n) M scan: Docker Scan (Docker Inc., v0.8.0)Server:
" G% H3 w# E& J# e0 C6 R" p Containers: 0
~( N; W8 I6 O1 S8 ?( i/ h Running: 0
3 d3 X& B+ ~( n2 r% Q Paused: 0
$ z% O5 i4 ]8 U" Y4 C- t8 X* H9 E Stopped: 0
: r( ~# I: X b! t$ f. |+ d Images: 0
: G; e7 X1 {; f2 u: L B Server Version: 20.10.7
7 _6 i/ N6 p( q. b( p Storage Driver: overlay2
& ~) ]! r$ r) u4 e; N/ H" M$ e Backing Filesystem: xfs2 F2 S; N/ H7 m' {7 _; {$ R" ~
Supports d_type: true% }1 K$ m/ C8 j
Native Overlay Diff: true
6 h4 p% g( o* O$ L7 o [ userxattr: false
+ G! e2 b/ H: |6 O& ^ p9 h& ` Logging Driver: json-file
7 X+ D7 M+ ?# k Cgroup Driver: cgroupfs1 B$ o. W* T7 n/ o! {
Cgroup Version: 1
& d, v: K1 B1 a3 D5 d7 f$ i9 d Plugins:
# o# X! F9 Y* S5 ]' L6 H# z Volume: local
6 c: L1 H$ a7 b/ d( Z9 @0 x Network: bridge host ipvlan macvlan null overlay
1 q7 \4 p$ D# k- _9 g Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog! ?+ g8 b3 ^+ u& @2 T
Swarm: inactive: a+ |4 H6 `* S; Z
Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux" ^& U% \- \. x, j( s
Default Runtime: runc
3 [# B5 E% j; E3 A8 G Init Binary: docker-init0 a4 ^% V. Z, u$ Y2 _
containerd version: 7eba5930496d9bbe375fdf71603e610ad737d2b2+ Z7 ]$ c$ y, k$ o" G7 U
runc version: v1.0.0-0-g84113ee5 y, ]+ h7 K' b9 o
init version: de40ad0" A# n" a# l; ]2 H6 g$ { g" \
Security Options:* g1 ^) V- n; `8 R( U8 \
seccomp! D; F; \- V! x: Z1 _
Profile: default
% T6 a1 h1 ?. u6 H Kernel Version: 3.10.0-1160.31.1.el7.x86_641 w- C( S# w3 s# E) t
Operating System: CentOS Linux 7 (Core)
1 ]0 w1 k, k& i3 p4 c) o7 s' H OSType: linux
, ^* m v& ], x5 M. A Architecture: x86_64- [# ?4 r3 E, {- [. @" g
CPUs: 32
3 ]3 Y3 e$ M# k5 `% E6 v3 S* M Total Memory: 125.7GiB
7 y, M( q2 f- m- B' K Name: compute01
& x8 r7 Y8 {- e8 f [" J ID: AFW3:TFZH:XZUS:OH53:CCMW:WWK5:54TT:7QUV:TWQB:D3YZ:34HT:467T
+ T0 v/ |. ^ L Docker Root Dir: /var/lib/docker
9 Z& S, n; u/ `: w5 o6 S9 a Debug Mode: false6 K, T5 |. S9 C9 O/ h- h, m2 A
Registry: https://index.docker.io/v1/ U5 L6 h! M( _4 I
Labels:. s d! a: @8 ]! {
Experimental: false
- U5 q, v' f! M' p Insecure Registries:' _: D4 @, s2 S i" y% B' I
127.0.0.0/8
9 f- {- Y" O; O6 @$ c1 u Live Restore Enabled: false
2 w1 @3 ~" m: U, T& d8 J$ z' o |
|