Docker是一个容器化平台,开发人员能够在容器内构建和部署应用。容器是隔离的环境,它将整个应用程序与其依赖项、库、配置文件以及使其运行所需的所有内容打包在一起,实现了跨平台。 步骤一、更新系统sudo apt update
$ k4 E1 `# O+ T$ D7 d' y步骤二、安装依赖sudo apt install apt-transport-https curl gnupg-agent ca-certificates software-properties-common -y7 x0 [8 j0 O: j$ N- R6 C. a Z
步骤三、在Ubuntu 22.04安装Docker CE(社区版)Docker CE是社区版,它是开源且免费的。
* L0 h& {; l0 b增加GPG密钥curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -增加docker官方储存库 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
0 s( S8 { n: ?安装docker cesudo apt install docker-ce docker-ce-cli containerd.io -y" b# D7 U$ ~* h4 V
步骤四、确认是否安装成功docker version管理Docker服务启动docker sudo systemctl start docker重启docker. R" C( q3 ~8 ~3 N( @8 \
sudo systemctl restart docker停止docker
3 k9 z9 |! Q# M9 {+ ? sudo systemctl stop docker让docker开机启动. a! e6 z$ j. ^+ @/ y
sudo systemctl enable docker禁用docker开机启动
4 g" v0 M" D. H& D' | sudo systemctl disable docker标签 : docker docker ce ubuntu
5 V+ f2 h1 b; r
5 C1 M! M* ]3 M2 C# O
( M2 A% {6 P6 V3 z0 m$ s1 Z$ Q3 @1 u( ~
Ubuntu 22.04安装Docker-ubuntu 22系统教程-热主机 (rezhuji.com)) \! r! M/ k, h- K ~8 d
$ t4 }6 r( z* x. @) w# P" [6 U4 b. N! ?8 C& v* k
如果您正在寻找一个开源且易于使用的Docker图形化管理。Portainer是一个很好的选择。
2 f! K$ Z8 X8 x- S8 A/ J a4 n6 M2 V3 K# u) C2 s# \% T
Portainer Community Edition 是一个完全免费、功能强大的开源管理工具集,可让您轻松构建、管理和维护 Docker 环境。它支持 Windows、Linux 和 Mac OS。
, g5 V! I0 F( `/ J/ ?+ l. S4 q9 n% L9 i5 l7 W4 |
这个视频讲的是如何在一台VPS上安装Portainer,让我们通过浏览器,以图形化界面管理docker容器,并且用Nginx Proxy Manager来给portainer添加SSL安全证书。
' b- q9 M( G; r5 J: x0 s. j$ R. g6 q0 @8 q, c
4 r. I8 k) J# {: q
1 O9 `# `# ~4 y) o7 `& f! [
- W D* A' k- g' K0 [5 C1. 安装DOCKER
7 n. A4 A/ l/ c
# r6 a9 T( j0 e1 M6 vsudo apt update
. w# w* ~9 G+ {* T; T0 p3 X, a6 e- X% E5 }2 _/ `8 L0 Q% j
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
" z& ~2 z/ ~6 N. O$ D1 t' v5 r: v! G5 }1 }: m5 b
curl -fsSL https://download.docker.com/linux/ubu... | sudo apt-key add -! S9 g" t5 i9 s' |- o7 c
: c, V4 A3 @, d2 k E% h4 \sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
. E* D1 W) ^! j; {0 V4 D- A: V9 c4 Z& ^, `: J
sudo apt update
) l% K6 e: J0 n- J4 m# J: q7 \* {
sudo apt-get install docker-ce docker-ce-cli containerd.io
9 v: Y" | c' l
4 e' X" i$ @2 i/ T1 M) D" X. wdocker --version
; `3 u4 a6 \8 g' `) _' j" h0 ]; z) S, D6 `
* T, o) z* I: } A+ X U9 F6 s2. 安装Docker-Compose: B! C4 |" k& I" z5 r* A% h( B; d
5 M! t7 g* r/ s) e1 Asudo curl -L "https://github.com/docker/compose/rel... -s https://api.github.com/repos/docker/c... | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
' a( @* V$ e9 U$ ^
' X0 c" `' K. d% d) c8 _: psudo chmod +x /usr/local/bin/docker-compose8 F* k& q4 p' ]' h' T8 m
; h. g* s% x; ~6 j' N7 B0 Q9 z. M* [docker-compose --version) l8 w7 Q5 y3 d% }
( W( ?5 J3 b, T4 C
3. 设置Portainer web管理Docker. K9 p+ Z: D( X& r% H) @
---建立一个Docker卷
. h+ g% B( f! @: |* t% g0 Ldocker volume create portainer_data5 t, q: t0 Y- v3 v2 s# }! r
0 X3 L9 ]7 ^# f& P* T4 f5 o# w+ G
---启用Portainer
( u/ g9 Y) G! ^' ]) l0 s) N8 edocker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
* [$ L& @1 u& ^& L& l8 |, v- B; ?8 Y+ Z# c+ i
|