华强北电脑城 龙岗电子世界 龙华电脑城  凯尔电脑

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1416|回复: 2

Ubuntu 22.04安装Docker

[复制链接]
发表于 2022-5-21 19:17:06 | 显示全部楼层 |阅读模式
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 V
3 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
回复

使用道具 举报

 楼主| 发表于 2023-6-20 12:02:05 | 显示全部楼层
Hi there,  ]2 P, V6 w, A! j- n6 M
  ~, l8 @. w6 D
In addition to what has already been mentioned, alternatively, you could use the Docker convenience installation script by running the following:
6 m! H( P1 Y7 }$ j- }0 a8 {$ R( {) p' a
Download the script:* D# c& ~( W& \* K
curl -fsSL https://get.docker.com -o get-docker.sh3 ], k* \# J$ a3 c# E* x
Run the script:
! p9 i. Z& `" d2 Q" ?  j  Qsudo sh get-docker.sh
, m  e  ~) t/ D, Z# x8 z4 W3 x0 ?' [Hope that this helps.7 g! E  c; i) u9 ?, Z; j1 n- o
- G: D# I- H/ k3 b4 k5 Y1 ]) o) P
Best,
9 Z' k, N. ]4 D' A0 P9 Y+ |
3 s& S" }1 D+ g% M' ^) v! qBobby
回复 支持 反对

使用道具 举报

 楼主| 发表于 2023-6-20 14:19:38 | 显示全部楼层
# **如何在 Ubuntu 22.04 上安装Docker和Docker Compose | VPS | Cloud Web Server**
2 h8 l: W5 O" V% f1 X8 R3 S& `5 m8 k
如何在 Ubuntu 22.04 上安装Docker和Docker Compose | VPS | Cloud Web Server (notion.site)' e; w' K" N2 I9 o! D$ o8 F7 ]
; n# l) s6 j4 h7 t% C
Docker 是一个软件平台,用于开发基于容器(轻量级执行环境)的应用程序,这些应用程序具有独立共享操作系统内核的能力。 9 ~6 _5 Q6 h. K3 G, f( O. G3 e

5 g- u/ I; ?2 Q- x# ODocker Compose 是一个实用程序,它允许您基于 YAML 定义运行多容器应用程序设置。 它使用多个容器创建完全定制的环境,这些容器能够使用服务定义共享数据量和网络。3 N3 L0 |- t# H; I* t$ r  h

! v0 c2 F: d* q8 [5 m这个视频将演示在 Ubuntu 22.04 上安装Docker和Docker Compose 的方法。3 }: |0 f' K: @4 p! w

5 I# Q9 Y# @2 }% Z; O0 O% S$ M文字链接:3 t  ~3 h* H  }1 z0 w; O
  R# G7 G6 G( s
[https://updayday.notion.site/Ubu ... 039bc72024395c58547](https://www.notion.so/Ubuntu-22- ... 024395c58547?pvs=21)
5 g" l9 m  u& r) Y" ?# @
0 t: Y4 n( T: O1 n: U6 ^6 i3 M7 `Docker官网:
4 ]4 z: N4 j5 E: c  J1 ?' w! `# z) V) e# I; Z+ |. c9 c3 h7 a/ f7 Z
https://docs.docker.com/engine/install/ubuntu/! F( k8 [6 L8 X9 P* W3 @
3 X3 W3 t5 |5 x7 Y" d1 z
Music from Uppbeat (free for Creators!):
' P/ d. W# Z0 z3 G; U5 W; Ehttps://uppbeat.io/t/soundroll/colors
$ I6 b+ C* h# z( Z4 R3 GLicense code: ZHLPCR8LFXNWDKY5
. Y# Z, F  a4 i' }- z! x0 a& }: t. @& I* {+ L* F8 Y
[Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/)+ w1 z4 ]3 O  s4 Q% l. l8 S& r

$ g0 F) g& J3 e* t```bash3 J; L6 v, i! l5 V6 t
# 卸载旧版本
% o8 u4 `, E6 n0 q0 ~3 esudo apt-get remove docker docker-engine docker.io containerd runc
  E7 p- T0 h) u, D
& }3 U8 X6 @* E" E$ H. F# 设置 Docker 的存储库并从中安装,以便于安装和升级任务。这是推荐的方法。1 `( |6 K0 p, y5 O
# 设置存储库4 I" C6 c6 F/ v/ [9 J
# 1.更新apt包索引并安装包以允许apt通过 HTTPS 使用存储库:* p6 E( H. j" S/ c
sudo apt-get update
4 H* c7 @3 C& t9 F
) c5 [. o- W5 l3 Y2 Z' a: F2 Hsudo apt-get install \
1 I! |2 L5 R, z& h+ H. ?7 \: ]# C7 Q    ca-certificates \
& u' ?  d5 r9 A    curl \' Z; c; J% B3 K2 k0 k
    gnupg \' L3 b9 k1 |( E- ~/ `
    lsb-release
6 G5 p1 B1 P7 O& G+ L2 i
: E: ]2 g9 P$ s8 i, _3 M# 2.添加 Docker 的官方 GPG 密钥:
4 b! G6 D% m+ e; |! zsudo mkdir -p /etc/apt/keyrings% b, g/ Q" U4 S
' h/ K0 z4 _4 [- ~5 }
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
: d) q! `$ k1 k# [% ]/ X) i+ ]2 ?# I
# 3. 使用以下命令设置存储库:' r* J  s$ j& \5 p7 e, v
echo \" s: o+ ~9 n1 M& W9 |+ u: J
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
) |4 {3 A( n; }+ x$ ~  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ `& i# N( C/ U4 \```
( P) }. P3 ~* |5 r, q7 k: B" q4 s+ q6 R7 s' m4 e( ^9 J, K
```bash5 U, G  G% O) f; x' d% I! Y$ M- c1 _
# 安装 Docker 引擎5 V' K+ O0 b1 ^% k8 }+ c& \
# 更新apt包索引,安装最新版本的 Docker Engine、containerd 和 Docker Compose
7 o6 k! c6 a% V  P- asudo apt-get update
# D9 _$ T$ c; x' @
( [& H- D$ d! W+ Osudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin# g! c# r! H/ x

" S0 o4 J" h. l# 运行时收到 GPG 错误apt-get update?$ k' _4 n. Q# `' J2 o" `

+ B: S9 e& U2 Q2 X# b3 }# 您的默认 umask 可能设置不正确,导致无法检测到 repo 的公钥文件。运行以下命令,然后再次尝试更新您的存储库:sudo chmod a+r /etc/apt/keyrings/docker.gpg.2 b* E( X: ?4 t2 E
```
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|华强北 电脑城 龙岗电子世界 龙华电脑城 pc4g.com ( 粤ICP备16039863号 )

GMT+8, 2024-9-18 17:46 , Processed in 0.167298 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表