Skip to content

Commit

Permalink
Docker安装&镜像加速
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeycode2024 committed Nov 15, 2024
1 parent 25775a3 commit fed8603
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/.vuepress/path/sidebar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ export default sidebar({
],
"/md/docker/": [
{text: "概述", prefix: "/md/docker/overview", link: "/md/docker/overview"},
{text: "安装", prefix: "/md/docker/install", link: "/md/docker/install"},
{text: "镜像加速器", prefix: "/md/docker/mirror-acceleration", link: "/md/docker/mirror-acceleration"},
],
});
29 changes: 29 additions & 0 deletions src/md/docker/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Docker安装
author: 会敲代码的程序猿
isOriginal: true
date: 2024-11-15
category: Docker
tag: Docker
---

# Docker安装&配置

## 多平台安装

安装软件这种基础的操作,直接 参考官方文档即可:

* [在Mac上安装Docker Desktop](https://docs.docker.com/desktop/setup/install/mac-install/)
* [在Windows上安装Docker Desktop](https://docs.docker.com/desktop/setup/install/windows-install/)
* [在Linux上安装Docker Desktop](https://docs.docker.com/desktop/setup/install/linux/)

验证是否安装成功:

```shell
$ docker version
$ docker info
$ docker hello-world
# 可能会遇到如下网络错误,需要配置国内镜像源
$ docker run -it ubuntu bash
docker: error pulling image configuration: download failed after attempts=6: EOF.
```
57 changes: 57 additions & 0 deletions src/md/docker/mirror-acceleration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Docker镜像加速器
author: 会敲代码的程序猿
isOriginal: true
date: 2024-11-16
category: Docker
tag: Docker
---

# Docker镜像加速器

## 镜像加速器

> [阿里云镜像加速器](https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors),有针对Ubuntu,CentOS,Mac,Windows的配置教程
**镜像源配置文件**

* Linux:`/etc/docker/daemon.json`
* Windows: `%USERPROFILE%\.docker\daemon.json`

**Windows配置:**

右上角选择Settings图标,打开配置窗口后选择Docker Engine。编辑JSON串,填写加速器地址:

```shell
{
"registry-mirrors": ["https://onnxqmp4.mirror.aliyuncs.com"]
}
```

![Windows配置镜像加速](http://img.geekyspace.cn/pictures/2024/202411160051539.png)

**完整的`daemon.json`配置示例:**

```shell
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"registry-mirrors": [
"https://onnxqmp4.mirror.aliyuncs.com",
"https://docker.hpcloud.cloud",
"https://docker.m.daocloud.io",
"https://docker.1panel.live",
"http://mirrors.ustc.edu.cn",
"https://docker.chenby.cn",
"https://docker.ckyl.me",
"http://mirror.azure.cn",
"https://hub.rat.dev"
]
}
```

4 changes: 4 additions & 0 deletions src/md/docker/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ tag: Docker
* **仓库(Registry)**:存储和分发镜像的地方,常用[Docker Hub](https://hub.docker.com/)或私有仓库。
* **Dockerfile**:定义镜像构建过程的配置文件。

## Docker 执行流程

![Docker执行流程](http://img.geekyspace.cn/pictures/2024/202411152359021.png)

## 历史的演化

1. 物理机时代:一个应用占用一整台服务器,资源浪费严重,扩展困难。
Expand Down

0 comments on commit fed8603

Please sign in to comment.