forked from docker/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1156 lines (929 loc) · 42.7 KB
/
Copy pathindex.html
File metadata and controls
1156 lines (929 loc) · 42.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="docker_version" content="1.6.1">
<meta name="docker_git_branch" content="master">
<meta name="docker_git_commit" content="59cd467">
<meta name="docker_build_date" content="Fri Jun 5 11:40:50 UTC 2015">
<meta name="description" content="How to setup and run Docker with HTTPS">
<meta name="keywords" content="docker, docs, article, example, https, daemon, tls, ca, certificate">
<link rel="canonical" href="/articles/https/">
<link href="/css/bootstrap-custom.css" rel="stylesheet">
<link href="/css/main.css" rel="stylesheet">
<link href="/css/prettify-1.0.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/css/dockerfile_tutorial.css">
<link href="/tipuesearch
/tipuesearch.css" rel="stylesheet">
<link href="/css/docs.css" rel="stylesheet">
<link rel="shortcut icon" href="/img/favicon.png">
<title>Running Docker with HTTPS - Docker Documentation</title>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
analytics.load("IWj9D0UpZHZdZUZX9jl98PcpBFWBnBMy");
analytics.page();
}}();
</script>
</head>
<body>
<div id="topmostnav" class="topmostnav_loggedout navbar navbar-static-top">
<div class="container">
<a href="/" title="Docker Docs Home"><div class="brand logo"><img src="/img/nav/docker-logo-loggedin.png"> </div></a>
<form id="nav_search" class="navbar-index-search pull-right" action="/jsearch/">
<span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
<input name="q" id="tipue_search_input" type="text" class="search_input search-query ui-autocomplete-input" placeholder="Search the Docs" autocomplete="off">
</form>
<ul class="nav">
<li class=""><a href="http://www.docker.com/whatisdocker/" title="What is Docker">What is Docker?</a></li>
<li class=""><a href="http://www.docker.com/resources/usecases/" title="Use Cases">Use Cases</a></li>
<li class=""><a href="http://www.docker.com/tryit/" title="Try It!">Try It!</a></li>
<li><a href="https://registry.hub.docker.com" title="Browse">Browse</a></li>
</ul>
<div id="usernav" class="pull-right">
<a href="https://hub.docker.com/account/login" class="btn nav-button2" title="Lg In">Log In</a>
<a href="https://hub.docker.com/account/signup" class="btn nav-button1" title="Sign Up">Sign Up</a>
</div>
</div>
</div>
<div id="topmostnav" class="topmostnav_loggedin navbar navbar-static-top">
<div class="container">
<a href="/" title="Docker Docs Home"><div class="brand logo"><img src="/img/nav/docker-logo-loggedin.png"> </div></a>
<form id="nav_search" class="navbar-index-search pull-right" action="/jsearch/">
<span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
<input name="q" id="tipue_search_input" type="text" class="search_input search-query ui-autocomplete-input" placeholder="Search the Docs" autocomplete="off">
</form>
<ul class="nav">
<li><a href="https://registry.hub.docker.com" title="Browse Repos">Browse Repos</a></li>
<li class="active"><a href="http://docs.docker.com" title="Documentation">Documentation</a></li>
<li><a href="http://www.docker.com/community/participate/" title="Community">Community</a></li>
<li><a href="http://www.docker.com/resources/help/" title="Help">Help</a></li>
</ul>
<div id="usernav" class="pull-right">
<ul class="nav user">
<li class="dropdown">
<a id="logged-in-header-username" class="dropdown-toggle" data-toggle="dropdown" href="#">
<img class="profile" src="" alt="profile picture">
</a>
<ul class="dropdown-menu pull-right">
<li><a href="https://hub.docker.com/">View Profile</a></li>
<li><a href="https://hub.docker.com/account/settings/">Settings</a></li>
<li><a href="https://hub.docker.com/repos/">My Repositories</a></li>
<li><a href="https://hub.docker.com/plans/billing-info">Billing</a></li>
<li><a href="https://hub.docker.com/account/logout/?next=/">Log out</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="wrap">
<nav id="nav_menu" class="clearfix navbar navbar-default navbar-static-top affix" role="navigation">
<div id="docsnav">
<ul id="main-nav" class="pull-left">
<li class="dd_menu pull-left">
<a href="/">About</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/">Docker</a>
</li>
<li >
<a href="/release-notes/">Release Notes</a>
</li>
<li >
<a href="/introduction/understanding-docker/">Understanding Docker</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left">
<a href="/installation/ubuntulinux/">Installation</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/installation/ubuntulinux/">Ubuntu</a>
</li>
<li >
<a href="/installation/mac/">Mac OS X</a>
</li>
<li >
<a href="/kitematic/">Kitematic on OS X</a>
</li>
<li >
<a href="/installation/windows/">Microsoft Windows</a>
</li>
<li >
<a href="/installation/testing-windows-docker-client/">Building and testing the Windows Docker client</a>
</li>
<li >
<a href="/installation/amazon/">Amazon EC2</a>
</li>
<li >
<a href="/installation/archlinux/">Arch Linux</a>
</li>
<li >
<a href="/installation/binaries/">Binaries</a>
</li>
<li >
<a href="/installation/centos/">CentOS</a>
</li>
<li >
<a href="/installation/cruxlinux/">CRUX Linux</a>
</li>
<li >
<a href="/installation/debian/">Debian</a>
</li>
<li >
<a href="/installation/fedora/">Fedora</a>
</li>
<li >
<a href="/installation/frugalware/">FrugalWare</a>
</li>
<li >
<a href="/installation/google/">Google Cloud Platform</a>
</li>
<li >
<a href="/installation/gentoolinux/">Gentoo</a>
</li>
<li >
<a href="/installation/softlayer/">IBM Softlayer</a>
</li>
<li >
<a href="/installation/joyent/">Joyent Compute Service</a>
</li>
<li >
<a href="/installation/azure/">Microsoft Azure</a>
</li>
<li >
<a href="/installation/rackspace/">Rackspace Cloud</a>
</li>
<li >
<a href="/installation/rhel/">Red Hat Enterprise Linux</a>
</li>
<li >
<a href="/installation/oracle/">Oracle Linux</a>
</li>
<li >
<a href="/installation/SUSE/">SUSE</a>
</li>
<li >
<a href="/compose/install/">Docker Compose</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left">
<a href="/userguide/">User Guide</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/userguide/">The Docker User Guide</a>
</li>
<li >
<a href="/userguide/dockerhub/">Getting Started with Docker Hub</a>
</li>
<li >
<a href="/userguide/dockerizing/">Dockerizing Applications</a>
</li>
<li >
<a href="/userguide/usingdocker/">Working with Containers</a>
</li>
<li >
<a href="/userguide/dockerimages/">Working with Docker Images</a>
</li>
<li >
<a href="/userguide/dockerlinks/">Linking containers together</a>
</li>
<li >
<a href="/userguide/dockervolumes/">Managing data in containers</a>
</li>
<li >
<a href="/userguide/labels-custom-metadata/">Apply custom metadata</a>
</li>
<li >
<a href="/userguide/dockerrepos/">Working with Docker Hub</a>
</li>
<li >
<a href="/compose/">Docker Compose</a>
</li>
<li >
<a href="/compose/production/"> ▪ Use Compose in production</a>
</li>
<li >
<a href="/compose/extends/"> ▪ Extend Compose services</a>
</li>
<li >
<a href="/machine/">Docker Machine</a>
</li>
<li >
<a href="/swarm/">Docker Swarm</a>
</li>
<li >
<a href="/kitematic/userguide/">Kitematic</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left">
<a href="/docker-hub/">Docker Hub</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/docker-hub/">Docker Hub</a>
</li>
<li >
<a href="/docker-hub/accounts/">Accounts</a>
</li>
<li >
<a href="/docker-hub/userguide/">User Guide</a>
</li>
<li >
<a href="/docker-hub/repos/">Your Repositories</a>
</li>
<li >
<a href="/docker-hub/builds/">Automated Builds</a>
</li>
<li >
<a href="/docker-hub/official_repos/">Official Repositories</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left">
<a href="/docker-hub-enterprise/">Docker Hub Enterprise</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/docker-hub-enterprise/">Overview</a>
</li>
<li >
<a href="/docker-hub-enterprise/quick-start/">Quick Start: Basic Workflow</a>
</li>
<li >
<a href="/docker-hub-enterprise/userguide/">User Guide</a>
</li>
<li >
<a href="/docker-hub-enterprise/adminguide/">Admin Guide</a>
</li>
<li >
<a href="/docker-hub-enterprise/install/"> Installation</a>
</li>
<li >
<a href="/docker-hub-enterprise/configuration/"> Configuration options</a>
</li>
<li >
<a href="/docker-hub-enterprise/support/">Support</a>
</li>
<li >
<a href="/docker-hub-enterprise/release-notes/">Release notes</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left">
<a href="/examples/nodejs_web_app/">Examples</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/examples/nodejs_web_app/">Dockerizing a Node.js web application</a>
</li>
<li >
<a href="/examples/mongodb/">Dockerizing MongoDB</a>
</li>
<li >
<a href="/examples/running_redis_service/">Dockerizing a Redis service</a>
</li>
<li >
<a href="/examples/postgresql_service/">Dockerizing a PostgreSQL service</a>
</li>
<li >
<a href="/examples/running_riak_service/">Dockerizing a Riak service</a>
</li>
<li >
<a href="/examples/running_ssh_service/">Dockerizing an SSH service</a>
</li>
<li >
<a href="/examples/couchdb_data_volumes/">Dockerizing a CouchDB service</a>
</li>
<li >
<a href="/examples/apt-cacher-ng/">Dockerizing an Apt-Cacher-ng service</a>
</li>
<li >
<a href="/compose/django/">Getting started with Compose and Django</a>
</li>
<li >
<a href="/compose/rails/">Getting started with Compose and Rails</a>
</li>
<li >
<a href="/compose/wordpress/">Getting started with Compose and Wordpress</a>
</li>
<li >
<a href="/kitematic/minecraft-server/">Kitematic: Minecraft server</a>
</li>
<li >
<a href="/kitematic/nginx-web-server/">Kitematic: Ngnix web server</a>
</li>
<li >
<a href="/kitematic/rethinkdb-dev-database/">Kitematic: RethinkDB development database</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left active">
<a href="/articles/basics/">Articles</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/articles/basics/">Docker basics</a>
</li>
<li >
<a href="/articles/networking/">Advanced networking</a>
</li>
<li >
<a href="/articles/security/">Security</a>
</li>
<li class="active">
<a href="/articles/https/">Running Docker with HTTPS</a>
</li>
<li >
<a href="/articles/registry_mirror/">Run a local registry mirror</a>
</li>
<li >
<a href="/articles/host_integration/">Automatically starting containers</a>
</li>
<li >
<a href="/articles/baseimages/">Creating a base image</a>
</li>
<li >
<a href="/articles/dockerfile_best-practices/">Best practices for writing Dockerfiles</a>
</li>
<li >
<a href="/articles/certificates/">Using certificates for repository client verification</a>
</li>
<li >
<a href="/articles/using_supervisord/">Using Supervisor</a>
</li>
<li >
<a href="/articles/configuring/">Configuring Docker</a>
</li>
<li >
<a href="/articles/cfengine_process_management/">Process management with CFEngine</a>
</li>
<li >
<a href="/articles/puppet/">Using Puppet</a>
</li>
<li >
<a href="/articles/chef/">Using Chef</a>
</li>
<li >
<a href="/articles/dsc/">Using PowerShell DSC</a>
</li>
<li >
<a href="/articles/ambassador_pattern_linking/">Cross-Host linking using ambassador containers</a>
</li>
<li >
<a href="/articles/runmetrics/">Runtime metrics</a>
</li>
<li >
<a href="/articles/b2d_volume_resize/">Increasing a Boot2Docker volume</a>
</li>
<li >
<a href="/articles/systemd/">Controlling and configuring Docker using Systemd</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left">
<a href="/reference/commandline/cli/">Reference</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/reference/commandline/cli/">Docker command line</a>
</li>
<li >
<a href="/reference/builder/">Dockerfile</a>
</li>
<li >
<a href="/faq/">FAQ</a>
</li>
<li >
<a href="/reference/run/">Run Reference</a>
</li>
<li >
<a href="/compose/cli/">Compose command line</a>
</li>
<li >
<a href="/compose/yml/">Compose yml</a>
</li>
<li >
<a href="/compose/env/">Compose ENV variables</a>
</li>
<li >
<a href="/compose/completion/">Compose commandline completion</a>
</li>
<li >
<a href="/swarm/discovery/">Swarm discovery</a>
</li>
<li >
<a href="/swarm/scheduler/strategy/">Swarm strategies</a>
</li>
<li >
<a href="/swarm/scheduler/filter/">Swarm filters</a>
</li>
<li >
<a href="/swarm/API/">Swarm API</a>
</li>
<li >
<a href="/registry/">Docker Registry 2.0</a>
</li>
<li >
<a href="/registry/deploying/"> ▪ Deploy a registry</a>
</li>
<li >
<a href="/registry/configuration/"> ▪ Configure a registry</a>
</li>
<li >
<a href="/registry/storagedrivers/"> ▪ Storage driver model</a>
</li>
<li >
<a href="/registry/notifications/"> ▪ Work with notifications</a>
</li>
<li >
<a href="/registry/spec/api/"> ▪ Registry Service API v2</a>
</li>
<li >
<a href="/registry/spec/json/"> ▪ JSON format</a>
</li>
<li >
<a href="/registry/spec/auth/token/"> ▪ Authenticate via central service</a>
</li>
<li >
<a href="/reference/api/hub_registry_spec/">Docker Hub and Registry 1.0</a>
</li>
<li >
<a href="/reference/api/registry_api/"> ▪ Docker Registry API v1</a>
</li>
<li >
<a href="/reference/api/registry_api_client_libraries/"> ▪ Docker Registry 1.0 API Client Libraries</a>
</li>
<li >
<a href="/reference/api/docker-io_api/">Docker Hub API</a>
</li>
<li >
<a href="/reference/api/docker_remote_api/">Docker Remote API</a>
</li>
<li >
<a href="/reference/api/docker_remote_api_v1.18/">Docker Remote API v1.18</a>
</li>
<li >
<a href="/reference/api/docker_remote_api_v1.17/">Docker Remote API v1.17</a>
</li>
<li >
<a href="/reference/api/docker_remote_api_v1.16/">Docker Remote API v1.16</a>
</li>
<li >
<a href="/reference/api/remote_api_client_libraries/">Docker Remote API client libraries</a>
</li>
<li >
<a href="/reference/api/docker_io_accounts_api/">Docker Hub accounts API</a>
</li>
<li >
<a href="/kitematic/faq/">Kitematic: FAQ</a>
</li>
<li >
<a href="/kitematic/known-issues/">Kitematic: Known issues</a>
</li>
</ul>
</li>
<li class="dd_menu pull-left">
<a href="/project/who-written-for/">Contributor</a>
<ul class="dd_submenu" style="max-height: 75px;">
<li >
<a href="/project/who-written-for/">README first</a>
</li>
<li >
<a href="/project/software-required/">Get required software for Linux or OS X</a>
</li>
<li >
<a href="/project/software-req-win/">Get required software for Windows</a>
</li>
<li >
<a href="/project/set-up-git/">Configure Git for contributing</a>
</li>
<li >
<a href="/project/set-up-dev-env/">Work with a development container</a>
</li>
<li >
<a href="/project/test-and-docs/">Run tests and test documentation</a>
</li>
<li >
<a href="/project/make-a-contribution/">Understand contribution workflow</a>
</li>
<li >
<a href="/project/find-an-issue/">Find an issue</a>
</li>
<li >
<a href="/project/work-issue/">Work on an issue</a>
</li>
<li >
<a href="/project/create-pr/">Create a pull request</a>
</li>
<li >
<a href="/project/review-pr/">Participate in the PR review</a>
</li>
<li >
<a href="/project/advanced-contributing/">Advanced contributing</a>
</li>
<li >
<a href="/project/get-help/">Where to get help</a>
</li>
<li >
<a href="/project/coding-style/">Coding style guide</a>
</li>
<li >
<a href="/project/doc-style/">Documentation style guide</a>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<div id="content" class="container">
<div class="row">
<div class="span3" id="leftnav">
<div id="toc_table">
<ul class="nav nav-tabs nav-stacked">
<li class=""><a href="#create-a-ca-server-and-client-keys-with-openssl">Create a CA, server and client keys with OpenSSL</a>
<ul>
</ul>
</li>
<li class=""><a href="#secure-by-default">Secure by default</a>
<ul>
</ul>
</li>
<li class=""><a href="#other-modes">Other modes</a>
<ul>
<li><a href="#daemon-modes">Daemon modes</a></li>
<li><a href="#client-modes">Client modes</a></li>
<li><a href="#connecting-to-the-secure-docker-port-using-curl">Connecting to the Secure Docker port using curl</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="span9 content-body">
<div id="versionnav" class="span3 pull-right invisible">
<ul class="nav version pull-right">
<li class="dropdown">
<a id="document-version-number" class="dropdown-toggle" data-toggle="dropdown" href="#">
Version v1.6
</a>
<ul id="documentation-version-list" class="dropdown-menu pull-right">
<li role="presentation" class="divider"></li>
<li> <a class="home-link3 tertiary-nav" href="https://github.com/docker/docker/blob/master/docs/sources/articles/https.md" >Edit on GitHub</a></li>
</ul>
</li>
</ul>
</div>
<h1 id="protecting-the-docker-daemon-socket-with-https">Protecting the Docker daemon Socket with HTTPS</h1>
<p>By default, Docker runs via a non-networked Unix socket. It can also
optionally communicate using a HTTP socket.</p>
<p>If you need Docker to be reachable via the network in a safe manner, you can
enable TLS by specifying the <code>tlsverify</code> flag and pointing Docker's
<code>tlscacert</code> flag to a trusted CA certificate.</p>
<p>In the daemon mode, it will only allow connections from clients
authenticated by a certificate signed by that CA. In the client mode,
it will only connect to servers with a certificate signed by that CA.</p>
<blockquote>
<p><strong>Warning</strong>:
Using TLS and managing a CA is an advanced topic. Please familiarize yourself
with OpenSSL, x509 and TLS before using it in production.</p>
<p><strong>Warning</strong>:
These TLS commands will only generate a working set of certificates on Linux.
Mac OS X comes with a version of OpenSSL that is incompatible with the
certificates that Docker requires.</p>
</blockquote>
<h2 id="create-a-ca-server-and-client-keys-with-openssl">Create a CA, server and client keys with OpenSSL</h2>
<blockquote>
<p><strong>Note</strong>: replace all instances of <code>$HOST</code> in the following example with the
DNS name of your Docker daemon's host.</p>
</blockquote>
<p>First generate CA private and public keys:</p>
<pre class="prettyprint well"><code>$ openssl genrsa -aes256 -out ca-key.pem 4096
Generating RSA private key, 4096 bit long modulus
............................................................................................................................................................................................++
........++
e is 65537 (0x10001)
Enter pass phrase for ca-key.pem:
Verifying - Enter pass phrase for ca-key.pem:
$ openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem
Enter pass phrase for ca-key.pem:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:Queensland
Locality Name (eg, city) []:Brisbane
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker Inc
Organizational Unit Name (eg, section) []:Boot2Docker
Common Name (e.g. server FQDN or YOUR name) []:$HOST
Email Address []:Sven@home.org.au
</code></pre>
<p>Now that we have a CA, you can create a server key and certificate
signing request (CSR). Make sure that "Common Name" (i.e., server FQDN or YOUR
name) matches the hostname you will use to connect to Docker:</p>
<blockquote>
<p><strong>Note</strong>: replace all instances of <code>$HOST</code> in the following example with the
DNS name of your Docker daemon's host.</p>
</blockquote>
<pre class="prettyprint well"><code>$ openssl genrsa -out server-key.pem 4096
Generating RSA private key, 4096 bit long modulus
.....................................................................++
.................................................................................................++
e is 65537 (0x10001)
$ openssl req -subj "/CN=$HOST" -sha256 -new -key server-key.pem -out server.csr
</code></pre>
<p>Next, we're going to sign the public key with our CA:</p>
<p>Since TLS connections can be made via IP address as well as DNS name, they need
to be specified when creating the certificate. For example, to allow connections
using <code>10.10.10.20</code> and <code>127.0.0.1</code>:</p>
<pre class="prettyprint well"><code>$ echo subjectAltName = IP:10.10.10.20,IP:127.0.0.1 > extfile.cnf
$ openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem \
-CAcreateserial -out server-cert.pem -extfile extfile.cnf
Signature ok
subject=/CN=your.host.com
Getting CA Private Key
Enter pass phrase for ca-key.pem:
</code></pre>
<p>For client authentication, create a client key and certificate signing
request:</p>
<pre class="prettyprint well"><code>$ openssl genrsa -out key.pem 4096
Generating RSA private key, 4096 bit long modulus
.........................................................++
................++
e is 65537 (0x10001)
$ openssl req -subj '/CN=client' -new -key key.pem -out client.csr
</code></pre>
<p>To make the key suitable for client authentication, create an extensions
config file:</p>
<pre class="prettyprint well"><code>$ echo extendedKeyUsage = clientAuth > extfile.cnf
</code></pre>
<p>Now sign the public key:</p>
<pre class="prettyprint well"><code>$ openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-key.pem \
-CAcreateserial -out cert.pem -extfile extfile.cnf
Signature ok
subject=/CN=client
Getting CA Private Key
Enter pass phrase for ca-key.pem:
</code></pre>
<p>After generating <code>cert.pem</code> and <code>server-cert.pem</code> you can safely remove the
two certificate signing requests:</p>
<pre class="prettyprint well"><code>$ rm -v client.csr server.csr
</code></pre>
<p>With a default <code>umask</code> of 022, your secret keys will be <em>world-readable</em> and
writable for you and your group.</p>
<p>In order to protect your keys from accidental damage, you will want to remove their
write permissions. To make them only readable by you, change file modes as follows:</p>
<pre class="prettyprint well"><code>$ chmod -v 0400 ca-key.pem key.pem server-key.pem
</code></pre>
<p>Certificates can be world-readable, but you might want to remove write access to
prevent accidental damage:</p>
<pre class="prettyprint well"><code>$ chmod -v 0444 ca.pem server-cert.pem cert.pem
</code></pre>
<p>Now you can make the Docker daemon only accept connections from clients
providing a certificate trusted by our CA:</p>
<pre class="prettyprint well"><code>$ docker -d --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem --tlskey=server-key.pem \
-H=0.0.0.0:2376
</code></pre>
<p>To be able to connect to Docker and validate its certificate, you now
need to provide your client keys, certificates and trusted CA:</p>
<blockquote>
<p><strong>Note</strong>: replace all instances of <code>$HOST</code> in the following example with the
DNS name of your Docker daemon's host.</p>
</blockquote>
<pre class="prettyprint well"><code>$ docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem \
-H=$HOST:2376 version
</code></pre>
<blockquote>
<p><strong>Note</strong>:
Docker over TLS should run on TCP port 2376.</p>
<p><strong>Warning</strong>:
As shown in the example above, you don't have to run the <code>docker</code> client
with <code>sudo</code> or the <code>docker</code> group when you use certificate authentication.
That means anyone with the keys can give any instructions to your Docker
daemon, giving them root access to the machine hosting the daemon. Guard
these keys as you would a root password!</p>
</blockquote>
<h2 id="secure-by-default">Secure by default</h2>
<p>If you want to secure your Docker client connections by default, you can move
the files to the <code>.docker</code> directory in your home directory -- and set the
<code>DOCKER_HOST</code> and <code>DOCKER_TLS_VERIFY</code> variables as well (instead of passing
<code>-H=tcp://$HOST:2376</code> and <code>--tlsverify</code> on every call).</p>
<pre class="prettyprint well"><code>$ mkdir -pv ~/.docker
$ cp -v {ca,cert,key}.pem ~/.docker
$ export DOCKER_HOST=tcp://$HOST:2376 DOCKER_TLS_VERIFY=1
</code></pre>
<p>Docker will now connect securely by default:</p>
<pre class="prettyprint well"><code>$ docker ps
</code></pre>
<h2 id="other-modes">Other modes</h2>
<p>If you don't want to have complete two-way authentication, you can run
Docker in various other modes by mixing the flags.</p>
<h3 id="daemon-modes">Daemon modes</h3>
<ul>
<li><code>tlsverify</code>, <code>tlscacert</code>, <code>tlscert</code>, <code>tlskey</code> set: Authenticate clients</li>
<li><code>tls</code>, <code>tlscert</code>, <code>tlskey</code>: Do not authenticate clients</li>
</ul>
<h3 id="client-modes">Client modes</h3>
<ul>
<li><code>tls</code>: Authenticate server based on public/default CA pool</li>
<li><code>tlsverify</code>, <code>tlscacert</code>: Authenticate server based on given CA</li>
<li><code>tls</code>, <code>tlscert</code>, <code>tlskey</code>: Authenticate with client certificate, do not
authenticate server based on given CA</li>
<li><code>tlsverify</code>, <code>tlscacert</code>, <code>tlscert</code>, <code>tlskey</code>: Authenticate with client
certificate and authenticate server based on given CA</li>
</ul>
<p>If found, the client will send its client certificate, so you just need
to drop your keys into <code>~/.docker/{ca,cert,key}.pem</code>. Alternatively,
if you want to store your keys in another location, you can specify that
location using the environment variable <code>DOCKER_CERT_PATH</code>.</p>
<pre class="prettyprint well"><code>$ export DOCKER_CERT_PATH=~/.docker/zone1/
$ docker --tlsverify ps
</code></pre>
<h3 id="connecting-to-the-secure-docker-port-using-curl">Connecting to the Secure Docker port using <code>curl</code></h3>
<p>To use <code>curl</code> to make test API requests, you need to use three extra command line
flags:</p>
<pre class="prettyprint well"><code>$ curl https://$HOST:2376/images/json \
--cert ~/.docker/cert.pem \
--key ~/.docker/key.pem \
--cacert ~/.docker/ca.pem
</code></pre>
</div>
</div>
</div>
<div id="push-footer"></div>
</div>
<div id="footer-container" class="container">
<div id="footer" class="grey-body">
<div class="row">
<div class="span2">
<span class="footer-title">Community</span>
<ul class="unstyled">
<li><a class="primary-button" href="https://www.docker.com/community/events/">Events</a></li>
<li><a class="primary-button" href="http://posts.docker.com">Friends' Posts</a></li>
<li><a class="primary-button" href="https://www.docker.com/community/meetups/">Meetups</a></li>
<li><a class="primary-button" href="https://www.docker.com/community/governance/">Governance</a></li>
<li><a class="primary-button" href="http://forums.docker.com">Forums</a></li>
<li><a class="primary-button" href="http://botbot.me/freenode/docker">IRC</a></li>
<li><a class="primary-button" href="https://github.com/docker/docker">GitHub</a></li>
<li><a class="primary-button" href="http://stackoverflow.com/search?q=docker">Stackoverflow</a></li>
<li><a class="primary-button" href="http://www.cafepress.com/docker">Swag</a></li>
</ul>