目录搜索
ComposeAbout 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 bundledocker-compose configdocker-compose createdocker-compose downdocker-compose eventsdocker-compose execdocker-compose helpdocker-compose imagesdocker-compose killdocker-compose logsdocker-compose pausedocker-compose portdocker-compose psdocker-compose pulldocker-compose pushdocker-compose restartdocker-compose rmdocker-compose rundocker-compose scaledocker-compose startdocker-compose stopdocker-compose topdocker-compose unpausedocker-compose upEnvironment file (Compose)Environment variables in ComposeExtend services in ComposeFrequently asked questions (Compose)Getting started (Compose)Install ComposeLink environment variables (deprecated) (Compose)Networking in ComposeOverview of Docker ComposeOverview of docker-compose CLIQuickstart: Compose and WordPressRails and PostgreSQL (Compose)Sample apps with ComposeUsing Compose in productionUsing Compose with SwarmEngine.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-ngBest 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 networkDelete the service (Engine)Deploy a service (Engine)Deploy services to a swarm (Engine)Deprecated Engine featuresDocker container networking (Engine)Docker overview (Engine)Docker run reference (Engine)Dockerfile reference (Engine)Dockerize an applicationDrain a node (Engine)EngineFAQ (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.10Optional Linux post-installation steps (Engine)Overview (Engine)PostgreSQL (Engine)Raft consensus in swarm mode (Engine)Riak (Engine)Run Docker Engine in swarm modeScale 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 GuideAmazon 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 mountsTroubleshoot 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: CLIDaemon CLI reference (dockerd) (Engine)dockerdocker attachdocker builddocker checkpointdocker checkpoint createdocker checkpoint lsdocker checkpoint rmdocker commitdocker configdocker config createdocker config inspectdocker config lsdocker config rmdocker containerdocker container attachdocker container commitdocker container cpdocker container createdocker container diffdocker container execdocker container exportdocker container inspectdocker container killdocker container logsdocker container lsdocker container pausedocker container portdocker container prunedocker container renamedocker container restartdocker container rmdocker container rundocker container startdocker container statsdocker container stopdocker container topdocker container unpausedocker container updatedocker container waitdocker cpdocker createdocker deploydocker diffdocker eventsdocker execdocker exportdocker historydocker imagedocker image builddocker image historydocker image importdocker image inspectdocker image loaddocker image lsdocker image prunedocker image pulldocker image pushdocker image rmdocker image savedocker image tagdocker imagesdocker importdocker infodocker inspectdocker killdocker loaddocker logindocker logoutdocker logsdocker networkdocker network connectdocker network createdocker network disconnectdocker network inspectdocker network lsdocker network prunedocker network rmdocker nodedocker node demotedocker node inspectdocker node lsdocker node promotedocker node psdocker node rmdocker node updatedocker pausedocker plugindocker plugin createdocker plugin disabledocker plugin enabledocker plugin inspectdocker plugin installdocker plugin lsdocker plugin pushdocker plugin rmdocker plugin setdocker plugin upgradedocker portdocker psdocker pulldocker pushdocker renamedocker restartdocker rmdocker rmidocker rundocker savedocker searchdocker secretdocker secret createdocker secret inspectdocker secret lsdocker secret rmdocker servicedocker service createdocker service inspectdocker service logsdocker service lsdocker service psdocker service rmdocker service scaledocker service updatedocker stackdocker stack deploydocker stack lsdocker stack psdocker stack rmdocker stack servicesdocker startdocker statsdocker stopdocker swarmdocker swarm cadocker swarm initdocker swarm joindocker swarm join-tokendocker swarm leavedocker swarm unlockdocker swarm unlock-keydocker swarm updatedocker systemdocker system dfdocker system eventsdocker system infodocker system prunedocker tagdocker topdocker unpausedocker updatedocker versiondocker volumedocker volume createdocker volume inspectdocker volume lsdocker volume prunedocker volume rmdocker waitUse the Docker command line (Engine)Engine: ExtendAccess authorization plugin (Engine)Docker log driver pluginsDocker network driver plugins (Engine)Extending Engine with pluginsManaged plugin system (Engine)Plugin configuration (Engine)Plugins API (Engine)Volume plugins (Engine)Engine: SecurityAppArmor 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 EngineUse trusted imagesUsing certificates for repository client verification (Engine)Engine: TutorialsEngine tutorialsNetwork containers (Engine)Get StartedPart 1: OrientationPart 2: ContainersPart 3: ServicesPart 4: SwarmsPart 5: StacksPart 6: Deploy your appMachineAmazon Web Services (Machine)Digital Ocean (Machine)docker-machine activedocker-machine configdocker-machine createdocker-machine envdocker-machine helpdocker-machine inspectdocker-machine ipdocker-machine killdocker-machine lsdocker-machine provisiondocker-machine regenerate-certsdocker-machine restartdocker-machine rmdocker-machine scpdocker-machine sshdocker-machine startdocker-machine statusdocker-machine stopdocker-machine upgradedocker-machine urlDriver 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 MachineMachineMachine CLI overviewMachine command-line completionMachine concepts and helpMachine overviewMicrosoft Azure (Machine)Microsoft Hyper-V (Machine)Migrate from Boot2Docker to MachineOpenStack (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)NotaryClient configuration (Notary)Common Server and signer configurations (Notary)Getting started with NotaryNotary changelogNotary configuration filesRunning a Notary serviceServer configuration (Notary)Signer configuration (Notary)Understand the service architecture (Notary)Use the Notary client
文字

此文档适用于任何想要运行自己的公证服务%28的人,例如那些希望使用带有私人码头注册中心%29的公证的人。运行公证服务需要您已经熟悉使用码头发动机和码头组成...

运行用于测试或开发的服务

用于测试和开发目的的完整公证服务的最快方法是在公证工程...

$ git clone https://github.com/docker/notary.git
$ cd notary
$ docker-compose up

这将构建开发公证服务器和公证签字人映像,并为公证服务器、公证签字人和它们共享的MySQL数据库启动容器。MySQL数据存储在卷中。

公证服务器和公证人签名者使用存储库%29中的自签名测试证书在相互验证的TLS%28上进行通信,公证服务器在端口4443上侦听HTTPS通信量。

默认情况下,此开发公证服务器容器使用测试自签名的tls证书运行.。为了能够成功地连接到它,您必须在fixtures/root-ca.crt...

例如,要使用OpenSSL进行连接:

$ openssl s_client -connect <docker host>:4443 -CAfile fixtures/root-ca.crt -no_ssl3 -no_ssl2

若要使用公证客户端CLI进行连接,请参见开始文件。请注意,公证服务器和签字人的版本应大于或等于公证客户端CLI,以确保功能兼容性,即如果您使用的是公证客户端CLI 0.2。确保您使用的服务器和签名者使用的是与0.2相同或更高版本的标记。

自签名证书的主题名称和主题可选名称为notary-server,,,notaryserver,和localhost,因此,如果您的Docker主机不在localhost%28上--例如,如果您使用的是DockerMachine%29,则需要更新主机文件,使其名称notary-server与您的Docker主机的IP地址关联。

高级配置选项

公证服务器和公证签字人JSON配置文件.预置图像,如上面的发展图像为您提供这些配置文件,并提供一些正常的默认设置。

但是,对于在生产中运行,或者如果您只想更改开发服务上的默认设置,您可能希望更改这些默认值。

使用不同的命令行参数运行

您可以覆盖docker run如果要传递不同的命令行选项,则为图像发出命令。公证服务器和公证人签名者都采用以下命令行参数:

  • -config=<config file>-指定JSON配置文件的路径。

  • -debug-传递此标志使调试服务器在localhost:8080调试服务器提供pprof和费瓦端点。%28请记住,对于正在运行的容器,这是本地主机--此端点不会从容器%29公开。

也可以在配置文件中设置此选项。

  • -logf=<format>-此标志设置日志的输出格式。可能的格式是“json”和“logfmt”。 无法在配置文件中设置此选项,因为某些日志消息是在读取配置文件之前在启动时生成的。指定您自己的配置文件您完全可以使用自己的配置文件运行映像。您只需挂载配置目录,然后将该配置文件的路径作为参数传递给docker run命令。使用环境变量重写配置文件参数还可以通过设置窗体的环境变量来覆盖配置的参数。NOTARY_SERVER_<var>NOTARY_SIGNER_<var>...var全帽子,"_"-从配置JSON的顶层分隔键路径。例如,如果您想重写公证服务器配置的存储URL:"storage": {  "backend": "mysql",  "db_url": "dockercondemo:dockercondemo@tcp(notary-mysql)/dockercondemo" }您需要设置环境变量。NOTARY_SERVER_STORAGE_DB_URL,因为db_urlstorage节中的公证服务器配置JSON。请注意,不能覆盖值为另一个映射的键。例如,设置NOTARY_SERVER_STORAGE='{"storage": {"backend": "memory"}}'不会设置内存存储。只是没能解析。您只能覆盖其值为字符串或数字的键。例如,假设您想运行一个单独的公证服务器实例:

  • 带着你自己的TLS证书和钥匙

  • 使用本地、内存中的签名器服务,而不是使用公证签名器。

  • 使用本地、内存中的tuf元数据存储而不是使用mysql。

  • 生成JSON格式的日志

这样做的一种方法是:

  1. 生成您自己的TLS证书和密钥,如server.crtserver.key,并将它们放在目录中。/tmp/server-configdir...

  1. 将以下配置文件写入/tmp/server-configdir/config.json*

{“服务器”:{“http”[医]地址“:”:“4443”,“TLS”[医]键[医]文件“:”./server.key“,”TLS“[医]CERT[医]文件“:”/server.crt“},”信任“[医]服务:{“类型”:“远程”,“主机名”:“公证人”,“端口”:“7899”,“tls”[医]钙[医]文件“:”./root-ca.crt“,”key“[医]算法:“ecdsa”,“tls”[医]客户[医]证书:./公证-Server.crt“,”TLS“[医]客户[医]键“:”...“.公证-Server.key”},“存储”:{“后端”:“MySQL”,“db”[医]服务器@tcp%28 mysql:3306%29/notaryserver?parseTime=True}

请注意,我们包括远程信任服务和数据库存储类型,以演示环境变量如何覆盖配置参数。

  1. 假设您已经构建或调出了公证服务器停靠映像%29,则运行以下命令%28: $docker run\-p“4443:4443”\-v/tmp/server-configdir:/etc/docker/公证-server/\-e公证[医]服务器[医]信托[医]服务[医]类型=本地\-e公证人[医]服务器[医]储物[医]后端=内存\-e公证[医]服务器[医]测井[医]级=调试\公证[医]server\-config=/etc/docker/notra-server/config.json\-logf=json{“level”:“info”,“msg”:“version:0.2,Git COMMIT:619f8cf”,“Time”:“2016-02-25T00:53:59Z”}{“level”:“info”,“msg”:“使用本地签名服务,这需要ED25519。忽略所有其他信任[医]服务参数,包括keyAlgorithm“、”time“:”2016-02-25T00:53:59Z“}{”level“:”info“、”msg“:”使用内存后端“、”时间“:”2016-02-25T00:53:59Z“}{”level“:”info“、”msg“:”start Server“、”time“:”2016-02-25T00:53:59Z“{”Level“:”info“、”msg“:”启用TLS“、”Time“:”2016-02-25T00:53}}}“}{”info“您可以使用码头组成通过设置卷、环境变量和重写组成文件中公证服务器容器的默认命令。在生产中部署的建议在从开发转向生产时,必须考虑许多因素,以确保安全性和可伸缩性。证书公证存储库将样例证书包含在固定目录中。当您使用所提供的docker-Compose.yml文件初始化开发服务时,这些示例证书将用于创建更类似于生产的环境。你必须获得你的自己证书在生产部署中使用。公证存储库中的示例私钥文件显然是公共知识,在生产部署中使用它们是高度不安全的。证书目录公证是一个基于用户/客户端的系统,它在用户的主目录中搜索证书,~/.docker/trust.要从命令行简化使用公证,请创建一个别名,该别名映射用户的trust目录到系统的ca-certificates目录。$ alias notary="notary -s https://<dtr-url> -d ~/.docker/trust --tlscacert /usr/local/share/ca-certificates/<dtr-url>.crt"数据库服务器和签名者都需要一个数据库。这些应该是具有不同用户的单独数据库。用户的权限应该受到限制。我们建议将以下MySQL%28或等效的%29权限授予仅限于自己数据库的用户:

  1. 公证服务器数据库用户:SELECT, INSERT, UPDATE, DELETE

  1. 公证人签署人数据库用户:SELECT, INSERT, DELETE

高可用性

大多数生产用户都希望通过运行服务器和签名应用程序的多个实例来提高可用性。这些可以任意和独立地进行缩放。数据库也可以独立地进行缩放,但这是留给有经验的DBA和运营团队使用的。典型的部署将如下图所示:

二次

二次

在图中,负载平衡器将外部通信量路由到公证服务器实例集群。如果需要%29签名,或者需要b%29密钥生成,这些用户可以向公证人签名实例发出请求。从公证服务器到公证签字人集群的请求是通过内部负载均衡器进行路由器的。

公证可以与CDN或其他缓存系统一起使用。所有对JSON文件的GET请求都可能被无限期缓存URL匹配:

  • */root.json

  • */timestamp.json

对JSON文件的所有其他请求都包括正在请求的文件的sha256校验和,因此是不可变的。对JSON文件的请求占所有公证请求的绝大多数。对JSON文件的GET以外的任何请求都不应该缓存。

相关信息

  • 公证服务体系结构

  • 公证配置文件

 © 2017 Docker, Inc.

根据ApacheLicense,版本2.0获得许可。

Docker和Docker标志是Docker公司在美国和/或其他国家的商标或注册商标。

Docker,Inc.和其他各方也可以在这里使用的其他术语中拥有商标权。

上一篇:下一篇: