directory search
Compose About versions and upgrading (Compose) ASP.NET Core + SQL Server on Linux (Compose) CLI environment variables (Compose) Command-line completion (Compose) Compose(组成) Compose command-line reference(组合命令行参考) Control startup order (Compose) Django and PostgreSQL (Compose) Docker stacks and distributed application bundles (Compose) docker-compose build(docker-compose构建) docker-compose bundle docker-compose config docker-compose create docker-compose down docker-compose events docker-compose exec docker-compose help docker-compose images docker-compose kill docker-compose logs docker-compose pause docker-compose port docker-compose ps docker-compose pull docker-compose push docker-compose restart docker-compose rm docker-compose run docker-compose scale docker-compose start docker-compose stop docker-compose top docker-compose unpause docker-compose up Environment file (Compose) Environment variables in Compose Extend services in Compose Frequently asked questions (Compose) Getting started (Compose) Install Compose Link environment variables (deprecated) (Compose) Networking in Compose Overview of Docker Compose Overview of docker-compose CLI Quickstart: Compose and WordPress Rails and PostgreSQL (Compose) Sample apps with Compose Using Compose in production Using Compose with Swarm Engine .NET Core application (Engine) About images, containers, and storage drivers (Engine) Add nodes to the swarm (Engine) Apply custom metadata (Engine) Apply rolling updates (Engine) apt-cacher-ng Best practices for writing Dockerfiles (Engine) Binaries (Engine) Bind container ports to the host (Engine) Breaking changes (Engine) Build your own bridge (Engine) Configure container DNS (Engine) Configure container DNS in user-defined networks (Engine) CouchDB (Engine) Create a base image (Engine) Create a swarm (Engine) Customize the docker0 bridge (Engine) Debian (Engine) Default bridge network Delete the service (Engine) Deploy a service (Engine) Deploy services to a swarm (Engine) Deprecated Engine features Docker container networking (Engine) Docker overview (Engine) Docker run reference (Engine) Dockerfile reference (Engine) Dockerize an application Drain a node (Engine) Engine FAQ (Engine) Fedora (Engine) Get started (Engine) Get started with macvlan network driver (Engine) Get started with multi-host networking (Engine) How nodes work (Engine) How services work (Engine) Image management (Engine) Inspect the service (Engine) Install Docker (Engine) IPv6 with Docker (Engine) Join nodes to a swarm (Engine) Legacy container links (Engine) Lock your swarm (Engine) Manage nodes in a swarm (Engine) Manage sensitive data with Docker secrets (Engine) Manage swarm security with PKI (Engine) Manage swarm service networks (Engine) Migrate to Engine 1.10 Optional Linux post-installation steps (Engine) Overview (Engine) PostgreSQL (Engine) Raft consensus in swarm mode (Engine) Riak (Engine) Run Docker Engine in swarm mode Scale the service (Engine) SDKs (Engine) Select a storage driver (Engine) Set up for the tutorial (Engine) SSHd (Engine) Storage driver overview (Engine) Store service configuration data (Engine) Swarm administration guide (Engine) Swarm mode key concepts (Engine) Swarm mode overlay network security model (Engine) Swarm mode overview (Engine) Understand container communication (Engine) Use multi-stage builds (Engine) Use swarm mode routing mesh (Engine) Use the AUFS storage driver (Engine) Use the Btrfs storage driver (Engine) Use the Device mapper storage driver (Engine) Use the OverlayFS storage driver (Engine) Use the VFS storage driver (Engine) Use the ZFS storage driver (Engine) Engine: Admin Guide Amazon CloudWatch logs logging driver (Engine) Bind mounts (Engine) Collect Docker metrics with Prometheus (Engine) Configuring and running Docker (Engine) Configuring logging drivers (Engine) Control and configure Docker with systemd (Engine) ETW logging driver (Engine) Fluentd logging driver (Engine) Format command and log output (Engine) Google Cloud logging driver (Engine) Graylog Extended Format (GELF) logging driver (Engine) Journald logging driver (Engine) JSON File logging driver (Engine) Keep containers alive during daemon downtime (Engine) Limit a container's resources (Engine) Link via an ambassador container (Engine) Log tags for logging driver (Engine) Logentries logging driver (Engine) PowerShell DSC usage (Engine) Prune unused Docker objects (Engine) Run multiple services in a container (Engine) Runtime metrics (Engine) Splunk logging driver (Engine) Start containers automatically (Engine) Storage overview (Engine) Syslog logging driver (Engine) tmpfs mounts Troubleshoot volume problems (Engine) Use a logging driver plugin (Engine) Using Ansible (Engine) Using Chef (Engine) Using Puppet (Engine) View a container's logs (Engine) Volumes (Engine) Engine: CLI Daemon CLI reference (dockerd) (Engine) docker docker attach docker build docker checkpoint docker checkpoint create docker checkpoint ls docker checkpoint rm docker commit docker config docker config create docker config inspect docker config ls docker config rm docker container docker container attach docker container commit docker container cp docker container create docker container diff docker container exec docker container export docker container inspect docker container kill docker container logs docker container ls docker container pause docker container port docker container prune docker container rename docker container restart docker container rm docker container run docker container start docker container stats docker container stop docker container top docker container unpause docker container update docker container wait docker cp docker create docker deploy docker diff docker events docker exec docker export docker history docker image docker image build docker image history docker image import docker image inspect docker image load docker image ls docker image prune docker image pull docker image push docker image rm docker image save docker image tag docker images docker import docker info docker inspect docker kill docker load docker login docker logout docker logs docker network docker network connect docker network create docker network disconnect docker network inspect docker network ls docker network prune docker network rm docker node docker node demote docker node inspect docker node ls docker node promote docker node ps docker node rm docker node update docker pause docker plugin docker plugin create docker plugin disable docker plugin enable docker plugin inspect docker plugin install docker plugin ls docker plugin push docker plugin rm docker plugin set docker plugin upgrade docker port docker ps docker pull docker push docker rename docker restart docker rm docker rmi docker run docker save docker search docker secret docker secret create docker secret inspect docker secret ls docker secret rm docker service docker service create docker service inspect docker service logs docker service ls docker service ps docker service rm docker service scale docker service update docker stack docker stack deploy docker stack ls docker stack ps docker stack rm docker stack services docker start docker stats docker stop docker swarm docker swarm ca docker swarm init docker swarm join docker swarm join-token docker swarm leave docker swarm unlock docker swarm unlock-key docker swarm update docker system docker system df docker system events docker system info docker system prune docker tag docker top docker unpause docker update docker version docker volume docker volume create docker volume inspect docker volume ls docker volume prune docker volume rm docker wait Use the Docker command line (Engine) Engine: Extend Access authorization plugin (Engine) Docker log driver plugins Docker network driver plugins (Engine) Extending Engine with plugins Managed plugin system (Engine) Plugin configuration (Engine) Plugins API (Engine) Volume plugins (Engine) Engine: Security AppArmor security profiles for Docker (Engine) Automation with content trust (Engine) Content trust in Docker (Engine) Delegations for content trust (Engine) Deploying Notary (Engine) Docker security (Engine) Docker security non-events (Engine) Isolate containers with a user namespace (Engine) Manage keys for content trust (Engine) Play in a content trust sandbox (Engine) Protect the Docker daemon socket (Engine) Seccomp security profiles for Docker (Engine) Secure Engine Use trusted images Using certificates for repository client verification (Engine) Engine: Tutorials Engine tutorials Network containers (Engine) Get Started Part 1: Orientation Part 2: Containers Part 3: Services Part 4: Swarms Part 5: Stacks Part 6: Deploy your app Machine Amazon Web Services (Machine) Digital Ocean (Machine) docker-machine active docker-machine config docker-machine create docker-machine env docker-machine help docker-machine inspect docker-machine ip docker-machine kill docker-machine ls docker-machine provision docker-machine regenerate-certs docker-machine restart docker-machine rm docker-machine scp docker-machine ssh docker-machine start docker-machine status docker-machine stop docker-machine upgrade docker-machine url Driver options and operating system defaults (Machine) Drivers overview (Machine) Exoscale (Machine) Generic (Machine) Get started with a local VM (Machine) Google Compute Engine (Machine) IBM Softlayer (Machine) Install Machine Machine Machine CLI overview Machine command-line completion Machine concepts and help Machine overview Microsoft Azure (Machine) Microsoft Hyper-V (Machine) Migrate from Boot2Docker to Machine OpenStack (Machine) Oracle VirtualBox (Machine) Provision AWS EC2 instances (Machine) Provision Digital Ocean Droplets (Machine) Provision hosts in the cloud (Machine) Rackspace (Machine) VMware Fusion (Machine) VMware vCloud Air (Machine) VMware vSphere (Machine) Notary Client configuration (Notary) Common Server and signer configurations (Notary) Getting started with Notary Notary changelog Notary configuration files Running a Notary service Server configuration (Notary) Signer configuration (Notary) Understand the service architecture (Notary) Use the Notary client
characters

Docker运行在Linux,macOS和Windows上吗?

您可以在 Docker 容器中运行 Linux 和 Windows 程序以及可执行文件。Docker 平台在 Linux 上(在x84-64,ARM 和许多其他CPU体系结构上)和 Windows(x86-64)上本机运行。

Docker Inc.构建可让您在Linux,Windows 和 MacOS上构建和运行容器的产品。

Docker 技术为简单的 LXC 增加了什么?

Docker 技术不是 LXC 的替代品。“LXC”指的是 Linux 内核(特别是命名空间和控制组)的功能,它们允许相互之间的沙盒过程并控制其资源分配。除了内核特性的这个底层基础之外,Docker 还提供了一个具有以下强大功能的高级工具:

  • 跨机器的便携式部署。Docker 定义了一种用于将应用程序及其所有依赖项捆绑到一个称为容器的单个对象中的格式。这个容器可以被转移到任何支持 Docker 的机器上。容器可以在那里执行,保证暴露给应用程序的执行环境在开发,测试和生产中是相同的。LXC 实现流程沙盒,这是便携式部署的重要先决条件,但对于便携式部署来说不够。如果您向我发送了一份安装在自定义LXC配置中的应用程序副本,那么它几乎肯定不会像您的方式那样在我的机器上运行。您发送给我的应用程序与您的计算机的特定配置有关:网络,存储,日志记录等。Docker 为这些机器特定的设置定义了一个抽象。

  • 以应用为中心。Docker 针对应用程序的部署进行了优化,而不是机器。这反映在其 API,用户界面,设计理念和文档中。相比之下,lxc辅助脚本将容器作为轻量级机器 - 基本上是启动速度更快,所需 RAM 更少的服务器。我们认为容器不仅仅是这些。

  • 自动构建。泊坞窗包括为开发工具来自动组装从他们的源代码的容器,有超过应用程序依赖的完全控制,编译工具,包装等,他们都可以自由使用makemavenchefpuppetsalt,Debian 软件包,RPM 包,源码包,或任意组合以上,无论机器的配置如何。

  • 版本。Docker 包括用于跟踪容器的连续版本,检查版本之间的差异,提交新版本,回滚等的类似 git 的功能。历史记录还包括容器如何组装以及由谁组装,以便从生产服务器获得完整的可追溯性一路回到上游开发商。Docker 也实现了增量上传和下载,类似于git pull,所以新版本的容器只需发送差异即可传输。

  • 组件重用。任何容器都可以用作“父图像”来创建更专业的组件。这可以手动完成或作为自动构建的一部分。例如,您可以准备理想的Python环境,并将其用作10个不同应用程序的基础。您理想的PostgreSQL设置可以重新用于您未来的所有项目。等等。

  • 共享。Docker 可以访问Docker Hub上的公共注册表,该成千上万的人上传了有用的图像:从 Redis,CouchDB,PostgreSQL 到 IRC 保护者到 Rails 应用服务器到 Hadoop 的任何内容,以便为各种 Linux发行版映射基础。该注册中心还包括由 Docker 团队维护的有用容器的官方“标准库”。注册表本身是开源的,因此任何人都可以部署他们自己的注册表来存储和传输私有容器,例如用于内部服务器部署。

  • 工具生态系统  Docker 定义了一个用于自动化和自定义容器的创建和部署的 API。有大量与 Docker 集成的工具来扩展其功能。PaaS 式部署(Dokku,Deis,Flynn),多节点编排(Maestro,Salt,Mesos,Openstack Nova),管理仪表板(docker-ui,Openstack Horizon,Shipyard),配置管理(Chef,Puppet),持续集成(Jenkins,Strider,Travis)等。Docker正在迅速将自己建立为基于容器的工具的标准。Docker容器和VM之间有什么不同?有一个很棒的StackOverflow答案,显示了差异。当容器退出时,我的数据是否丢失?完全没有!应用程序写入磁盘的任何数据都将保留在其容器中,直到您明确删除容器。即使容器暂停,容器的文件系统仍然存在。Docker 容器的扩展程度如何?当今世界上一些最大的服务器场是基于容器的。Google和Twitter等大型 Web 部署以及Heroku等平台提供程序运行在容器技术上,规模为数十万甚至数百万个容器。如何连接Docker容器?目前推荐的连接容器的方法是通过Docker网络功能。您可以在这里看到如何使用Docker网络的详细信息。如何在Docker容器中运行多个进程?对于大多数使用情况,这种方法是不鼓励的。为了最大限度地提高效率和隔离度,每个容器应该解决一个特定的关注领域 但是,如果您需要在单个容器中运行多个服务,请参阅在容器中运行多个服务。Docker运行在哪个平台上?Linux:

  • 任何运行 Linux 内核版本3.10以上的发行版

  • 大多数Linux发行版都提供了特定的说明,其中包括RHEL,Ubuntu,SuSE等等。

微软Windows:

  • WindowsServer 2016

  • Windows 10

云:

  • AmazonEC 2

  • Google计算引擎

  • 微软Azure

  • Rackspace

我如何报告 Docker 的安全问题?

您可以在此处了解项目的安全策略,并将安全问题报告给此邮箱。

为什么我需要用DCO签署我的提交给 Docker?

请阅读我们的博客文章,介绍DCO。

在构建图像时,我应该更喜欢系统库还是捆绑的系统库?

这是关于 docker-dev邮件列表讨论的总结。

几乎所有的程序都依赖于第三方库。大多数情况下,他们会使用动态链接和某种程序包依赖性,这样当多个程序需要相同的库时,它只安装一次。

但是,有些程序会绑定第三方库,因为它们依赖于这些库的非常特定的版本。例如,Node.js捆绑了OpenSSL; MongoDB 捆绑了 V8和 Boost(等等)。

在创建 Docker 镜像时,最好使用捆绑的库,还是应该构建这些程序,以便它们使用默认的系统库?

关于系统库的关键点不在于节省磁盘或内存空间。这关乎安全。所有主要的发行版都认真对待安全性,拥有专门的安全团队,密切关注已发布的漏洞,并自行公布报告。(请查看Debian安全信息以获取这些过程的示例。)但是,上游开发人员并不总是执行类似的操作。

在设置 Docker 镜像以从源代码编译程序之前,如果您想使用捆绑的库,您应该检查上游作者是否提供了一种方便的方式来公布安全漏洞,以及是否及时更新其捆绑的库。如果他们不这样做,那么您正在将自己(和图像的用户)暴露于安全漏洞。

同样,在使用其他软件包构建之前,您应该检查提供这些软件包的渠道是否实施了类似的安全最佳实践。下载并安装“all-in-one”.deb或.rpm听起来很棒,除非你无法弄清楚它包含一个容易受Heartbleed bug 影响的OpenSSL库。

为什么DEBIAN_FRONTEND=noninteractive在Dockerfiles中不鼓励?

在 Debian 和 Ubuntu 上构建 Docker 镜像时,您可能会看到以下错误:

unable to initialize frontend: Dialog

这些错误不会停止生成映像,但会通知您安装过程尝试打开对话框,但无法执行。通常,这些错误是安全的,无法忽视。

有些人通过使用以下方法更改DEBIAN_FRONTENDDockerfile中的环境变量来规避这些错误:

ENV DEBIAN_FRONTEND=noninteractive

这样可以防止安装程序在安装期间打开对话框,从而停止错误。

虽然这听起来似乎是一个好主意,但它可能有副作用。该DEBIAN_FRONTEND环境变量将被所有从图像构建的图像和容器继承,并有效地改变它们的行为。交互式安装软件时,使用这些映像的用户会遇到问题,因为安装程序不会显示任何对话框。

正因为如此,而且由于设置DEBIAN_FRONTENDnoninteractive主要是“美容”的变化,我们不鼓励改变它。

如果您确实需要更改其设置,请务必在之后将其更改回默认值。

为什么Connection reset by peer在请求运行在容器中的服务时会得到什么?

通常,如果服务已经绑定到本地主机,则返回此消息。结果,从外部进入容器的请求被丢弃。要更正此问题,请更改本地主机上的服务配置,以便该服务接受来自所有 IP 的请求。如果您不确定如何执行此操作,请查看您的操作系统的文档。

为什么Cannot connect to the Docker daemon. Is the docker daemon running on this host?在使用码头机时会遇到问题?

该错误指出 docker 客户端无法连接到虚拟机。这意味着下面的虚拟机docker-machine没有运行,或者客户机没有正确指向虚拟机。

要验证码头机正在运行,可以使用该docker-machine ls命令并docker-machine start在需要时启动它。

$ docker-machine ls
NAME             ACTIVE   DRIVER       STATE     URL   SWARM                   DOCKER    ERRORSdefault          -        virtualbox   Stopped                                 Unknown

$ docker-machine start default

你必须告诉 Docker 与那台机器交谈。你可以用docker-machine env命令来做到这一点。例如,

$ eval "$(docker-machine env default)"$ docker ps

我在哪里可以找到更多答案?

你可以找到更多的答案:

  • Docker用户邮件列表

  • Docker开发人员邮件列表

  • IRC, docker on freenode

  • GitHub

  • 在Stackoverflow上提问

  • 在Twitter上加入对话

Previous article: Next article: