mirror of
https://github.com/yeasy/docker_practice.git
synced 2025-09-01 10:21:36 +00:00
Compare commits
16 Commits
1be1db5a43
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
3a9d4bff61 | ||
|
4bc29c0300 | ||
|
65bc905920 | ||
|
1b7d941fcd | ||
|
e0ff3d315a | ||
|
09de77b543 | ||
|
344fc8bd3c | ||
|
7ec5772432 | ||
|
355dd3b051 | ||
|
ca011164c2 | ||
|
0f2956a646 | ||
|
da7991660e | ||
|
391c6364a0 | ||
|
99433b2e45 | ||
|
32c6a91aa9 | ||
|
bea7b8d3f4 |
@@ -1,2 +1,2 @@
|
||||
Django>=2.0,<3.0
|
||||
Django>=5.0.6,<6.0
|
||||
psycopg2>=2.7,<3.0
|
||||
|
@@ -35,7 +35,8 @@ WORKDIR /go/src/github.com/go/helloworld/
|
||||
|
||||
COPY app.go .
|
||||
|
||||
RUN go get -d -v github.com/go-sql-driver/mysql \
|
||||
RUN go mod init helloworld \
|
||||
&& go get -d -v github.com/go-sql-driver/mysql \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . \
|
||||
&& cp /go/src/github.com/go/helloworld/app /root
|
||||
|
||||
|
@@ -65,7 +65,7 @@ $ echo \
|
||||
|
||||
```
|
||||
|
||||
>以上命令会添加稳定版本的 Docker APT 源,如果需要测试版本的 Docker 请将 stable 改为 test。
|
||||
>以上命令会添加稳定版本的 Docker APT 源,如果需要测试版本的 Docker 请将 stable 改为 test。 Debian11可能不使用`/etc/apt/keyrings/`, 如gpg错误可以考虑更换为`/etc/apt/trusted.gpg.d`, 见[issue 15727](https://github.com/docker/docs/issues/15727)。
|
||||
|
||||
### 安装 Docker
|
||||
|
||||
|
@@ -1,16 +1,16 @@
|
||||
# 镜像加速器
|
||||
|
||||
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。国内很多云服务商都提供了国内加速器服务,例如:
|
||||
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。~~国内很多云服务商都提供了国内加速器服务,例如:~~
|
||||
|
||||
* [阿里云加速器(点击管理控制台 -> 登录账号(淘宝账号) -> 左侧镜像工具 -> 镜像加速器 -> 复制加速器地址)](https://cr.console.aliyun.com/cn-hangzhou/instances)
|
||||
* [网易云加速器 `https://hub-mirror.c.163.com`](https://www.163yun.com/help/documents/56918246390157312)
|
||||
* [百度云加速器 `https://mirror.baidubce.com`](https://cloud.baidu.com/doc/CCE/s/Yjxppt74z#%E4%BD%BF%E7%94%A8dockerhub%E5%8A%A0%E9%80%9F%E5%99%A8)
|
||||
|
||||
**由于镜像服务可能出现宕机,建议同时配置多个镜像。各个镜像站测试结果请到 [docker-practice/docker-registry-cn-mirror-test](https://github.com/docker-practice/docker-registry-cn-mirror-test/actions) 查看。**
|
||||
|
||||
> 国内各大云服务商(腾讯云、阿里云、百度云)均提供了 Docker 镜像加速服务,建议根据运行 Docker 的云平台选择对应的镜像加速服务,具体请参考本页最后一小节。
|
||||
|
||||
本节我们以 [网易云](https://www.163yun.com/) 镜像服务 `https://hub-mirror.c.163.com` 为例进行介绍。
|
||||
本节我们以 [AtomHub 可信镜像中心](https://hub.atomgit.com/) 镜像服务 `https://hub.atomgit.com` 为例进行介绍。
|
||||
|
||||
> `hub.atomgit.com` 仅包含部分官方镜像,可以满足初学者的使用。
|
||||
|
||||
## Ubuntu 16.04+、Debian 8+、CentOS 7+
|
||||
|
||||
@@ -29,8 +29,7 @@ $ systemctl cat docker | grep '\-\-registry\-mirror'
|
||||
```json
|
||||
{
|
||||
"registry-mirrors": [
|
||||
"https://hub-mirror.c.163.com",
|
||||
"https://mirror.baidubce.com"
|
||||
"https://hub.atomgit.com"
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -46,13 +45,12 @@ $ sudo systemctl restart docker
|
||||
|
||||
## Windows 10
|
||||
|
||||
对于使用 `Windows 10` 的用户,在任务栏托盘 Docker 图标内右键菜单选择 `Settings`,打开配置窗口后在左侧导航菜单选择 `Docker Engine`,在右侧像下边一样编辑 json 文件,之后点击 `Apply & Restart` 保存后 Docker 就会重启并应用配置的镜像地址了。
|
||||
对于使用 `Windows 10` 的用户,在任务栏托盘 Docker 图标内右键菜单选择 `Change settings`,打开配置窗口后在左侧导航菜单选择 `Docker Engine`,在右侧像下边一样编辑 json 文件,之后点击 `Apply & Restart` 保存后 Docker 就会重启并应用配置的镜像地址了。
|
||||
|
||||
```json
|
||||
{
|
||||
"registry-mirrors": [
|
||||
"https://hub-mirror.c.163.com",
|
||||
"https://mirror.baidubce.com"
|
||||
"https://hub.atomgit.com"
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -64,8 +62,7 @@ $ sudo systemctl restart docker
|
||||
```json
|
||||
{
|
||||
"registry-mirrors": [
|
||||
"https://hub-mirror.c.163.com",
|
||||
"https://mirror.baidubce.com"
|
||||
"https://hub.atomgit.com"
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -76,7 +73,7 @@ $ sudo systemctl restart docker
|
||||
|
||||
```bash
|
||||
Registry Mirrors:
|
||||
https://hub-mirror.c.163.com/
|
||||
https://hub.atomgit.com/
|
||||
```
|
||||
|
||||
## `k8s.gcr.io` 镜像
|
||||
@@ -100,6 +97,8 @@ $ docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/xxx
|
||||
* https://dockerhub.azk8s.cn **已转为私有**
|
||||
* https://reg-mirror.qiniu.com
|
||||
* https://registry.docker-cn.com
|
||||
* https://hub-mirror.c.163.com
|
||||
* https://mirror.baidubce.com
|
||||
|
||||
建议 **watch(页面右上角)** [镜像测试](https://github.com/docker-practice/docker-registry-cn-mirror-test) 这个 GitHub 仓库,我们会在此更新各个镜像地址的状态。
|
||||
|
||||
|
@@ -9,6 +9,8 @@ Docker 不仅支持 `x86_64` 架构的计算机,同时也支持 `ARM` 架构
|
||||
Docker 支持以下版本的 [Raspberry Pi OS](https://www.raspberrypi.org/software/operating-systems/) 操作系统:
|
||||
|
||||
* Raspberry Pi OS Buster
|
||||
* Raspberry Pi OS Bullseye
|
||||
* Raspberry Pi OS Bookworm
|
||||
|
||||
*注:* `Raspberry Pi OS` 由树莓派的开发与维护机构 [树莓派基金会](https://www.raspberrypi.org/) 官方支持,并推荐用作树莓派的首选系统,其基于 `Debian`。
|
||||
|
||||
@@ -58,6 +60,33 @@ $ sudo add-apt-repository \
|
||||
|
||||
>以上命令会添加稳定版本的 Docker APT 源,如果需要测试版本的 Docker 请将 stable 改为 test。
|
||||
|
||||
#### 报错解决办法
|
||||
|
||||
在 `Raspberry Pi OS Bullseye/Bookworm` 中,添加 Docker 软件源的步骤可能会出现如下报错:
|
||||
|
||||
```bash
|
||||
Traceback (most recent call last):
|
||||
File "/usr/bin/add-apt-repository", line 95, in <module>
|
||||
sp = SoftwareProperties(options=options)
|
||||
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
|
||||
self.reload_sourceslist()
|
||||
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
|
||||
self.distro.get_sources(self.sourceslist)
|
||||
File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 91, in get_sources
|
||||
raise NoDistroTemplateException(
|
||||
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/bullseye
|
||||
```
|
||||
|
||||
通过以下命令手动添加镜像源到 `/etc/apt/sources.list` 文件中即可解决:
|
||||
|
||||
```bash
|
||||
$ sudo echo "deb [arch=armhf] https://mirrors.aliyun.com/docker-ce/linux/raspbian $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list
|
||||
|
||||
|
||||
# 官方源
|
||||
# $ sudo echo "deb [arch=armhf] https://download.docker.com/linux/raspbian $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list
|
||||
```
|
||||
|
||||
### 安装 Docker
|
||||
|
||||
更新 apt 软件包缓存,并安装 `docker-ce`。
|
||||
|
@@ -6,23 +6,31 @@
|
||||
|
||||
### 系统要求
|
||||
|
||||
Docker 支持以下版本的 [Ubuntu](https://ubuntu.com/server) 操作系统:
|
||||
Docker 支持诸多版本的 [Ubuntu](https://ubuntu.com/server) 操作系统。但是较旧的版本上将不会有Docker新版本的持续更新,以截至2024年中的几个 Ubuntu LTS(Long Term Support,长期支持)版本为例:
|
||||
|
||||
* Ubuntu Hirsute 21.04
|
||||
* Ubuntu Groovy 20.10
|
||||
* Ubuntu Focal 20.04 (LTS)
|
||||
* Ubuntu Bionic 18.04 (LTS)
|
||||
* Ubuntu Noble 24.04 (LTS),Docker v27.2.1
|
||||
* Ubuntu Jammy 22.04 (LTS), Docker v27.2.1
|
||||
* Ubuntu Focal 20.04 (LTS), Docker v27.2.1
|
||||
* Ubuntu Bionic 18.04 (LTS),Docker v24.0.2
|
||||
|
||||
Docker 可以安装在 64 位的 x86 平台或 ARM 平台上。Ubuntu 发行版中,LTS(Long-Term-Support)长期支持版本,会获得 5 年的升级维护支持,这样的版本会更稳定,因此在生产环境中推荐使用 LTS 版本。
|
||||
在 Ubuntu LTS 版本上,目前 Docker 支持 amd64、arm64、armhf、ppc64el、s390x 等 5 个平台;而非 LTS 版本支持的平台通常较少。同时,LTS 版本会获得 5 年的升级维护支持,这样的系统会获得更长期的安全保障,因此在生产环境中推荐使用 LTS 版本。
|
||||
|
||||
### 卸载旧版本
|
||||
|
||||
旧版本的 Docker 称为 `docker` 或者 `docker-engine`,使用以下命令卸载旧版本:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get remove docker \
|
||||
docker-engine \
|
||||
docker.io
|
||||
$ for pkg in docker \
|
||||
docker-engine \
|
||||
docker.io \
|
||||
docker-doc \
|
||||
docker-compose \
|
||||
podman-docker \
|
||||
containerd \
|
||||
runc;
|
||||
do
|
||||
sudo apt remove $pkg;
|
||||
done
|
||||
```
|
||||
|
||||
## 使用 APT 安装
|
||||
@@ -30,9 +38,9 @@ $ sudo apt-get remove docker \
|
||||
由于 `apt` 源使用 HTTPS 以确保软件下载过程中不被篡改。因此,我们首先需要添加使用 HTTPS 传输的软件包以及 CA 证书。
|
||||
|
||||
```bash
|
||||
$ sudo apt-get update
|
||||
$ sudo apt update
|
||||
|
||||
$ sudo apt-get install \
|
||||
$ sudo apt install \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
@@ -73,9 +81,9 @@ $ echo \
|
||||
更新 apt 软件包缓存,并安装 `docker-ce`:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get update
|
||||
$ sudo apt update
|
||||
|
||||
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
|
||||
$ sudo apt install docker-ce docker-ce-cli containerd.io
|
||||
```
|
||||
|
||||
## 使用脚本自动安装
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
来自 Docker 官网的这张图片形象的展示了集群中管理节点与工作节点的关系。
|
||||
|
||||

|
||||

|
||||
|
||||
## 服务和任务
|
||||
|
||||
@@ -32,4 +32,4 @@
|
||||
|
||||
来自 Docker 官网的这张图片形象的展示了容器、任务、服务的关系。
|
||||
|
||||

|
||||

|
||||
|
Reference in New Issue
Block a user