目录 搜索
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
文字

此文档适用于任何想要运行自己的公证服务%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.和其他各方也可以在这里使用的其他术语中拥有商标权。

上一篇: 下一篇: