-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Box
authored and
Box
committed
Apr 4, 2020
1 parent
4631e48
commit 694dde1
Showing
3 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Centos安装docker | ||
|
||
## 安装前准备工作 | ||
|
||
* 一台正常联网的CentOS主机[虚拟机] | ||
* yum可以正常访问**互联网** | ||
|
||
## 卸载docker | ||
|
||
在安装docker之前,我们需要通过一下命令将本地以前安装的docker进行完整的删除。 | ||
|
||
```shell | ||
yum remove docker \ | ||
docker-client \ | ||
docker-client-latest \ | ||
docker-common \ | ||
docker-latest \ | ||
docker-latest-logrotate \ | ||
docker-logrotate \ | ||
docker-engine | ||
``` | ||
|
||
## 安装yum工具 | ||
|
||
docker需要使用yum提供的工具来下载文件,所以我们需提前安装好所有的工具。 | ||
|
||
```shell | ||
yum install -y yum-utils \ | ||
device-mapper-persistent-data \ | ||
lvm2 | ||
``` | ||
|
||
## 添加docker文件仓库 | ||
|
||
docker安装文件默认没有存放在yum官方仓库中,需要额外添加仓库路径。 | ||
|
||
```shell | ||
yum-config-manager \ | ||
--add-repo \ | ||
https://download.docker.com/linux/centos/docker-ce.repo | ||
``` | ||
|
||
## 开始安装 | ||
|
||
```shell | ||
yum install docker-ce docker-ce-cli containerd.io | ||
``` | ||
|
||
整个安装过程耗时可能比较长,这取决于yum的下载速度。 | ||
|
||
## 启动docker | ||
|
||
```shell | ||
systemctl start docker | ||
``` | ||
|
||
## 运行demo | ||
|
||
```shell | ||
docker run hello-world | ||
``` | ||
|
||
如果你遇到一下提示,请为docker设置代理,或使用第三方仓库(推荐) | ||
|
||
```shell | ||
Unable to find image 'hello-world:latest' locally | ||
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: net/http: request canceled (Client.Timeout exceeded while awaiting headers). | ||
See 'docker run --help'. | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## 配置http https代理 | ||
|
||
在使用GitHub时,由于国内网络对GitHub不太友好,经常在进行`clone`项目时速度特别慢,这时候我们就需要通过设置代理的方式来加速git的下载速度。 | ||
|
||
git配置代理有两种方式,一种是`全局代理`,一种是`针对指定地址`进行代理。 | ||
|
||
全局代理会将所有的网络请求转发到代理服务器,对于一些不需要经过代理的仓库请求,可能会拖慢速度。而针对链接地址的代理方式就不存在这种缺陷。 | ||
|
||
设置代理之前,你需要一台代理服务器,并且本地代理客户端可以正常访问代理服务器。 | ||
|
||
首先确认代理服务器使用的网络代理方式,主流的有`socks5`和`http`代理,记住正在使用的代理方式对应的端口,一下命令中需要使用。 | ||
|
||
### 1、配置全局代理 | ||
|
||
```shell | ||
# socks5协议,1080端口修改成自己的本地代理端口 | ||
git config --global http.proxy socks5://127.0.0.1:1080 | ||
git config --global https.proxy socks5://127.0.0.1:1080 | ||
|
||
# http协议,8001端口修改成自己的本地代理端口 | ||
git config --global http.proxy http://127.0.0.1:8001 | ||
git config --global https.proxy https://127.0.0.1:8001 | ||
``` | ||
|
||
### 2、局部代理 | ||
|
||
```shell | ||
# socks5协议,1080端口修改成自己的本地代理端口 | ||
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 | ||
git config --global https.https://github.com.proxy socks5://127.0.0.1:1080 | ||
|
||
# http协议,8001端口修改成自己的本地代理端口 | ||
git config --global http.https://github.com.proxy https://127.0.0.1:8001 | ||
git config --global https.https://github.com.proxy https://127.0.0.1:8001 | ||
``` | ||
|
||
### 3、重置代理 | ||
|
||
```shell | ||
git config --global --unset http.proxy | ||
git config --global --unset https.proxy | ||
``` | ||
|
Oops, something went wrong.