Merge branch 'master' into english

pull/421/head
Kang Huaishuai 2019-09-01 19:58:45 +08:00
commit 0699e96e36
69 changed files with 537 additions and 557 deletions

View File

@ -1,17 +1,15 @@
workspace: kind: pipeline
base: /srv/gitbook-src type: docker
path: . name: build
pipeline: steps:
build: - name: build
image: yeasy/docker_practice:latest image: yeasy/docker_practice:latest
# pull: true pull: if-not-exists # always never
environment: environment:
- TZ=Asia/Shanghai TZ: Asia/Shanghai
secrets: [key1, key2] commands:
commands: - docker-entrypoint.sh build
# - echo $${key1}
# - echo $KEY2 trigger:
- docker-entrypoint.sh build branch:
when: - master
event: [push, pull_request, tag, deployment]
branch: master

View File

@ -21,11 +21,11 @@ about: Create a report to help us improve
* [x] Others (Pls describe below) * [x] Others (Pls describe below)
### Docker Version ### Docker Version
<!-- Docker 18.09 Docker --> <!-- Docker 19.03 Docker -->
<!--if Docker version under 18.09, please upgrade Docker to 18.09--> <!--if Docker version under 19.03, please upgrade Docker to 19.03-->
* [x] Edge (v18.09) * [x] Edge (v19.03)
* [x] Stable (v18.09) * [x] Stable (v19.03)
* [x] 1.13.0 or Before * [x] 1.13.0 or Before
### Problem Description ### Problem Description

View File

@ -21,11 +21,11 @@ about: Create a issue about Docker
* [x] Others (Pls describe below) * [x] Others (Pls describe below)
### Docker Version ### Docker Version
<!-- Docker 18.09 Docker --> <!-- Docker 19.03 Docker -->
<!--if Docker version under 18.09, please upgrade Docker to 18.09--> <!--if Docker version under 19.03, please upgrade Docker to 19.03-->
* [x] Edge (v18.09) * [x] Edge (v19.03)
* [x] Stable (v18.09) * [x] Stable (v19.03)
* [x] 1.13.0 or Before * [x] 1.13.0 or Before
### Problem Description ### Problem Description

18
.github/workflows/ci.yaml vendored 100644
View File

@ -0,0 +1,18 @@
on:
push:
pull_request:
name: CI
jobs:
build:
name: Build GitBook
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 2
- name: Build
uses: docker://yeasy/docker_practice
with:
args: build

View File

@ -17,14 +17,20 @@ script:
after_success: after_success:
- sudo chmod -R 777 _book - sudo chmod -R 777 _book
- echo "FROM nginx:1.13.8-alpine" >> Dockerfile
- echo "FROM nginx:alpine" >> Dockerfile
- echo "COPY _book /usr/share/nginx/html" >> Dockerfile - echo "COPY _book /usr/share/nginx/html" >> Dockerfile
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker build -t dockerpracticecn/docker_practice:us-en .
- docker run -dit --rm -p 4000:80 dockerpracticecn/docker_practice:us-en - docker build -t dockerpracticesig/docker_practice:us-en .
- docker run -dit --rm -p 4000:80 dockerpracticesig/docker_practice:us-en
- sleep 5 - sleep 5
- curl 127.0.0.1:4000 - curl 127.0.0.1:4000
- docker push dockerpracticecn/docker_practice:us-en
- docker push dockerpracticesig/docker_practice:us-en
- cd _book - cd _book
- git init - git init
- git remote add origin "$REPO" - git remote add origin "$REPO"

View File

@ -1,4 +1,4 @@
FROM node:9-alpine FROM node:alpine
ENV TZ=Asia/Shanghai ENV TZ=Asia/Shanghai

View File

@ -11,7 +11,7 @@
"-livereload", "-livereload",
"image-captions", "image-captions",
"github", "github",
"page-treeview", "page-treeview@2.9.8",
"editlink" "editlink"
], ],
"pluginsConfig": { "pluginsConfig": {

View File

@ -6,12 +6,14 @@ if [ $1 = "sh" ];then sh ; exit 0; fi
rm -rf node_modules _book rm -rf node_modules _book
cp -a . ../gitbook srcDir=$PWD
cd ../gitbook cp -a . /srv/gitbook
cd /srv/gitbook
main(){ main(){
if [ "$1" = build ];then gitbook build; cp -a _book ../gitbook-src; echo $START; date "+%F %T"; exit 0; fi if [ "$1" = build ];then gitbook build && cp -a _book $srcDir && echo $START && date "+%F %T" && exit 0; fi
exec gitbook serve exec gitbook serve
exit 0 exit 0
} }

View File

@ -1,6 +1,7 @@
## ##
* 1.1.0 2019-06-30 * 1.1.0 2019-12-31
* v19.x
* `BuildKit` * `BuildKit`
* `docker manifest` 使 * `docker manifest` 使
* `Ubuntu 14.04` `Debian 8` `Debian 7` * `Ubuntu 14.04` `Debian 8` `Debian 7`

View File

@ -4,15 +4,22 @@
**v1.1.0** **v1.1.0**
| | | - |
| :------------- | :------------- | :--- |
| [zh-hans](https://github.com/yeasy/docker_practice) | [![](https://travis-ci.org/yeasy/docker_practice.svg?branch=master)](https://travis-ci.org/yeasy/docker_practice)| [阅读](https://docker_practice.gitee.io/) |
| [us-en](https://github.com/yeasy/docker_practice/tree/english) | [![](https://travis-ci.org/yeasy/docker_practice.svg?branch=english)](https://travis-ci.org/yeasy/docker_practice)| [阅读](https://docker_practice.gitee.io/us_en) |
| [zh-hant](https://github.com/yeasy/docker_practice/tree/zh-Hant) | [![](https://travis-ci.org/yeasy/docker_practice.svg?branch=zh-hant)](https://travis-ci.org/yeasy/docker_practice)| [阅读](https://docker_practice.gitee.io/zh_hant) |
[Docker](https://www.docker.com) 是个划时代的开源项目,它彻底释放了计算虚拟化的威力,极大提高了应用的维护效率,降低了云计算应用开发的成本!使用 Docker可以让应用的部署、测试和分发都变得前所未有的高效和轻松 [Docker](https://www.docker.com) 是个划时代的开源项目,它彻底释放了计算虚拟化的威力,极大提高了应用的维护效率,降低了云计算应用开发的成本!使用 Docker可以让应用的部署、测试和分发都变得前所未有的高效和轻松
Docker Docker
Linux Docker Docker 7 ~ 9 10 ~ 13 1415 Docker EtcdCoreOSKubernetesMesos使 Linux Docker Docker 7 ~ 9 10 ~ 13 1415 Docker EtcdCoreOSKubernetesMesos使
* 线[GitBook](https://yeasy.gitbooks.io/docker_practice/content/)[Github](https://github.com/yeasy/docker_practice/blob/master/SUMMARY.md)[国内镜像](https://github.com/yeasy/docker_practice/wiki/%E9%A1%B9%E7%9B%AE%E5%9B%BD%E5%86%85%E9%95%9C%E5%83%8F) * 线[GitBook](https://yeasy.gitbooks.io/docker_practice/content/)[Github](https://github.com/yeasy/docker_practice/blob/master/SUMMARY.md)[GitBook 国内镜像](https://docker_practice.gitee.io/)[GitBook 英文版国内镜像](https://docker_practice.gitee.io/us_en)[国内镜像](https://github.com/yeasy/docker_practice/wiki/%E9%A1%B9%E7%9B%AE%E5%9B%BD%E5%86%85%E9%95%9C%E5%83%8F)
* [pdf](https://github.com/yeasy/docker_practice/wiki/%E4%B8%8B%E8%BD%BD), [epub](https://github.com/yeasy/docker_practice/wiki/%E4%B8%8B%E8%BD%BD) * [pdf](https://github.com/yeasy/docker_practice/wiki/%E4%B8%8B%E8%BD%BD)[epub](https://github.com/yeasy/docker_practice/wiki/%E4%B8%8B%E8%BD%BD)
* [线](https://github.com/yeasy/docker_practice/wiki/%E7%A6%BB%E7%BA%BF%E9%98%85%E8%AF%BB%E5%8A%9F%E8%83%BD%E8%AF%A6%E8%A7%A3) * [线 `$ docker run -it --rm -p 4000:80 dockerpracticesig/docker_practice`](https://github.com/yeasy/docker_practice/wiki/%E7%A6%BB%E7%BA%BF%E9%98%85%E8%AF%BB%E5%8A%9F%E8%83%BD%E8%AF%A6%E8%A7%A3)
* [](https://github.com/yeasy/docker_practice/issues/363)
Docker 使 Docker [](CONTRIBUTING.md) Docker 使 Docker [](CONTRIBUTING.md)

View File

@ -144,8 +144,10 @@
* [CentOS Fedora](cases/os/centos.md) * [CentOS Fedora](cases/os/centos.md)
* [SUMMARY](cases/os/summary.md) * [SUMMARY](cases/os/summary.md)
* [CI/CD](cases/ci/README.md) * [CI/CD](cases/ci/README.md)
* [Drone](cases/ci/drone.md) * [GitHub Actions](cases/ci/actions/README.md)
* [Travis CI](cases/ci/travis.md) * [Drone](cases/ci/drone/README.md)
* [Install Drone](cases/ci/drone/install.md)
* [Travis CI](cases/ci/travis/README.md)
* [Docker Open Source](opensource/README.md) * [Docker Open Source](opensource/README.md)
* [LinuxKit](opensource/linuxkit.md) * [LinuxKit](opensource/linuxkit.md)
* [Appendix](appendix/README.md) * [Appendix](appendix/README.md)

View File

@ -4,7 +4,7 @@
[Nginx](https://en.wikipedia.org/wiki/Nginx) 是开源的高效的 Web 服务器实现,支持 HTTP、HTTPS、SMTP、POP3、IMAP 等协议。 [Nginx](https://en.wikipedia.org/wiki/Nginx) 是开源的高效的 Web 服务器实现,支持 HTTP、HTTPS、SMTP、POP3、IMAP 等协议。
`https://hub.docker.com/_/nginx/` Nginx 1.0 ~ 1.15.x `https://hub.docker.com/_/nginx/` Nginx 1.0 ~ 1.17.x
### 使 ### 使

View File

@ -4,7 +4,7 @@
[Node.js](https://en.wikipedia.org/wiki/Node.js) 是基于 JavaScript 的可扩展服务端和网络软件开发平台。 [Node.js](https://en.wikipedia.org/wiki/Node.js) 是基于 JavaScript 的可扩展服务端和网络软件开发平台。
`https://hub.docker.com/_/node/` Node.js 0.10 ~ 11.x `https://hub.docker.com/_/node/` Node.js 0.10 ~ 12.x
### 使 ### 使

View File

@ -4,7 +4,7 @@
[Ubuntu](https://en.wikipedia.org/wiki/Ubuntu) 是流行的 Linux 发行版,其自带软件版本往往较新一些。 [Ubuntu](https://en.wikipedia.org/wiki/Ubuntu) 是流行的 Linux 发行版,其自带软件版本往往较新一些。
`https://hub.docker.com/_/ubuntu/` Ubuntu 12.04 ~ 18.04 `https://hub.docker.com/_/ubuntu/` Ubuntu 12.04 ~ 19.04
### 使 ### 使

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

View File

@ -0,0 +1,28 @@
# GitHub Actions
GitGub Actions GitHub CI/CD
job step 使 Docker
```yaml
on: push
name: CI
jobs:
my-job:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 2
- name: run docker container
uses: docker://golang:alpine
with:
args: go version
```
##
* [Actions Docs](https://help.github.com/en/categories/automating-your-workflow-with-github-actions)

View File

@ -1,17 +0,0 @@
workspace:
base: /srv/drone-demo
path: .
pipeline:
build:
image: golang:alpine
# pull: true
environment:
- KEY=VALUE
secrets: [key1, key2]
commands:
# - echo $$KEY
- pwd
- ls
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
- ./app

View File

@ -1,35 +0,0 @@
version: '3'
services:
drone-server:
image: drone/drone:0.8-alpine
ports:
- 443:443
# - "${PRO_PUBLIC_IP}:8000:8000"
volumes:
- drone-data:/var/lib/drone/:rw
# - ${SSL_PATH}:/etc/certs
restart: always
environment:
- DRONE_SECRET=drone
- DRONE_OPEN=false
- DRONE_ADMIN=GITHUB_SERNAME
- DRONE_HOST=https://drone.yeasy.com
- DRONE_GITHUB=true
- DRONE_GITHUB_CLIENT=${DRONE_GITHUB_CLIENT_PRO}
- DRONE_GITHUB_SECRET=${DRONE_GITHUB_SECRET_PRO}
drone-agent:
image: drone/agent:0.8-alpine
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
- DRONE_SECRET=drone
- DRONE_SERVER=drone-server:9000
dns: 114.114.114.114
volumes:
drone-data:

View File

@ -1,183 +0,0 @@
## Drone
`Docker` `CI/CD` `Drone` `Docker`
`.drone.yml` git `Drone`
`GitHub` + `Drone` `Drone` GitHub 使 `Gogs` + `Drone` `CI/CD`
###
* IP (使 Gogs + Drone)
* SSL ()
* `Docker` `Docker Compose`
* `Git`
* `CI/CD`
### GitHub
GitHub https://github.com/settings/applications/new 新建一个应用。
![](../.image/drone-github.png)
`Client ID` `Client Secret` Drone
### Drone
使 `Docker Compose` `Drone` `docker-compose.yml`
```yaml
version: '3'
services:
drone-server:
image: drone/drone:0.8-alpine
ports:
- 443:443
# - "${PRO_PUBLIC_IP}:8000:8000"
volumes:
- drone-data:/var/lib/drone/:rw
- ${SSL_PATH}:/etc/certs:rw
restart: always
environment:
- DRONE_SECRET=drone
- DRONE_OPEN=false
- DRONE_ADMIN=${GITHUB_SERNAME}
- DRONE_HOST=${DRONE_HOST}
- DRONE_GITHUB=true
- DRONE_GITHUB_CLIENT=${DRONE_GITHUB_CLIENT}
- DRONE_GITHUB_SECRET=${DRONE_GITHUB_SECRET}
- DRONE_SERVER_CERT=/etc/certs/drone.domain.com.crt
- DRONE_SERVER_KEY=/etc/certs/drone.domain.com.key
drone-agent:
image: drone/agent:0.8-alpine
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
- DRONE_SECRET=drone
- DRONE_SERVER=drone-server:9000
dns: 114.114.114.114
volumes:
drone-data:
```
`${SSL_PATH}` SSL
`${GITHUB_SERNAME}` GitHub Drone
`${DRONE_HOST}` Drone
`${DRONE_GITHUB_CLIENT}` GitHub `Client ID`
`${DRONE_GITHUB_SECRET}` GitHub `Client Secret`
** `443` Nginx
#### Drone
```bash
$ docker-compose up -d
```
### Drone
Github `drone-demo`
Drone 使 GitHub `drone-demo`
###
git
```bash
$ mkdir drone-demo
$ cd drone-demo
$ git init
$ git remote add origin git@github.com:username/drone-demo.git
```
`Go` `Hello World!`
`app.go`
```go
package main
import "fmt"
func main(){
fmt.Printf("Hello World!");
}
```
`.drone.yml`
```yaml
workspace:
base: /srv/drone-demo
path: .
pipeline:
build:
image: golang:alpine
# pull: true
environment:
- KEY=VALUE
secrets: [key1, key2]
commands:
- echo $$KEY
- pwd
- ls
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
- ./app
```
`workspace` git git golang `/srv/drone-demo`
`pipeline` Docker
```bash
.
.drone.yml
app.go
```
### GitHub
```bash
$ git add .
$ git commit -m "test drone ci"
$ git push origin master
```
###
`Drone`
![](../.image/drone-build.png)
GitHubDocker Registry
GitBook 使 Drone CI/CD [`.drone.yml`](https://github.com/yeasy/docker_practice/blob/master/.drone.yml) 文件。
##
* [Drone Github](https://github.com/drone/drone)
* [Drone ](http://docs.drone.io/)

View File

@ -0,0 +1,6 @@
DRONE_SERVER_HOST=
DRONE_SERVER_PROTO=
DRONE_RPC_SECRET=
HOSTNAME=
DRONE_GITHUB_CLIENT_ID=
DRONE_GITHUB_CLIENT_SECRET=

2
cases/ci/drone/.gitignore vendored 100644
View File

@ -0,0 +1,2 @@
.env
ssl/*

View File

@ -0,0 +1,99 @@
# Drone
`Docker` `CI/CD` `Drone` `Docker`
`.drone.yml` git `Drone`
`GitHub` + `Drone` `Drone` GitHub 使 `Gogs` + `Drone` `CI/CD`
## Drone
Github `drone-demo`
[ Drone ](install.md) [Drone Cloud](https://cloud.drone.io),使用 GitHub 账号登录,在界面中关联刚刚新建的 `drone-demo` 仓库。
##
git
```bash
$ mkdir drone-demo
$ cd drone-demo
$ git init
$ git remote add origin git@github.com:username/drone-demo.git
```
`Go` `Hello World!`
`app.go`
```go
package main
import "fmt"
func main(){
fmt.Printf("Hello World!\n");
}
```
`.drone.yml`
```yaml
kind: pipeline
type: docker
name: build
steps:
- name: build
image: golang:alpine
pull: if-not-exists # always never
environment:
KEY: VALUE
commands:
- echo $KEY
- pwd
- ls
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
- ./app
trigger:
branch:
- master
```
```bash
.
.drone.yml
app.go
```
## GitHub
```bash
$ git add .
$ git commit -m "test drone ci"
$ git push origin master
```
##
`Drone` Drone Cloud
![](../.image/drone-build.png)
GitHubDocker Registry
GitBook 使 Drone CI/CD [`.drone.yml`](https://github.com/yeasy/docker_practice/blob/master/.drone.yml) 文件。
##
* [Drone Github](https://github.com/drone/drone)
* [Drone ](http://docs.drone.io/)
* [Drone ](https://github.com/docker-practice/drone-demo)

View File

@ -0,0 +1,19 @@
kind: pipeline
type: docker
name: build
steps:
- name: build
image: golang:alpine
pull: if-not-exists # always never
environment:
KEY: VALUE
commands:
- echo $KEY
- pwd
- ls
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
- ./app
trigger:
branch:
- master

View File

@ -0,0 +1 @@
# Drone Demo

View File

@ -3,5 +3,5 @@ package main
import "fmt" import "fmt"
func main(){ func main(){
fmt.Printf("Hello World!"); fmt.Printf("Hello World!\n");
} }

View File

@ -0,0 +1,39 @@
version: '3'
services:
drone-server:
image: drone/drone:1
ports:
- 443:443
- 80:80
volumes:
- drone-data:/data:rw
- ./ssl:/etc/certs
restart: always
environment:
- DRONE_AGENTS_ENABLED=true
- DRONE_SERVER_HOST=${DRONE_SERVER_HOST:-drone.domain.com}
- DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO:-https}
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET:-secret}
- DRONE_GITHUB_SERVER=https://github.com
- DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID}
- DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_SECRET}
drone-agent:
image: drone/agent:1
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
- DRONE_RPC_PROTO=http
- DRONE_RPC_HOST=drone-server
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET:-secret}
- DRONE_RUNNER_NAME=${HOSTNAME:-demo}
- DRONE_RUNNER_CAPACITY=2
dns: 114.114.114.114
volumes:
drone-data:

View File

@ -0,0 +1,87 @@
# Drone
##
* IP (使 Gogs + Drone)
* SSL ()
* `Docker` `Docker Compose`
* `Git`
* `CI/CD`
## GitHub
GitHub https://github.com/settings/applications/new 新建一个应用。
![](https://docs.drone.io/screenshots/github_application_create.png)
`Client ID` `Client Secret` Drone
## Drone
使 `Docker Compose` `Drone` `docker-compose.yml`
```yaml
version: '3'
services:
drone-server:
image: drone/drone:1
ports:
- 443:443
- 80:80
volumes:
- drone-data:/data:rw
- ./ssl:/etc/certs
restart: always
environment:
- DRONE_AGENTS_ENABLED=true
- DRONE_SERVER_HOST=${DRONE_SERVER_HOST:-https://drone.yeasy.com}
- DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO:-https}
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET:-secret}
- DRONE_GITHUB_SERVER=https://github.com
- DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID}
- DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_SECRET}
drone-agent:
image: drone/agent:1
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
- DRONE_RPC_PROTO=http
- DRONE_RPC_HOST=drone-server
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET:-secret}
- DRONE_RUNNER_NAME=${HOSTNAME:-demo}
- DRONE_RUNNER_CAPACITY=2
dns: 114.114.114.114
volumes:
drone-data:
```
`.env`
```bash
# drone.domain.com
DRONE_SERVER_HOST=
DRONE_SERVER_PROTO=https
DRONE_RPC_SECRET=secret
HOSTNAME=demo
# GitHub
DRONE_GITHUB_CLIENT_ID=
# GitHub
DRONE_GITHUB_CLIENT_SECRET=
```
### Drone
```bash
$ docker-compose up -d
```

View File

@ -1,6 +1,7 @@
## Compose ## Compose
### ###
Compose Compose
`docker-compose [COMMAND] --help` `docker-compose help [COMMAND]` 使 `docker-compose [COMMAND] --help` `docker-compose help [COMMAND]` 使
@ -66,6 +67,7 @@ docker-compose [-f=<arg>...] [options] [COMMAND] [ARGS...]
Compose Compose
#### `kill` #### `kill`
`docker-compose kill [options] [SERVICE...]` `docker-compose kill [options] [SERVICE...]`
`SIGKILL` `SIGKILL`
@ -77,6 +79,7 @@ $ docker-compose kill -s SIGINT
``` ```
#### `logs` #### `logs`
`docker-compose logs [options] [SERVICE...]` `docker-compose logs [options] [SERVICE...]`
docker-compose 使 `--no-color` docker-compose 使 `--no-color`
@ -84,11 +87,13 @@ $ docker-compose kill -s SIGINT
#### `pause` #### `pause`
`docker-compose pause [SERVICE...]` `docker-compose pause [SERVICE...]`
#### `port` #### `port`
`docker-compose port [options] SERVICE PRIVATE_PORT` `docker-compose port [options] SERVICE PRIVATE_PORT`
@ -100,6 +105,7 @@ $ docker-compose kill -s SIGINT
* `--index=index` 1 * `--index=index` 1
#### `ps` #### `ps`
`docker-compose ps [options] [SERVICE...]` `docker-compose ps [options] [SERVICE...]`
@ -109,6 +115,7 @@ $ docker-compose kill -s SIGINT
* `-q` ID * `-q` ID
#### `pull` #### `pull`
`docker-compose pull [options] [SERVICE...]` `docker-compose pull [options] [SERVICE...]`
@ -122,6 +129,7 @@ $ docker-compose kill -s SIGINT
Docker Docker
#### `restart` #### `restart`
`docker-compose restart [options] [SERVICE...]` `docker-compose restart [options] [SERVICE...]`
@ -131,6 +139,7 @@ $ docker-compose kill -s SIGINT
* `-t, --timeout TIMEOUT` 10 * `-t, --timeout TIMEOUT` 10
#### `rm` #### `rm`
`docker-compose rm [options] [SERVICE...]` `docker-compose rm [options] [SERVICE...]`
`docker-compose stop` `docker-compose stop`
@ -195,6 +204,7 @@ $ docker-compose run --no-deps web python manage.py shell
* `-T` tty tty * `-T` tty tty
#### `scale` #### `scale`
`docker-compose scale [options] [SERVICE=NUM...]` `docker-compose scale [options] [SERVICE=NUM...]`
@ -214,11 +224,13 @@ $ docker-compose scale web=3 db=2
* `-t, --timeout TIMEOUT` 10 * `-t, --timeout TIMEOUT` 10
#### `start` #### `start`
`docker-compose start [SERVICE...]` `docker-compose start [SERVICE...]`
#### `stop` #### `stop`
`docker-compose stop [options] [SERVICE...]` `docker-compose stop [options] [SERVICE...]`
`docker-compose start` `docker-compose start`
@ -232,11 +244,13 @@ $ docker-compose scale web=3 db=2
#### `unpause` #### `unpause`
`docker-compose unpause [SERVICE...]` `docker-compose unpause [SERVICE...]`
#### `up` #### `up`
`docker-compose up [options] [SERVICE...]` `docker-compose up [options] [SERVICE...]`
@ -270,6 +284,11 @@ $ docker-compose scale web=3 db=2
* `-t, --timeout TIMEOUT` 10 * `-t, --timeout TIMEOUT` 10
#### `version` #### `version`
`docker-compose version` `docker-compose version`
###
* [](https://docs.docker.com/compose/reference/overview/)

View File

@ -18,7 +18,7 @@ services:
`image` `build` Dockerfile `image` `build` Dockerfile
使 `build` `Dockerfile` (`CMD`, `EXPOSE`, `VOLUME`, `ENV` ) `docker-compose.yml` 使 `build` `Dockerfile` (`CMD`, `EXPOSE`, `VOLUME`, `ENV` ) `docker-compose.yml`
@ -460,7 +460,7 @@ sysctls:
### `volumes` ### `volumes`
宿 `HOST:CONTAINER` 访 `HOST:CONTAINER:ro` 宿(`HOST:CONTAINER`)(`VOLUME:CONTAINER`)访 `HOST:CONTAINER:ro`
@ -471,6 +471,21 @@ volumes:
- ~/configs:/etc/configs/:ro - ~/configs:/etc/configs/:ro
``` ```
```yaml
version: "3"
services:
my_src:
image: mysql:8.0
volumes:
- mysql_data:/var/lib/mysql
volumes:
mysql_data:
```
### ###
`domainname, entrypoint, hostname, ipc, mac_address, privileged, read_only, shm_size, restart, stdin_open, tty, user, working_dir` `docker run` `domainname, entrypoint, hostname, ipc, mac_address, privileged, read_only, shm_size, restart, stdin_open, tty, user, working_dir` `docker run`
@ -557,3 +572,7 @@ MONGO_VERSION=3.6
``` ```
`docker-compose up` `mongo:3.6` `docker-compose up` `mongo:3.6`
###
* [](https://docs.docker.com/compose/compose-file/)

View File

@ -1 +1,2 @@
django_example django_example
manage.py

View File

@ -6,7 +6,7 @@ services:
web: web:
build: . build: .
command: python3 manage.py runserver 0.0.0.0:8000 command: python manage.py runserver 0.0.0.0:8000
volumes: volumes:
- .:/code - .:/code
ports: ports:

View File

@ -1,22 +0,0 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_example.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)

View File

@ -1,2 +1,2 @@
Django>=1.8,<2.0 Django>=2.0,<3.0
psycopg2 psycopg2>=2.7,<3.0

View File

@ -2,7 +2,11 @@ version: "3"
services: services:
db: db:
image: mysql:5.7 image: mysql:8.0
command:
- --default_authentication_plugin=mysql_native_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
volumes: volumes:
- db_data:/var/lib/mysql - db_data:/var/lib/mysql
restart: always restart: always

View File

@ -13,18 +13,18 @@ FROM python:3
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
RUN mkdir /code RUN mkdir /code
WORKDIR /code WORKDIR /code
ADD requirements.txt /code/ COPY requirements.txt /code/
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
ADD . /code/ COPY . /code/
``` ```
使 Python `Dockerfile` [](../image/create.md# Dockerfile ) [ Dockerfile 使](../dockerfile/README.md) 使 Python `Dockerfile` [ Dockerfile 使](../image/dockerfile/README.md)
`requirements.txt` `requirements.txt`
```bash ```bash
Django>=1.8,<2.0 Django>=2.0,<3.0
psycopg2 psycopg2>=2.7,<3.0
``` ```
`docker-compose.yml` 西 web 使 Docker `docker-compose.yml` 西 web 使 Docker
@ -38,7 +38,7 @@ services:
web: web:
build: . build: .
command: python3 manage.py runserver 0.0.0.0:8000 command: python manage.py runserver 0.0.0.0:8000
volumes: volumes:
- .:/code - .:/code
ports: ports:
@ -47,15 +47,15 @@ services:
- db - db
``` ```
[`docker-compose.yml` ](yml_ref.md) [`docker-compose.yml` ](compose_file.md)
使 `docker-compose run` `Django` 使 `docker-compose run` `Django`
```bash ```bash
$ docker-compose run web django-admin.py startproject django_example . $ docker-compose run web django-admin startproject django_example .
``` ```
Compose 使 `Dockerfile` web 使 `django-admin.py startproject django_example` web 使 Compose 使 `Dockerfile` web 使 `django-admin startproject django_example`
`Django` `Django`
@ -67,7 +67,7 @@ Dockerfile docker-compose.yml django_example manage.py
Linux, Linux,
```bash ```bash
sudo chown -R $USER:$USER . $ sudo chown -R $USER:$USER .
``` ```
`django_example/settings.py` `DATABASES = ...` `django_example/settings.py` `DATABASES = ...`

View File

@ -4,14 +4,12 @@
`Compose` Python `pip` 使 Docker `Compose` Python `pip` 使 Docker
使 `Docker Desktop for Mac/Windows` `docker-compose` Docker 使
`Docker for Mac` `Docker for Windows` `docker-compose` Docker 使
```bash ```bash
$ docker-compose --version $ docker-compose --version
docker-compose version 1.17.1, build 6d101fb docker-compose version 1.24.1, build 4667896b
``` ```
Linux 使 Linux 使
@ -23,7 +21,8 @@ Linux 系统请使用以下介绍的方法安装。
Linux 64 Linux 64
```bash ```bash
$ sudo curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose $ sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose
``` ```
@ -43,7 +42,7 @@ $ sudo pip install -U docker-compose
```bash ```bash
Collecting docker-compose Collecting docker-compose
Downloading docker-compose-1.17.1.tar.gz (149kB): 149kB downloaded Downloading docker-compose-1.24.1.tar.gz (149kB): 149kB downloaded
... ...
Successfully installed docker-compose cached-property requests texttable websocket-client docker-py dockerpty six enum34 backports.ssl-match-hostname ipaddress Successfully installed docker-compose cached-property requests texttable websocket-client docker-py dockerpty six enum34 backports.ssl-match-hostname ipaddress
``` ```
@ -51,66 +50,9 @@ Successfully installed docker-compose cached-property requests texttable websock
### bash ### bash
```bash ```bash
$ curl -L https://raw.githubusercontent.com/docker/compose/1.8.0/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose $ curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
``` ```
###
Compose Python
```bash
$ curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
```
`run.sh`
```bash
set -e
VERSION="1.8.0"
IMAGE="docker/compose:$VERSION"
# Setup options for connecting to docker host
if [ -z "$DOCKER_HOST" ]; then
DOCKER_HOST="/var/run/docker.sock"
fi
if [ -S "$DOCKER_HOST" ]; then
DOCKER_ADDR="-v $DOCKER_HOST:$DOCKER_HOST -e DOCKER_HOST"
else
DOCKER_ADDR="-e DOCKER_HOST -e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH"
fi
# Setup volume mounts for compose config and context
if [ "$(pwd)" != '/' ]; then
VOLUMES="-v $(pwd):$(pwd)"
fi
if [ -n "$COMPOSE_FILE" ]; then
compose_dir=$(dirname $COMPOSE_FILE)
fi
# TODO: also check --file argument
if [ -n "$compose_dir" ]; then
VOLUMES="$VOLUMES -v $compose_dir:$compose_dir"
fi
if [ -n "$HOME" ]; then
VOLUMES="$VOLUMES -v $HOME:$HOME -v $HOME:/root" # mount $HOME in /root to share docker.config
fi
# Only allocate tty if we detect one
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-t"
fi
if [ -t 0 ]; then
DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS -i"
fi
exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w "$(pwd)" $IMAGE "$@"
```
`docker/compose`
### ###

View File

@ -17,13 +17,16 @@ ADD Gemfile /myapp/Gemfile
RUN bundle install RUN bundle install
ADD . /myapp ADD . /myapp
``` ```
使 RubyBundler Dockerfile [](../image/create.md# Dockerfile ) [Dockerfile 使](../dockerfile/README.md)
使 RubyBundler Dockerfile [Dockerfile 使](../image/dockerfile/README.md)
Rails `Gemfile` `rails new` Rails `Gemfile` `rails new`
```bash ```bash
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '4.0.2' gem 'rails', '4.0.2'
``` ```
`docker-compose.yml` `docker-compose.yml` 西 web 使 PostgreSQL web `docker-compose.yml` `docker-compose.yml` 西 web 使 PostgreSQL web
```yaml ```yaml
@ -45,11 +48,13 @@ services:
links: links:
- db - db
``` ```
使 `docker-compose run` 使 `docker-compose run`
```bash ```bash
$ docker-compose run web rails new . --force --database=postgresql --skip-bundle $ docker-compose run web rails new . --force --database=postgresql --skip-bundle
``` ```
`Compose` 使 `Dockerfile` web 使 `rails new ` `Compose` 使 `Dockerfile` web 使 `rails new `
```bash ```bash
@ -60,16 +65,19 @@ Gemfile.lock condocker-compose log
README.rdoc condocker-compose.ru public README.rdoc condocker-compose.ru public
Rakefile db test Rakefile db test
``` ```
`Gemfile` `therubyracer` 便使 Javascript `Gemfile` `therubyracer` 便使 Javascript
```bash ```bash
gem 'therubyracer', platforms: :ruby gem 'therubyracer', platforms: :ruby
``` ```
`Gemfile` Dockerfile `Gemfile` Dockerfile
```bash ```bash
$ docker-compose build $ docker-compose build
``` ```
Rails `localhost` `db` postgres Rails `localhost` `db` postgres
`database.yml` `database.yml`
@ -87,11 +95,13 @@ test:
<<: *default <<: *default
database: myapp_test database: myapp_test
``` ```
```bash ```bash
$ docker-compose up $ docker-compose up
``` ```
PostgreSQL PostgreSQL
```bash ```bash
@ -99,11 +109,13 @@ myapp_web_1 | [2014-01-17 17:16:29] INFO WEBrick 1.3.1
myapp_web_1 | [2014-01-17 17:16:29] INFO ruby 2.0.0 (2013-11-22) [x86_64-linux-gnu] myapp_web_1 | [2014-01-17 17:16:29] INFO ruby 2.0.0 (2013-11-22) [x86_64-linux-gnu]
myapp_web_1 | [2014-01-17 17:16:29] INFO WEBrick::HTTPServer#start: pid=1 port=3000 myapp_web_1 | [2014-01-17 17:16:29] INFO WEBrick::HTTPServer#start: pid=1 port=3000
``` ```
```bash ```bash
$ docker-compose run web rake db:create $ docker-compose run web rake db:create
``` ```
web docker 3000 web docker 3000
![](../_images/docker-compose-rails-screenshot.png) ![](../_images/docker-compose-rails-screenshot.png)

View File

@ -17,7 +17,11 @@ version: "3"
services: services:
db: db:
image: mysql:5.7 image: mysql:8.0
command:
- --default_authentication_plugin=mysql_native_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
volumes: volumes:
- db_data:/var/lib/mysql - db_data:/var/lib/mysql
restart: always restart: always

View File

@ -4,4 +4,4 @@ CoreOS 的设计是为你提供能够像谷歌一样的大型互联网公司一
CoreOS , Linux 使 Linux YUM APT CoreOS , Linux 使 Linux YUM APT
CoreOS VirtualBox, Amazon EC2, QEMU/KVM, VMware OpenStack 使 CoreOS `VirtualBox`, `Amazon EC2`, `QEMU/KVM`, `VMware` `OpenStack`

View File

@ -1,8 +1,6 @@
# CoreOS # CoreOS
Docker [CoreOS](https://coreos.com/). [CoreOS](https://coreos.com/) 对 Docker 甚至容器技术的发展都带来了巨大的推动作用。其提供了运行现代基础设施的特性,支持大规模服务部署,使得在基于最小化的现代操作系统上构建规模化的计算仓库成为了可能。
CoreOS Docker 使
# CoreOS # CoreOS
@ -30,4 +28,4 @@ CoreOS 可以在一个机器上很好地运行,但是它被设计用来搭建
## ##
CoreOS

View File

@ -6,13 +6,6 @@
`CoreOS` 使 `etcd` `CoreOS` `etcd` `rkt` `CoreOS` 使 `etcd` `CoreOS` `etcd` `rkt`
```bash
$ rkt list
UUID APP IMAGE NAME STATE CREATED STARTED NETWORKS
57581644 etcd quay.io/coreos/etcd:v3.2.10 running 1 minute ago 1 minute ago
```
`etcd` 使 [etcd ](../etcd/) `etcd` 使 [etcd ](../etcd/)
## ##

View File

@ -1,85 +0,0 @@
# CoreOS
使 Vagrant
*Vagrant 使*
CoreOS CoreOS
##
Virtualbox, Vagrant git
##
CoreOS
```bash
$ git clone https://github.com/coreos/coreos-vagrant
$ cd coreos-vagrant
$ cp user-data.sample user-data
```
token
```bash
$ curl https://discovery.etcd.io/new
```
token user-data
```yml
#cloud-config
coreos:
etcd:
discovery: https://discovery.etcd.io/<token>
```
##
CoreOS Vagrantfile
config.rb.sample .
```bash
cp config.rb.sample config.rb
```
num_instances3
```bash
vagrant up
=>
Bringing machine 'core-01' up with 'virtualbox' provider...
Bringing machine 'core-02' up with 'virtualbox' provider...
Bringing machine 'core-03' up with 'virtualbox' provider...
==> core-01: Box 'coreos-alpha' could not be found. Attempting to find and install...
core-01: Box Provider: virtualbox
core-01: Box Version: >= 0
==> core-01: Adding box 'coreos-alpha' (v0) for provider: virtualbox
core-01: Downloading: http://storage.core-os.net/coreos/amd64-usr/alpha/coreos_production_vagrant.box
core-01: Progress: 46% (Rate: 6105k/s, Estimated time remaining: 0:00:16)
```
ssh
```bash
ssh-add ~/.vagrant.d/insecure_private_key
```
```bash
vagrant ssh core-01 -- -A
```

View File

@ -1,8 +1,8 @@
version: "3" version: "3"
services: services:
# $ docker-compose up server => up a serverOnly Support Linux or macOS # $ docker-compose up server => up a serverOnly Support Linux or macOS
server: server:
image: yeasy/docker_practice:latest image: yeasy/docker_practice:latest
ports: ports:
@ -19,13 +19,10 @@ services:
- ./:/srv/gitbook-src - ./:/srv/gitbook-src
command: build command: build
# $ docker run -it --rm -p 4000:80 dockerpracticecn/docker_practice # $ docker run -it --rm -p 4000:80 dockerpracticesig/docker_practice
# $ docker up offline
offline: offline:
# this image build by travis ci # this image build by travis ci
image: dockerpracticecn/docker_practice image: dockerpracticesig/docker_practice
ports: ports:
- 4000:80 - 4000:80

View File

@ -9,7 +9,7 @@ version: "3.6"
services: services:
node1: node1:
image: quay.io/coreos/etcd image: quay.io/coreos/etcd:v3.4.0
volumes: volumes:
- node1-data:/etcd-data - node1-data:/etcd-data
expose: expose:
@ -41,7 +41,7 @@ services:
- docker-etcd - docker-etcd
node2: node2:
image: quay.io/coreos/etcd image: quay.io/coreos/etcd:v3.4.0
volumes: volumes:
- node2-data:/etcd-data - node2-data:/etcd-data
networks: networks:
@ -73,7 +73,7 @@ services:
- docker-etcd - docker-etcd
node3: node3:
image: quay.io/coreos/etcd image: quay.io/coreos/etcd:v3.4.0
volumes: volumes:
- node3-data:/etcd-data - node3-data:/etcd-data
networks: networks:

View File

@ -2,7 +2,7 @@ version: "3.6"
services: services:
node1: node1:
image: quay.io/coreos/etcd image: quay.io/coreos/etcd:v3.4.0
volumes: volumes:
- node1-data:/etcd-data - node1-data:/etcd-data
expose: expose:
@ -34,7 +34,7 @@ services:
- docker-etcd - docker-etcd
node2: node2:
image: quay.io/coreos/etcd image: quay.io/coreos/etcd:v3.4.0
volumes: volumes:
- node2-data:/etcd-data - node2-data:/etcd-data
networks: networks:
@ -66,7 +66,7 @@ services:
- docker-etcd - docker-etcd
node3: node3:
image: quay.io/coreos/etcd image: quay.io/coreos/etcd:v3.4.0
volumes: volumes:
- node3-data:/etcd-data - node3-data:/etcd-data
networks: networks:

View File

@ -2,7 +2,7 @@
`etcdctl` `etcd` `HTTP API` 便 `etcd` `etcdctl` `HTTP API` `etcdctl` `etcd` `HTTP API` 便 `etcd` `etcdctl` `HTTP API`
`etcd` `etcdctl` [github.com/coreos/etcd/releases](https://github.com/coreos/etcd/releases) 下载。 `etcd` `etcdctl` [github.com/etcd-io/etcd/releases](https://github.com/etcd-io/etcd/releases) 下载。
`etcdctl` `etcdctl`

View File

@ -2,7 +2,7 @@
`etcdctl` `etcd` `HTTP API` 便 `etcd` `etcdctl` `HTTP API` `etcdctl` `etcd` `HTTP API` 便 `etcd` `etcdctl` `HTTP API`
`etcd` `etcdctl` [github.com/coreos/etcd/releases](https://github.com/coreos/etcd/releases) 下载。 `etcd` `etcdctl` [github.com/etcd-io/etcd/releases](https://github.com/etcd-io/etcd/releases) 下载。
`etcdctl` `etcdctl`
@ -14,10 +14,10 @@ USAGE:
etcdctl etcdctl
VERSION: VERSION:
3.2.10 3.4.0
API VERSION: API VERSION:
3.2 3.4
COMMANDS: COMMANDS:

View File

@ -1,19 +1,19 @@
## ##
`etcd` `Go` [](https://github.com/coreos/etcd) 下载源代码自行编译,也可以下载编译好的二进制文件,甚至直接使用制作好的 `Docker` 镜像文件来体验。 `etcd` `Go` [](https://github.com/etcd-io/etcd) 下载源代码自行编译,也可以下载编译好的二进制文件,甚至直接使用制作好的 `Docker` 镜像文件来体验。
> etcd `3.x` > etcd `3.4.x`
### ###
[github.com/coreos/etcd/releases](https://github.com/coreos/etcd/releases/) 页面,用户可以选择需要的版本,或通过下载工具下载。 [github.com/etcd-io/etcd/releases](https://github.com/etcd-io/etcd/releases/) 页面,用户可以选择需要的版本,或通过下载工具下载。
使 `curl` 使 `curl`
```bash ```bash
$ curl -L https://github.com/coreos/etcd/releases/download/v3.2.10/etcd-v3.2.10-linux-amd64.tar.gz -o etcd-v3.2.10-linux-amd64.tar.gz $ curl -L https://github.com/etcd-io/etcd/releases/download/v3.4.0/etcd-v3.4.0-linux-amd64.tar.gz -o etcd-v3.4.0-linux-amd64.tar.gz
$ tar xzvf etcd-v3.2.10-linux-amd64.tar.gz $ tar xzvf etcd-v3.4.0-linux-amd64.tar.gz
$ cd etcd-v3.2.10-linux-amd64 $ cd etcd-v3.4.0-linux-amd64
``` ```
@ -35,14 +35,7 @@ $ sudo cp etcd* /usr/local/bin/
```bash ```bash
$ etcd $ etcd
2017-12-03 11:18:34.406082 I | etcdmain: etcd Version: 3.2.10 ...
2017-12-03 11:18:34.406226 I | etcdmain: Git SHA: GitNotFound
2017-12-03 11:18:34.406235 I | etcdmain: Go Version: go1.9.2
2017-12-03 11:18:34.406242 I | etcdmain: Go OS/Arch: darwin/amd64
2017-12-03 11:18:34.406250 I | etcdmain: setting maximum number of CPUs to 4, total number of available CPUs is 4
2017-12-03 11:18:34.406265 N | etcdmain: failed to detect default host (default host not supported on darwin_amd64)
2017-12-03 11:18:34.406279 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd
2017-12-03 11:18:34.406457 N | etcdmain: the server is already initialized as member before, starting as etcd member...
2017-12-03 11:18:34.411579 I | embed: listening for peers on http://localhost:2380 2017-12-03 11:18:34.411579 I | embed: listening for peers on http://localhost:2380
2017-12-03 11:18:34.411938 I | embed: listening for client requests on localhost:2379 2017-12-03 11:18:34.411938 I | embed: listening for client requests on localhost:2379
``` ```
@ -68,22 +61,27 @@ hello world
`quay.io/coreos/etcd` `etcd` `2379` `2380` `quay.io/coreos/etcd` `etcd` `2379` `2380`
```bash ```bash
$ export NODE1=192.168.1.21 $ docker run \
-p 2379:2379 \
$ docker run --name etcd \ -p 2380:2380 \
-p 2379:2379 \ --mount type=bind,source=/tmp/etcd-data.tmp,destination=/etcd-data \
-p 2380:2380 \ --name etcd-gcr-v3.4.0 \
--volume=etcd-data:/etcd-data \ quay.io/coreos/etcd:v3.4.0 \
quay.io/coreos/etcd:latest \ /usr/local/bin/etcd \
/usr/local/bin/etcd \ --name s1 \
--data-dir=/etcd-data --name node1 \ --data-dir /etcd-data \
--initial-advertise-peer-urls http://${NODE1}:2380 --listen-peer-urls http://0.0.0.0:2380 \ --listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://${NODE1}:2379 --listen-client-urls http://0.0.0.0:2379 \ --advertise-client-urls http://0.0.0.0:2379 \
--initial-cluster node1=http://${NODE1}:2380 --listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://0.0.0.0:2380 \
--initial-cluster s1=http://0.0.0.0:2380 \
--initial-cluster-token tkn \
--initial-cluster-state new \
--log-level info \
--logger zap \
--log-outputs stderr
``` ```
>etcd `quay.io/coreos/etcd` `gcr.io/etcd-development/etcd` 使
`etcd` `etcd`
### macOS ### macOS

View File

@ -4,7 +4,7 @@
`etcd` `CoreOS` 2013 6 `key-value` `Go` `CoreOS` `etcd` `etcd` `CoreOS` 2013 6 `key-value` `Go` `CoreOS` `etcd`
`etcd` [github.com/coreos/etcd](https://github.com/coreos/etcd) 进行维护。 `etcd` [github.com/etcd-io/etcd](https://github.com/etcd-io/etcd) 进行维护。
[Apache ZooKeeper](https://zookeeper.apache.org/) 项目和 [doozer](https://github.com/ha/doozerd) 项目的启发,`etcd` 在设计的时候重点考虑了下面四个要素: [Apache ZooKeeper](https://zookeeper.apache.org/) 项目和 [doozer](https://github.com/ha/doozerd) 项目的启发,`etcd` 在设计的时候重点考虑了下面四个要素:

View File

@ -40,7 +40,7 @@ FROM scratch
`scratch` `scratch`
[`swarm`](https://hub.docker.com/_/swarm/)、[`coreos/etcd`](https://quay.io/repository/coreos/etcd)。对于 Linux 下静态编译的程序来说,并不需要有操作系统提供运行时支持,所需的一切库都已经在可执行文件里了,因此直接 `FROM scratch` 会让镜像体积更加小巧。使用 [Go 语言](https://golang.org/) 开发的应用很多会使用这种方式来制作镜像,这也是为什么有人认为 Go 是特别适合容器微服务架构的语言的原因之一。 [`swarm`](https://hub.docker.com/_/swarm/)、[`etcd`](https://quay.io/repository/coreos/etcd)。对于 Linux 下静态编译的程序来说,并不需要有操作系统提供运行时支持,所需的一切库都已经在可执行文件里了,因此直接 `FROM scratch` 会让镜像体积更加小巧。使用 [Go 语言](https://golang.org/) 开发的应用很多会使用这种方式来制作镜像,这也是为什么有人认为 Go 是特别适合容器微服务架构的语言的原因之一。
### RUN ### RUN

View File

@ -17,7 +17,7 @@ $ docker run --name webserver -d -p 80:80 nginx
`nginx` `webserver` 80 访 `nginx` `nginx` `webserver` 80 访 `nginx`
Linux Docker使 Docker for MacDocker for Windows访<http://localhost>;如果使用的是 Docker Toolbox或者是在虚拟机、云服务器上安装的 Docker则需要将 `localhost` 换为虚拟机地址或者实际云服务器地址。 Linux Docker使 Docker Desktop for Mac/Windows访<http://localhost>;如果使用的是 Docker Toolbox或者是在虚拟机、云服务器上安装的 Docker则需要将 `localhost` 换为虚拟机地址或者实际云服务器地址。
访 Nginx 访 Nginx
@ -116,7 +116,7 @@ e43d811ce2f4 4 weeks ago /bin/sh -c #(nop) CMD ["nginx" "-g" "da
docker run --name web2 -d -p 81:80 nginx:v2 docker run --name web2 -d -p 81:80 nginx:v2
``` ```
`web2` `81` Docker for Mac/Windows Linux 访 <http://localhost:81> 看到结果,其内容应该和之前修改后的 `webserver` 一样。 `web2` `81` Docker Desktop for Mac/Windows Linux 访 <http://localhost:81> 看到结果,其内容应该和之前修改后的 `webserver` 一样。
使 `docker commit` 使 `docker commit`

View File

@ -69,7 +69,7 @@ $ docker image ls -a
### ###
`docker image ls` `docker image ls` `docker image ls` `docker image ls`

View File

@ -17,7 +17,7 @@ COPY database/ /app/database/
COPY composer.json /app/ COPY composer.json /app/
RUN cd /app \ RUN cd /app \
&& composer config -g repo.packagist composer https://packagist.laravel-china.org \ && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
&& composer install \ && composer install \
--ignore-platform-reqs \ --ignore-platform-reqs \
--no-interaction \ --no-interaction \

View File

@ -76,7 +76,7 @@ COPY database/ /app/database/
COPY composer.json composer.lock /app/ COPY composer.json composer.lock /app/
RUN cd /app \ RUN cd /app \
&& composer config -g repo.packagist composer https://packagist.laravel-china.org \ && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
&& composer install \ && composer install \
--ignore-platform-reqs \ --ignore-platform-reqs \
--no-interaction \ --no-interaction \
@ -184,7 +184,7 @@ COPY database/ /app/database/
COPY composer.json /app/ COPY composer.json /app/
RUN cd /app \ RUN cd /app \
&& composer config -g repo.packagist composer https://packagist.laravel-china.org \ && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
&& composer install \ && composer install \
--ignore-platform-reqs \ --ignore-platform-reqs \
--no-interaction \ --no-interaction \

View File

@ -64,7 +64,7 @@ Untagged: node@sha256:b4f0e0bdeb578043c1ea6862f0d40cc4afe32a4a582f3be235a3b16442
使 `Untagged` `Delete` `docker image rm` 使 `Untagged` `Delete` `docker image rm`
`docker pull` `docker pull`
使 使

View File

@ -8,9 +8,9 @@
Docker CE [Fedora](https://fedoraproject.org/) 操作系统: Docker CE [Fedora](https://fedoraproject.org/) 操作系统:
* 26 (Docker CE v18.03 )
* 27
* 28 * 28
* 29
* 30
#### ####

View File

@ -1,14 +1,14 @@
## macOS Docker ## macOS Docker Desktop CE
### ###
[Docker for Mac](https://docs.docker.com/docker-for-mac/) 要求系统最低为 macOS El Capitan 10.11。 [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/) 要求系统最低为 macOS El Capitan 10.11。
### ###
#### 使 Homebrew #### 使 Homebrew
[Homebrew](https://brew.sh/) 的 [Cask](https://caskroom.github.io/) 已经支持 Docker for Mac因此可以很方便的使用 Homebrew Cask 来进行安装: [Homebrew](https://brew.sh/) 的 [Cask](https://caskroom.github.io/) 已经支持 Docker Desktop for Mac因此可以很方便的使用 Homebrew Cask 来进行安装:
```bash ```bash
$ brew cask install docker $ brew cask install docker
@ -16,7 +16,7 @@ $ brew cask install docker
#### ####
[Stable](https://download.docker.com/mac/stable/Docker.dmg) 或 [Edge](https://download.docker.com/mac/edge/Docker.dmg) 版本的 Docker for Mac。 [Stable](https://download.docker.com/mac/stable/Docker.dmg) 或 [Edge](https://download.docker.com/mac/edge/Docker.dmg) 版本的 Docker Desktop for Mac。
macOS `.dmg` [Moby](https://blog.docker.com/2013/10/call-me-moby-dock/) 的鲸鱼图标拖拽到 `Application` 文件夹即可(其间需要输入用户密码)。 macOS `.dmg` [Moby](https://blog.docker.com/2013/10/call-me-moby-dock/) 的鲸鱼图标拖拽到 `Application` 文件夹即可(其间需要输入用户密码)。
@ -44,11 +44,11 @@ $ brew cask install docker
```bash ```bash
$ docker --version $ docker --version
Docker version 18.09.0, build 4d60db4 Docker version 19.03.1, build 74b1e89
$ docker-compose --version $ docker-compose --version
docker-compose version 1.23.2, build 1110ad01 docker-compose version 1.24.1, build 4667896b
$ docker-machine --version $ docker-machine --version
docker-machine version 0.16.0, build 702c267f docker-machine version 0.16.1, build cce350d7
``` ```
`docker version``docker info` [Nginx ](https://hub.docker.com/_/nginx/) `docker version``docker info` [Nginx ](https://hub.docker.com/_/nginx/)
@ -57,7 +57,7 @@ docker-machine version 0.16.0, build 702c267f
$ docker run -d -p 80:80 --name webserver nginx $ docker run -d -p 80:80 --name webserver nginx
``` ```
访 <http://localhost>,如果看到了 "Welcome to nginx!",就说明 Docker for Mac 安装成功了。 访 <http://localhost>,如果看到了 "Welcome to nginx!",就说明 Docker Desktop for Mac 安装成功了。
![](_images/install-mac-example-nginx.png) ![](_images/install-mac-example-nginx.png)
@ -71,3 +71,7 @@ $ docker rm webserver
### ###
使 Docker Docker [](mirror.md) 使 Docker Docker [](mirror.md)
###
* [](https://docs.docker.com/docker-for-mac/install/)

View File

@ -58,7 +58,7 @@ Registry Mirrors:
`gcr.io/*` `gcr.io/<repo-name>/<image-name>:<version>` `gcr.azk8s.cn/<repo-name>/<image-name>:<version>` , `gcr.io/*` `gcr.io/<repo-name>/<image-name>:<version>` `gcr.azk8s.cn/<repo-name>/<image-name>:<version>` ,
```bash ```bash
# docker pull gcr.io/google_containers/hyperkube-amd64:v1.9.2 # $ docker pull gcr.io/google_containers/hyperkube-amd64:v1.9.2
docker pull gcr.azk8s.cn/google_containers/hyperkube-amd64:v1.9.2 $ docker pull gcr.azk8s.cn/google_containers/hyperkube-amd64:v1.9.2
``` ```

View File

@ -10,8 +10,6 @@ Docker CE 支持以下版本的 [Raspbian](https://www.raspberrypi.org/downloads
* Raspbian Stretch * Raspbian Stretch
* Raspbian Jessie (Docker CE v18.06 )
** `Raspbian` [](http://www.raspberrypi.org/) 推荐用于树莓派的首选系统,其基于 `Debian`。 ** `Raspbian` [](http://www.raspberrypi.org/) 推荐用于树莓派的首选系统,其基于 `Debian`。
### 使 APT ### 使 APT

View File

@ -8,6 +8,8 @@
Docker CE [Ubuntu](https://www.ubuntu.com/server) 操作系统: Docker CE [Ubuntu](https://www.ubuntu.com/server) 操作系统:
* Disco 19.04
* Cosmic 18.10
* Bionic 18.04 (LTS) * Bionic 18.04 (LTS)
* Xenial 16.04 (LTS) * Xenial 16.04 (LTS)

View File

@ -22,6 +22,10 @@ Wait a moment and click Got it to start using Docker CE.
![](_images/install-win-success-popup-cloud.png) ![](_images/install-win-success-popup-cloud.png)
### Accelerate Images(In China) ### Registry Mirror(In China)
If you pull docker images very slowly, then you can configurate [Registry Mirror](mirror.md). If you pull docker images very slowly, then you can configurate [Registry Mirror](mirror.md).
### Links
* [Docs](https://docs.docker.com/docker-for-windows/install/)

View File

@ -6,6 +6,12 @@ Docker has aroused widespread concern and discussion and had 5.2w stars and 1w f
Docker develops with [GO](https://golang.org/) launched by Google, based on [cgroup](https://zh.wikipedia.org/wiki/Cgroups) and [namespace](https://en.wikipedia.org/wiki/Linux_namespaces) of Linux Kernel and [Union FS](https://en.wikipedia.org/wiki/Union_mount) like [AUFS](https://en.wikipedia.org/wiki/Aufs) to package and isolate the processes which is belong to [Operating system level virtualization technology](https://en.wikipedia.org/wiki/Operating-system-level_virtualization). It is also called container because of the isolated process is independent of the host and other isolated processes. The initial implementation is based on [LXC](https://linuxcontainers.org/lxc/introduction/). It removed LXC and use [libcontainer](https://github.com/docker/libcontainer) instead which is developed by themself since 0.7. Starting with 1.11, it uses [runC](https://github.com/opencontainers/runc) and [containerd](https://github.com/containerd/containerd) further. Docker develops with [GO](https://golang.org/) launched by Google, based on [cgroup](https://zh.wikipedia.org/wiki/Cgroups) and [namespace](https://en.wikipedia.org/wiki/Linux_namespaces) of Linux Kernel and [Union FS](https://en.wikipedia.org/wiki/Union_mount) like [AUFS](https://en.wikipedia.org/wiki/Aufs) to package and isolate the processes which is belong to [Operating system level virtualization technology](https://en.wikipedia.org/wiki/Operating-system-level_virtualization). It is also called container because of the isolated process is independent of the host and other isolated processes. The initial implementation is based on [LXC](https://linuxcontainers.org/lxc/introduction/). It removed LXC and use [libcontainer](https://github.com/docker/libcontainer) instead which is developed by themself since 0.7. Starting with 1.11, it uses [runC](https://github.com/opencontainers/runc) and [containerd](https://github.com/containerd/containerd) further.
![Docker Architecture](https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/media/docker-on-linux.png)
> `runc` is a Linux command-line tool for creating and running containers according to the [OCI container runtime specification](https://github.com/opencontainers/runtime-spec).
> `containerd` is a daemon that manages container life cycle from downloading and unpacking the container image to container execution and supervision.
Docker is further packaged on a container basis, from file system, network interconnection to process isolation, etc, greatly simplifying container craetion and maintenance. Docker is further packaged on a container basis, from file system, network interconnection to process isolation, etc, greatly simplifying container craetion and maintenance.
The images below compare the differences between Docker and Traditional Virtualization. The traditional Virtual machine technology is to virtualize a set of hadware to run a complete operation system and run the required application process on this system. The application process in the container runs directly on the host kernel, and the container does not have its own Kernel and hadware virtualiztion. Therefore, container are lighter than traditional virtual machines. The images below compare the differences between Docker and Traditional Virtualization. The traditional Virtual machine technology is to virtualize a set of hadware to run a complete operation system and run the required application process on this system. The application process in the container runs directly on the host kernel, and the container does not have its own Kernel and hadware virtualiztion. Therefore, container are lighter than traditional virtual machines.
@ -14,6 +20,4 @@ The images below compare the differences between Docker and Traditional Virtuali
![Docker](_images/docker.png) ![Docker](_images/docker.png)
[docker-soft]:https://en.wikipedia.org/wiki/Docker_(software) [docker-soft]:https://en.wikipedia.org/wiki/Docker_(software)

View File

@ -4,13 +4,13 @@ Docker Machine 可以在多种操作系统平台上安装,包括 Linux、macOS
### macOSWindows ### macOSWindows
Docker for MacDocker for Windows `docker-machine` 使 `Docker Desktop for Mac/Windows` `docker-machine` 使
```bash ```bash
$ docker-machine -v $ docker-machine -v
docker-machine version 0.13.0, build 9ba6da9 docker-machine version 0.16.1, build cce350d7
``` ```
### Linux ### Linux
@ -20,7 +20,8 @@ docker-machine version 0.13.0, build 9ba6da9
Linux 64 Linux 64
```bash ```bash
$ sudo curl -L https://github.com/docker/machine/releases/download/v0.13.0/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine $ sudo curl -L https://github.com/docker/machine/releases/download/v0.16.1/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine
$ sudo chmod +x /usr/local/bin/docker-machine $ sudo chmod +x /usr/local/bin/docker-machine
``` ```
@ -28,5 +29,5 @@ $ sudo chmod +x /usr/local/bin/docker-machine
```bash ```bash
$ docker-machine -v $ docker-machine -v
docker-machine version 0.13.0, build 9ba6da9 docker-machine version 0.16.1, build cce350d7
``` ```

View File

@ -50,7 +50,7 @@ $ docker-machine create \
#### Windows 10 #### Windows 10
Windows 10 Docker for Windows VirtualBox使 `virtualbox` Docker Machine使 `hyperv` Windows 10 Docker Desktop for Windows VirtualBox使 `virtualbox` Docker Machine使 `hyperv`
> `Hyper-V` **** 使 `--hyperv-virtual-switch=MY_SWITCH` > `Hyper-V` **** 使 `--hyperv-virtual-switch=MY_SWITCH`

7
manifest 100644
View File

@ -0,0 +1,7 @@
DOCKER_VERSION=19.03.1
DOCKER_COMPOSE_VERSION=1.24.1
DOCKER_MACHINE_VERSION=0.16.1
ETCD_VERSION=3.4.0
KUBERNETES_VERSION=1.14.3
UBUNTU=18.04
DEBIAN=9

View File

@ -116,4 +116,4 @@ REPOSITORY TAG IMAGE ID CREAT
### ###
Docker for Windows Docker for Mac `daemon.json` Docker Desktop for Windows Docker Desktop for Mac `daemon.json`