Merge pull request #26

更新网络
This commit is contained in:
YuCheng Hu 2020-11-27 10:56:23 -05:00 committed by GitHub
commit 6a0017a4c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 35 deletions

View File

@ -105,7 +105,7 @@ docker-compose up -d --build
```
> Docker Compose 包含有 [Docker Desktop](https://docs.docker.com/desktop)。
> 如果你的计算机上没有安装 Docker Compose请访问下面的链接上的参考来进行安装https://docs.docker.com/compose/install/
> 如果你的计算机上没有安装 Docker Compose请访问下面的链接上的参考来进行安装cd
一旦容器被构建和运行了,请通过浏览器来访问 [http://localhost:4000](http://localhost:4000]地址来查看构建成功的文档页面。

View File

@ -3,14 +3,14 @@ description: Most frequently asked questions.
keywords: faq, questions, documentation, docker
redirect_from:
- /engine/misc/faq/
title: Docker frequently asked questions (FAQ)
title: Docker 常见的问题 frequently asked questions (FAQ)
---
### Does Docker run on Linux, macOS, and Windows?
### Docker 可以在 Linux, macOS, 和 Windows 上运行吗?
You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64).
Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.
你可以在 Linux 和 Windows 的程序和执行 Docker 容器。
Docker 平台可以在原生的 Linux 上x86-64, ARM 和更多其他的 CPU 架构)和 Windowsx86-64 上运行。
Docker Inc. 构建产品,能够让你在 Linux, Windows 和 macOS 上构建和运行容器。
### What does Docker technology add to just plain LXC?
@ -80,16 +80,15 @@ private containers, for internal server deployments for example.
Strider, Travis), etc. Docker is rapidly establishing itself as the standard
for container-based tooling.
### What is different between a Docker container and a VM?
### Docker 容器和 VM虚拟机 有什么区别?
There's a great StackOverflow answer [showing the differences](
在 StackOverflow 上有针对这个问题的回答,请参考 [显示虚拟化的区别](
https://stackoverflow.com/questions/16047306/how-is-docker-io-different-from-a-normal-virtual-machine){: target="_blank" rel="noopener" class="_"}.
### Do I lose my data when the container exits?
### 当容器退出的时候我会丢失数据吗?
Not at all! Any data that your application writes to disk gets preserved in its
container until you explicitly delete the container. The file system for the
container persists even after the container halts.
完全不会丢失数据!所有你应用程序写入到磁盘的数据将会被完好的保存在容器中,直到你明确的删除容器。
在容器停止运行后,针对容器持久性的事件的文件系统还是在运行的。
### How far do Docker containers scale?

View File

@ -3,12 +3,12 @@ description: Explains how to work with containers
keywords: docker, introduction, documentation, about, technology, docker.io, user, guide, user's, manual, platform, framework, home, intro
redirect_from:
- /engine/userguide/containers/
title: Engine tutorials
title: 引擎指南
---
# Learn by example
# 通过示例来学习
* [Network containers](networkingcontainers.md)
* [Manage data in containers](../../storage/volumes.md)
* [Samples](../../samples/index.md)
* [Get Started](../../get-started/index.md)
* [容器的网络](networkingcontainers.md)
* [管理容器中的数据](../../storage/volumes.md)
* [示例](../../samples/index.md)
* [开始使用 Docker](../../get-started/index.md)

View File

@ -4,21 +4,18 @@ keywords: Examples, Usage, volume, docker, documentation, user guide, data, volu
redirect_from:
- /engine/userguide/containers/networkigncontainers/
- /engine/userguide/networkigncontainers/
title: Network containers
title: 容器的网络(Network containers
---
If you are working your way through the user guide, you just built and ran a
simple application. You've also built in your own images. This section teaches
you how to network your containers.
如果你通过 Docker 提供的用户指南,你应该已经完成了构建你的第一个 Docker 容器,并且运行了示例应用。
你已经构建了你自己的镜像images。本部分的内容将会指导你如何对你的容器进行网络配置。
## Launch a container on the default network
## 使用默认网络来运行一个容器
Docker includes support for networking containers through the use of **network
drivers**. By default, Docker provides two network drivers for you, the
`bridge` and the `overlay` drivers. You can also write a network driver plugin so
that you can create your own drivers but that is an advanced task.
Docker 能够支持通过 **network drivers** 来使用网络的容器。在默认的情况下Docker 为你提供了 2 个网络驱动: `bridge``overlay` 驱动。
你也可以通过写一个网络驱动插件来创建你自己的网络驱动,但是这个属于比较高级的任务了。
Every installation of the Docker Engine automatically includes three default networks. You can list them:
在任何完成安装的 Docker 中将会自动包含有下面 3 个网络驱动,你可以通过下面的命令来列表出来:
$ docker network ls
@ -27,7 +24,7 @@ Every installation of the Docker Engine automatically includes three default net
c288470c46f6 host host
7b369448dccb bridge bridge
The network named `bridge` is a special network. Unless you tell it otherwise, Docker always launches your containers in this network. Try this now:
被命名 `bridge` 的网络是一个特殊的网络。除非你再运行的时候指定一个网络,否则 Docker 容器将会一直运行这个网络。尝试运行下面的命令:
$ docker run -itd --name=networktest ubuntu
@ -35,7 +32,7 @@ The network named `bridge` is a special network. Unless you tell it otherwise, D
![bridge1](bridge1.png)
Inspecting the network is an easy way to find out the container's IP address.
通过检查网络,可以非常容易的找到你容器的 IP 地址。
```bash
$ docker network inspect bridge
@ -80,14 +77,15 @@ $ docker network inspect bridge
]
```
You can remove a container from a network by disconnecting the container. To do this, you supply both the network name and the container name. You can also use the container ID. In this example, though, the name is faster.
通过断开与容器的链接,你也可以将容器从网络中删除。
如果要将容器从网络中删除的话你需要同时提供网络名network name和容器名container name
你也可以使用容器 ID但是使用容器名相对使用容器 ID 来说,更加快速。
$ docker network disconnect bridge networktest
While you can disconnect a container from a network, you cannot remove the
builtin `bridge` network named `bridge`. Networks are natural ways to isolate
containers from other containers or other networks. So, as you get more
experienced with Docker, create your own networks.
尽管你可以将容器从一个网络中断开连接,但是你不能删除 Docker 内部构建的被命名为 `bridge``bridge` 网络。
网络是将一个容器与其他容器独立开或者容器与其他网络独立开的最常规的方式。
因此,当你有更多使用 Docker 经验的时候,可以尝试创建你自己的网络。
## Create your own bridge network