-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs-quick-start-installation.html
902 lines (545 loc) · 51.1 KB
/
docs-quick-start-installation.html
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
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content=" Quick Start Before you beginIf you have an earlier version of Singularity installed, you should remove it before executing the installation commands.These instructions will build Singularity from source on your system. So you will need to have some development tools installed. If you run into missing dependencies, try installing them like so:Ubuntu$ sudo apt-get update && \ sudo apt-get install \ python \ dh-autoreconf \ build-essentialCentos$ sudo yum update && \ sudo yum groupinstall 'Development Tools'Show Video Tutorial Install the master branchThe following commands will install the latest version of the GitHub repo master branch to /usr/local.$ git clone https://github.com/singularityware/singularity.git$ cd singularity$ ./autogen.sh$ ./configure --prefix=/usr/local --sysconfdir=/etc$ make$ sudo make installNote that the installation prefix is /usr/local but the configuration directory is /etc. This ensures that the configuration file singularity.conf is placed in the standard location.If you omit the --sysconfdir option , the configuration file will be installed in /usr/local/etc. If you omit the --prefix option, Singularity will be installed in the /usr/local directory hierarchy by default. And if you specify a custom directory with the --prefix option, all of Singularity’s binaries and the configuration file will be installed within that directory. This last option can be useful if you want to install multiple versions of Singularity, install Singularity on a shared system, or if you want to remove Singularity easily after installing it.Show Video Tutorial Install a specific releaseThe following commands will install a specific release from GitHub releases page to /usr/local.$ VER=2.2.1$ wget https://github.com/singularityware/singularity/releases/download/$VER/singularity-$VER.tar.gz$ tar xvf singularity-$VER.tar.gz$ cd singularity-$VER$ ./configure --prefix=/usr/local --sysconfdir=/etc$ make$ sudo make installInstall the development branchIf you want to test a development branch feature the routine above should be tweaked slightly:$ git clone https://github.com/singularityware/singularity.git$ cd singularity$ git fetch$ git checkout development$ ./autogen.sh$ ./configure --prefix=/usr/local --sysconfdir=/etc$ make$ sudo make installRemove an old versionLet’s say that we installed Singularity to /usr/local. To remove it completely, you need to hit all of the following:$ sudo rm -rf /usr/local/libexec/singularity$ sudo rm -rf /usr/local/etc/singularity$ sudo rm -rf /usr/local/include/singularity$ sudo rm -rf /usr/local/lib/singularity$ sudo rm -rf /usr/local/var/lib/singularity/$ sudo rm /usr/local/bin/singularity$ sudo rm /usr/local/bin/run-singularity$ sudo rm /usr/local/etc/bash_completion.d/singularity $ sudo rm /usr/local/man/man1/singularity.1If you modified the system configuration directory, remove the singularity.conf file there as well.If you installed Singularity in a custom directory, you need only remove that directory to uninstall Singularity. For instance if you installed singularity with the --prefix=/some/temp/dir option argument pair, you can remove Singularity like so:$ sudo rm -rf /some/temp/dirOverview of the Singularity InterfaceSingularity is a command line interface that is designed to interact with containerized applications as transparently as possible. This means you can run programs inside a container as if they were running on your host system. You can easily redirect IO, use pipes, pass arguments, and access files, sockets, and ports on the host system from within a container.Once you have Singularity installed, you should inspect the output of the --help option as follows:$ singularity --helpUSAGE: singularity [global options...] <command> [command options...] ...GLOBAL OPTIONS: -d --debug Print debugging information -h --help Display usage summary -q --quiet Only print errors --version Show application version -v --verbose Increase verbosity +1 -x --sh-debug Print shell wrapper debugging informationGENERAL COMMANDS: help Show additional help for a command selftest Run some self tests to make sure Singularity is installed and operating properlyCONTAINER USAGE COMMANDS: exec Execute a command within container run Launch a runscript within container shell Run a Bourne shell within container test Execute any test code defined within containerCONTAINER USAGE OPTIONS: see singularity help <command>CONTAINER MANAGEMENT COMMANDS (requires root): bootstrap Bootstrap a new Singularity image from scratch copy Copy files from your host into the container create Create a new container image expand Grow the container image export Export the contents of a container via a tar pipe import Import/add container contents via a tar pipe mount Mount a Singularity container imageCONTAINER REGISTRY COMMANDS: pull pull a Singularity Hub container to $PWDFor any additional help or support visit the Singularitywebsite: http://singularity.lbl.gov/Notice the first line marked USAGE: and the placement of the options. Option placement is very important in Singularity. It ensures that the right options are being parsed at the right time. For instance, if you were to run a command inside the container called foo -v, then Singularity must be aware that the option -v that you are passing to the command foo is not intended to be parsed or interfered with by Singularity.For example, you may pass the -v option twice, once in the Singularity global options and once for the command that you are executing inside the container. The final command may look like:$ singularity -v exec container.img foo -vThis means that debugging looks like the following:$ singularity --debug create container.imgQuiet is the same position:$ singularity --quiet create container.imgBut if we were to bind a directory within a container, it must come after the command because --bind is not a global option!$ singularity run --bind /local/path:/container/path container.imgThe take home message here is that option placement is exceedingly important. The algorithm that Singularity uses for option parsing for both global options as well as subcommand options is as follows: Read in the current option name If the option is recognized do what is needed, move to next option (goto #1) If the paramater is prefixed with a - (hyphen) but is not recognized, error out If the next option is not prefixed with a - (hyphen), then assume we are done with option parsingThis means that options will continue to be parsed until no more options are listed.note: Options that require data (e.g. --bind <path>) must be separated by white space, not an equals sign!As the above USAGE: describes, Singularity will parse the command as follows: Singularity command (singularity) Global options Singularity subcommand (shell or exec) Subcommand options Any additional input is passed to the subcommandYou can get additional help on any of the Singularity subcommands by using any one of the following command syntaxes:$ singularity help <subcommand>$ singularity --help <subcommand>$ singularity -h <subcommand>$ singularity <subcommand> --help$ singularity <subcommand -hShell into a Non-Persistent ContainerAt this point, you can easily test Singularity by downloading and running a non-persistent container. As mentioned earlier, Singularity has the ability to interface with the main Docker Registry, so let’s start off by pulling a container down from the main Docker Registry and launching a shell inside of a given container:$ singularity shell docker://ubuntu:latestImporting: base Singularity environmentCache folder set to /home/vanessa/.singularity/dockerExploding layer: sha256:6d9ef359eaaa311860550b478790123c4b22a2eaede8f8f46691b0b4433c08cf.tar.gzExploding layer: sha256:9654c40e9079e3d5b271ec71f6d83f8ce80cfa6f09d9737fc6bfd4d2456fed3f.tar.gzExploding layer: sha256:e8db7bf7c39fab6fec91b1b61e3914f21e60233c9823dd57c60bc360191aaf0d.tar.gzExploding layer: sha256:f8b845f45a87dc7c095b15f3d9661e640ebc86f42cd8e8ab36674846472027f7.tar.gzExploding layer: sha256:d54efb8db41d4ac23d29469940ec92da94c9a6c2d9e26ec060bebad1d1b0e48d.tar.gzExploding layer: sha256:fe44851d529f465f9aa107b32351c8a0a722fc0619a2a7c22b058084fac068a4.tar.gzSingularity: Invoking an interactive shell within container...Singularity ubuntu:latest:\w> cat /etc/lsb-releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=16.04DISTRIB_CODENAME=xenialDISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"Singularity ubuntu:latest:\w> which apt-get/usr/bin/apt-getIn this example, you started on your (insert OS here) host operating system, ran Singularity as a non-root user and used a URI which tells Singularity to pull a given container from the main Docker Registry and execute a shell within it. In this example, we are not telling Singularity to use a local image, which means that any changes we make will be non-persistent (e.g. the container is removed automatically as soon as the shell is exited). It’s also salient to note that you don’t need to have Docker installed to use an image from Docker Hub.You may select other images that are currently hosted on the main Docker Hub Library.Show Video Tutorial Container GutsWhere do we keep metadata and things? The metadata folder is located within the image under the root directory at /.singularity.dSingularity ubuntu:latest:\w> ls /.singularity.dactions env labels.json runscriptThe runscript is linked to the file /singularity. Within env we have different files that were sourced by the container to generate the /environment file at the root of the image, in the order specified.ls /.singularity.d/env01-base.sh 10-docker.shlabels.json is metadata about the container, both from the bootstrap or creation, and from Docker (if relevant). These files should not be edited manually. Instead, add variables to your bootstrap specification file that will automatically generate these files.Show Video Tutorial Creating a New Singularity ImageSingularity’s primary objectives are: mobility reproducibility archiving environmentsThese features are realized via the Singularity image file. As explained earlier, Singularity images are individual files which can be copied, shared, and easily archived along with relevant data. This means that the all computational components can be easily replicated, utilized, and extended by other users.The first part of building your reproducible container is to create the raw Singularity image file:$ singularity create container.imgCreating a new image with a maximum size of 768MiB...Executing image create helperFormatting image with ext3 file systemDone.Think of this as an empty file system that you can fill with an OS, apps, and data. You can override the default size (which varies somewhat according to which version of Singularity you are using) by specifying the --size option in MiB as follows:$ singularity create --size 2048 container.imgCreating a new image with a maximum size of 2048MiB...Executing image create helperFormatting image with ext3 file systemDone.$ ls -l container.img-rwxr-xr-x 1 user group 2147483680 Dec 25 06:00 container.imgNote the permissions of the resulting file. While the umask is adhered to, you should find that the file is executable. At this point there is nothing to execute within that image. But once this image contains a proper operating system, you can define what it will do when it is executed directly.Show Video Tutorial Bootstrapping a Singularity ImageThe final step in creating a fully functional Singularity container is to execute the bootstrap command. This installs an operating system, apps, and creates an environment within the image.To bootstrap an image, you first need a definition file. This acts as a set of blueprints describing how to build the container. The Singularity repository contains an examples subdirectory with several definition files. Assuming that you git cloned the Singularity repository into your current working directory and you already executed the create command above, you could bootstrap your image like so. (The exact path to the definition file may vary depending on the version of Singularity you installed.)$ sudo singularity bootstrap container.img singularity/examples/ubuntu/SingularityYou will see a lot of standard output as Singularity downloads and installs all the pieces for Ubuntu into your image. After it completes, you will have a fully functional container!Show Video Tutorial What should you do next? How about learning how to interact with your container via the shell, exec, or run commands. Or click next below to continue the tutorial. Previous Next Edit me Site last generated: Jul 26, 2017 ">
<meta name="name" content="Quick Start">
<meta name="thumbnail" content="http://singularity.lbl.gov/images/logo/logo.svg">
<title>Quick Start | Singularity</title>
<link rel="stylesheet" href="assets/css/syntax.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">-->
<link rel="stylesheet" href="assets/css/modern-business.css">
<link rel="stylesheet" href="assets/css/lavish-bootstrap.css">
<link rel="stylesheet" href="assets/css/customstyles.css">
<link rel="stylesheet" href="assets/css/theme-blue.css">
<link rel="stylesheet" type="text/css" href="assets/css/asciinema-player.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="assets/js/jquery.navgoco.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/2.0.0/anchor.min.js"></script>
<script src="assets/js/toc.js"></script>
<script src="assets/js/customscripts.js"></script>
<link rel="shortcut icon" href="images/favicon/favicon.ico">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[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.4.2/respond.min.js"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="" href="http://localhost:4005feed.xml">
<script>
$(document).ready(function() {
// Initialize navgoco with default options
$("#mysidebar").navgoco({
caretHtml: '',
accordion: true,
openClass: 'active', // open
save: false, // leave false or nav highlighting doesn't work right
cookie: {
name: 'navgoco',
expires: false,
path: '/'
},
slide: {
duration: 400,
easing: 'swing'
}
});
$("#collapseAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', false);
});
$("#expandAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', true);
});
});
</script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</head>
<body>
<!-- asciinema player -->
<script src="assets/js/asciinema-player.js"></script>
<!-- Show or hide players on button clicks-->
<script>
$( document ).ready(function() {
$(".asciinema-button").click(function(){
var asciinemaVideo = "#asciinema-" + $(this).attr('id');
if ($(asciinemaVideo).hasClass('hidden')){
$(asciinemaVideo).removeClass('hidden');
$(this).text('Hide Tutorial')
} else {
$(asciinemaVideo).addClass('hidden');
$(this).text('Show Tutorial')
}
});
});
</script>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container topnavlinks">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"> <span class="projectTitle"> Singularity</span></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<!-- entries without drop-downs appear here -->
<li><a href="blog">News</a></li>
<!-- entries with drop-downs appear here -->
<!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Docs<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="admin-guide">Admin Guide</a></li>
<li><a href="user-guide">User Guide</a></li>
<li><a href="links">Contributed Content</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Quick Links<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/singularityware/singularity" target="_blank">Github Repo</a></li>
<li><a href="https://groups.google.com/a/lbl.gov/forum/#!forum/singularity" target="_blank">Google Group</a></li>
<li><a href="http://stackoverflow.com/questions/tagged/singularity" target="_blank">Singularity on Stack Overflow</a></li>
<li><a href="https://singularity-hub.org/faq" target="_blank">Singularity Hub</a></li>
<li><a href="https://singularity-container.slack.com" target="_blank">Slack</a></li>
<li><a href="faq#troubleshooting">Troubleshooting</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">People<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/gmkurtzer" target="_blank">Gregory M. Kurtzer</a></li>
<li><a href="https://github.com/vsoch" target="_blank">Vanessa Sochat</a></li>
<li><a href="https://github.com/bauerm97" target="_blank">Michael Bauer</a></li>
<li><a href="https://github.com/bbockelm" target="_blank">Brian Bockelman</a></li>
<li><a href="https://github.com/singularityware/singularity/blob/master/AUTHORS" target="_blank">Complete Authors List</a></li>
</ul>
</li>
<li><a href="/search"><i class="fa fa-search"></i></li>
<!-- jekyll search hidden in favor of google
<li>
<div id="search-demo-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
</div>
<script src="assets/js/jekyll-search.js" type="text/javascript"></script>
<script type="text/javascript">
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
dataSource: 'search.json',
searchResultTemplate: '<li><a href="{url}" title="Quick Start">{title}</a></li>',
noResultsText: 'No results found.',
limit: 10,
fuzzy: true,
})
</script>
end search-->
</li>
</ul>
</div>
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<div class="container">
<div class="col-lg-12"> </div>
<!-- Content Row -->
<div class="row">
<!-- Sidebar Column -->
<div class="col-md-3">
<div class="shiny"><a href="\"><figure><img src="/images/logo/logo.svg" class="sidebar-logo"/></figure></a></div>
<ul id="mysidebar" class="nav">
<li class="sidebarTitle">User Guide</li>
<li>
<a href="#">Getting Started</a>
<ul>
<li><a href="user-guide">Introduction</a></li>
<li class="active"><a href="docs-quick-start-installation">Quick Start Installation</a></li>
<li><a href="create-image">Create an Image</a></li>
<li><a href="bootstrap-image">Bootstrap an Image</a></li>
<li><a href="docs-content">Adding Content</a></li>
<li><a href="docs-mount">Bind Paths and Files</a></li>
<li><a href="docs-environment-metadata">Environment and Metadata</a></li>
<li><a href="docs-changing-containers">Change an Existing Container</a></li>
<li><a href="docs-docker">Singularity and Docker</a></li>
<li><a href="faq#troubleshooting">Troubleshooting</a></li>
</ul>
<li>
<a href="#">Commands</a>
<ul>
<li><a href="docs-usage">Command Usage</a></li>
<li><a href="docs-bootstrap">bootstrap</a></li>
<li><a href="docs-exec">exec</a></li>
<li><a href="docs-export">export</a></li>
<li><a href="docs-import">import</a></li>
<li><a href="docs-inspect">inspect</a></li>
<li><a href="docs-pull">pull</a></li>
<li><a href="docs-run">run</a></li>
<li><a href="docs-shell">shell</a></li>
</ul>
<!-- if you aren't using the accordion, uncomment this block:
<p class="external">
<a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
</p>
-->
</li>
</ul>
</div>
<!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
<script>$("li.active").parents('li').toggleClass("active");</script>
<!-- Content Column -->
<div class="col-md-9">
<div class="post-header">
<h1 class="post-title-main">Quick Start</h1>
</div>
<div class="post-content">
<!-- Previous and next buttons-->
<div class="row" style="padding-top:30px; margin-bottom:10px"><div class="col-md-12">
<a href="#"><button style="float:left" class="hidden previous-button btn btn-circle btn-default"><i class="fa-2x fa fa-angle-double-left"></i></button></a>
<a href="#"><button style="float:right" class="hidden next-button btn btn-circle btn-default"><i class="fa fa-angle-double-right fa-2x"></i></button></a>
</div></div>
<script>
$(document).ready(function(){
var next = $("li.active").next().last().find('a').attr('href');
var previous = $("li.active").prev().last().find('a').attr('href');
// NEXT BUTTON
if (typeof next == 'undefined'){
console.log("disabling next button")
$(".next-button").addClass("hidden")
} else if (next == "#") {
next = $("li.active").next().find("li").first().find('a').attr('href');
$(".next-button").closest('a').attr('href', next)
$(".next-button").removeClass('hidden')
} else {
$(".next-button").closest('a').attr('href', next)
$(".next-button").removeClass('hidden')
}
// PREVIOUS BUTTON
if (typeof previous == 'undefined'){
console.log("disabling previous button")
$(".previous-button").addClass("hidden")
} else if (previous == "#") {
previous = $("li.active").prev().find("li").last().find('a').attr('href')
$(".previous-button").closest('a').attr('href', previous)
$(".previous-button").removeClass('hidden')
} else {
$(".previous-button").closest('a').attr('href', previous)
$(".previous-button").removeClass('hidden')
}
})
</script>
<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
<script>
$( document ).ready(function() {
// Handler for .ready() called.
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
/* this offset helps account for the space taken up by the floating toolbar. */
$('#toc').on('click', 'a', function() {
var target = $(this.getAttribute('href'))
, scroll_target = target.offset().top
$(window).scrollTop(scroll_target - 10);
return false
})
});
</script>
<div id="toc"></div>
<h2 id="before-you-begin">Before you begin</h2>
<p>If you have an earlier version of Singularity installed, you should <a href="#remove-an-old-version">remove it</a> before executing the installation commands.</p>
<p>These instructions will build Singularity from source on your system. So you will need to have some development tools installed. If you run into missing dependencies, try installing them like so:</p>
<p><strong>Ubuntu</strong></p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo apt-get update && \
sudo apt-get install \
python \
dh-autoreconf \
build-essential
</code></pre>
</div>
<p><strong>Centos</strong></p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo yum update && \
sudo yum groupinstall 'Development Tools'
</code></pre>
</div>
<p><button style="color:white;margin-top:5px" class="btn btn-primary btn-lg asciinema-button" id="How-to-install-dependencies">Show Video Tutorial</button></p>
<div class="hidden" id="asciinema-How-to-install-dependencies">
<asciinema-player src="assets/asciicast/install_dependencies.js" poster="data:text/plain,How to install dependencies" title="How to install dependencies" author="[email protected]" cols="115" rows="25" speed="2.0" theme="asciinema">
</asciinema-player>
</div>
<h2 id="install-the-master-branch">Install the master branch</h2>
<p>The following commands will install the latest version of the <a href="https://github.com/singularityware/singularity">GitHub repo</a> master branch to <code class="highlighter-rouge">/usr/local</code>.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ git clone https://github.com/singularityware/singularity.git
$ cd singularity
$ ./autogen.sh
$ ./configure --prefix=/usr/local --sysconfdir=/etc
$ make
$ sudo make install
</code></pre>
</div>
<p>Note that the installation prefix is <code class="highlighter-rouge">/usr/local</code> but the configuration directory is <code class="highlighter-rouge">/etc</code>. This ensures that the configuration file <code class="highlighter-rouge">singularity.conf</code> is placed in the standard location.</p>
<p>If you omit the <code class="highlighter-rouge">--sysconfdir</code> option , the configuration file will be installed in <code class="highlighter-rouge">/usr/local/etc</code>. If you omit the <code class="highlighter-rouge">--prefix</code> option, Singularity will be installed in the <code class="highlighter-rouge">/usr/local</code> directory hierarchy by default. And if you specify a custom directory with the <code class="highlighter-rouge">--prefix</code> option, all of Singularity’s binaries and the configuration file will be installed within that directory. This last option can be useful if you want to install multiple versions of Singularity, install Singularity on a shared system, or if you want to remove Singularity easily after installing it.</p>
<p><button style="color:white;margin-top:5px" class="btn btn-primary btn-lg asciinema-button" id="How-to-install-the-master-branch">Show Video Tutorial</button></p>
<div class="hidden" id="asciinema-How-to-install-the-master-branch">
<asciinema-player src="assets/asciicast/install_master.js" poster="data:text/plain,How to install the master branch" title="How to install the master branch" author="[email protected]" cols="115" rows="25" speed="2.0" theme="asciinema">
</asciinema-player>
</div>
<h2 id="install-a-specific-release">Install a specific release</h2>
<p>The following commands will install a specific release from <a href="https://github.com/singularityware/singularity/releases">GitHub releases page</a> to <code class="highlighter-rouge">/usr/local</code>.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ VER=2.2.1
$ wget https://github.com/singularityware/singularity/releases/download/$VER/singularity-$VER.tar.gz
$ tar xvf singularity-$VER.tar.gz
$ cd singularity-$VER
$ ./configure --prefix=/usr/local --sysconfdir=/etc
$ make
$ sudo make install
</code></pre>
</div>
<h2 id="install-the-development-branch">Install the development branch</h2>
<p>If you want to test a development branch feature the routine above should be tweaked slightly:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ git clone https://github.com/singularityware/singularity.git
$ cd singularity
$ git fetch
$ git checkout development
$ ./autogen.sh
$ ./configure --prefix=/usr/local --sysconfdir=/etc
$ make
$ sudo make install
</code></pre>
</div>
<h2 id="remove-an-old-version">Remove an old version</h2>
<p>Let’s say that we installed Singularity to <code class="highlighter-rouge">/usr/local</code>. To remove it completely, you need to hit all of the following:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>sudo rm -rf /usr/local/libexec/singularity
<span class="gp">$ </span>sudo rm -rf /usr/local/etc/singularity
<span class="gp">$ </span>sudo rm -rf /usr/local/include/singularity
<span class="gp">$ </span>sudo rm -rf /usr/local/lib/singularity
<span class="gp">$ </span>sudo rm -rf /usr/local/var/lib/singularity/
<span class="gp">$ </span>sudo rm /usr/local/bin/singularity
<span class="gp">$ </span>sudo rm /usr/local/bin/run-singularity
<span class="gp">$ </span>sudo rm /usr/local/etc/bash_completion.d/singularity
<span class="gp">$ </span>sudo rm /usr/local/man/man1/singularity.1
</code></pre>
</div>
<p>If you modified the system configuration directory, remove the <code class="highlighter-rouge">singularity.conf</code> file there as well.</p>
<p>If you installed Singularity in a custom directory, you need only remove that directory to uninstall Singularity. For instance if you installed singularity with the <code class="highlighter-rouge">--prefix=/some/temp/dir</code> option argument pair, you can remove Singularity like so:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>sudo rm -rf /some/temp/dir
</code></pre>
</div>
<h2 id="overview-of-the-singularity-interface">Overview of the Singularity Interface</h2>
<p>Singularity is a command line interface that is designed to interact with containerized applications as transparently as possible. This means you can run programs inside a container as if they were running on your host system. You can easily redirect IO, use pipes, pass arguments, and access files, sockets, and ports on the host system from within a container.</p>
<p>Once you have Singularity installed, you should inspect the output of the <code class="highlighter-rouge">--help</code> option as follows:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity --help
USAGE: singularity [global options...] <command> [command options...] ...
GLOBAL OPTIONS:
-d --debug Print debugging information
-h --help Display usage summary
-q --quiet Only print errors
--version Show application version
-v --verbose Increase verbosity +1
-x --sh-debug Print shell wrapper debugging information
GENERAL COMMANDS:
help Show additional help for a command
selftest Run some self tests to make sure Singularity is
installed and operating properly
CONTAINER USAGE COMMANDS:
exec Execute a command within container
run Launch a runscript within container
shell Run a Bourne shell within container
test Execute any test code defined within container
CONTAINER USAGE OPTIONS:
see singularity help <command>
CONTAINER MANAGEMENT COMMANDS (requires root):
bootstrap Bootstrap a new Singularity image from scratch
copy Copy files from your host into the container
create Create a new container image
expand Grow the container image
export Export the contents of a container via a tar pipe
import Import/add container contents via a tar pipe
mount Mount a Singularity container image
CONTAINER REGISTRY COMMANDS:
pull pull a Singularity Hub container to $PWD
For any additional help or support visit the Singularity
website: http://singularity.lbl.gov/
</code></pre>
</div>
<p>Notice the first line marked <code class="highlighter-rouge">USAGE:</code> and the placement of the options. Option placement is very important in Singularity. It ensures that the right options are being parsed at the right time. For instance, if you were to run a command inside the container called <code class="highlighter-rouge">foo -v</code>, then Singularity must be aware that the option <code class="highlighter-rouge">-v</code> that you are passing to the command <code class="highlighter-rouge">foo</code> is not intended to be parsed or interfered with by Singularity.</p>
<p>For example, you may pass the <code class="highlighter-rouge">-v</code> option twice, once in the Singularity global options and once for the command that you are executing inside the container. The final command may look like:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity -v exec container.img foo -v
</code></pre>
</div>
<p>This means that debugging looks like the following:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity --debug create container.img
</code></pre>
</div>
<p>Quiet is the same position:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity --quiet create container.img
</code></pre>
</div>
<p>But if we were to bind a directory within a container, it must come after the command because <code class="highlighter-rouge">--bind</code> is not a global option!</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity run --bind /local/path:/container/path container.img
</code></pre>
</div>
<p>The take home message here is that option placement is exceedingly important. The algorithm that Singularity uses for option parsing for both global options as well as subcommand options is as follows:</p>
<ol>
<li>Read in the current option name</li>
<li>If the option is recognized do what is needed, move to next option (goto #1)</li>
<li>If the paramater is prefixed with a <code class="highlighter-rouge">-</code> (hyphen) but is not recognized, error out</li>
<li>If the next option is not prefixed with a <code class="highlighter-rouge">-</code> (hyphen), then assume we are done with option parsing</li>
</ol>
<p>This means that options will continue to be parsed until no more options are listed.</p>
<p><em>note: Options that require data (e.g.</em> <code class="highlighter-rouge">--bind <path></code><em>) must be separated by white space, not an equals sign!</em></p>
<p>As the above <code class="highlighter-rouge">USAGE:</code> describes, Singularity will parse the command as follows:</p>
<ol>
<li>Singularity command (<code class="highlighter-rouge">singularity</code>)</li>
<li>Global options</li>
<li>Singularity subcommand (<code class="highlighter-rouge">shell</code> or <code class="highlighter-rouge">exec</code>)</li>
<li>Subcommand options</li>
<li>Any additional input is passed to the subcommand</li>
</ol>
<p>You can get additional help on any of the Singularity subcommands by using any one of the following command syntaxes:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity help <subcommand>
$ singularity --help <subcommand>
$ singularity -h <subcommand>
$ singularity <subcommand> --help
$ singularity <subcommand -h
</code></pre>
</div>
<h2 id="shell-into-a-non-persistent-container">Shell into a Non-Persistent Container</h2>
<p>At this point, you can easily test Singularity by downloading and running a non-persistent container. As mentioned earlier, Singularity has the ability to interface with the main Docker Registry, so let’s start off by pulling a container down from the main Docker Registry and launching a shell inside of a given container:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity shell docker://ubuntu:latest
Importing: base Singularity environment
Cache folder set to /home/vanessa/.singularity/docker
Exploding layer: sha256:6d9ef359eaaa311860550b478790123c4b22a2eaede8f8f46691b0b4433c08cf.tar.gz
Exploding layer: sha256:9654c40e9079e3d5b271ec71f6d83f8ce80cfa6f09d9737fc6bfd4d2456fed3f.tar.gz
Exploding layer: sha256:e8db7bf7c39fab6fec91b1b61e3914f21e60233c9823dd57c60bc360191aaf0d.tar.gz
Exploding layer: sha256:f8b845f45a87dc7c095b15f3d9661e640ebc86f42cd8e8ab36674846472027f7.tar.gz
Exploding layer: sha256:d54efb8db41d4ac23d29469940ec92da94c9a6c2d9e26ec060bebad1d1b0e48d.tar.gz
Exploding layer: sha256:fe44851d529f465f9aa107b32351c8a0a722fc0619a2a7c22b058084fac068a4.tar.gz
Singularity: Invoking an interactive shell within container...
Singularity ubuntu:latest:\w> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
Singularity ubuntu:latest:\w> which apt-get
/usr/bin/apt-get
</code></pre>
</div>
<p>In this example, you started on your (insert OS here) host operating system, ran Singularity as a non-root user and used a URI which tells Singularity to pull a given container from the main Docker Registry and execute a shell within it. In this example, we are not telling Singularity to use a local image, which means that any changes we make will be non-persistent (e.g. the container is removed automatically as soon as the shell is exited). It’s also salient to note that you don’t need to have Docker installed to use an image from Docker Hub.</p>
<p>You may select other images that are currently hosted on the main Docker Hub Library.</p>
<p><button style="color:white;margin-top:5px" class="btn btn-primary btn-lg asciinema-button" id="How-to-shell-into-container-from-Docker">Show Video Tutorial</button></p>
<div class="hidden" id="asciinema-How-to-shell-into-container-from-Docker">
<asciinema-player src="assets/asciicast/shell_from_docker.js" poster="data:text/plain,How to shell into container from Docker" title="How to shell into container from Docker" author="[email protected]" cols="115" rows="25" speed="2.0" theme="asciinema">
</asciinema-player>
</div>
<h2 id="container-guts">Container Guts</h2>
<p>Where do we keep metadata and things? The metadata folder is located within the image under the root directory at <code class="highlighter-rouge">/.singularity.d</code></p>
<div class="highlighter-rouge"><pre class="highlight"><code>Singularity ubuntu:latest:\w> ls /.singularity.d
actions env labels.json runscript
</code></pre>
</div>
<p>The <code class="highlighter-rouge">runscript</code> is linked to the file <code class="highlighter-rouge">/singularity</code>. Within <code class="highlighter-rouge">env</code> we have different files that were sourced by the container to generate the <code class="highlighter-rouge">/environment</code> file at the root of the image, in the order specified.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>ls /.singularity.d/env
01-base.sh 10-docker.sh
</code></pre>
</div>
<p><code class="highlighter-rouge">labels.json</code> is metadata about the container, both from the bootstrap or creation, and from Docker (if relevant). These files should not be edited manually. Instead, add variables to your <a href="/docs-bootstrap">bootstrap specification</a> file that will automatically generate these files.</p>
<p><button style="color:white;margin-top:5px" class="btn btn-primary btn-lg asciinema-button" id="Viewing-container-meta-data">Show Video Tutorial</button></p>
<div class="hidden" id="asciinema-Viewing-container-meta-data">
<asciinema-player src="assets/asciicast/container_guts.js" poster="data:text/plain,Viewing container meta-data" title="Viewing container meta-data" author="[email protected]" cols="115" rows="25" speed="2.0" theme="asciinema">
</asciinema-player>
</div>
<h2 id="creating-a-new-singularity-image">Creating a New Singularity Image</h2>
<p>Singularity’s primary objectives are:</p>
<ul>
<li>mobility</li>
<li>reproducibility</li>
<li>archiving environments</li>
</ul>
<p>These features are realized via the Singularity image file. As explained earlier, Singularity images are individual files which can be copied, shared, and easily archived along with relevant data. This means that the all computational components can be easily replicated, utilized, and extended by other users.</p>
<p>The first part of building your reproducible container is to create the raw Singularity image file:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity create container.img
Creating a new image with a maximum size of 768MiB...
Executing image create helper
Formatting image with ext3 file system
Done.
</code></pre>
</div>
<p>Think of this as an empty file system that you can fill with an OS, apps, and data. You can override the default size (which varies somewhat according to which version of Singularity you are using) by specifying the <code class="highlighter-rouge">--size</code> option in MiB as follows:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ singularity create --size 2048 container.img
Creating a new image with a maximum size of 2048MiB...
Executing image create helper
Formatting image with ext3 file system
Done.
$ ls -l container.img
-rwxr-xr-x 1 user group 2147483680 Dec 25 06:00 container.img
</code></pre>
</div>
<p>Note the permissions of the resulting file. While the <code class="highlighter-rouge">umask</code> is adhered to, you should find that the file is executable. At this point there is nothing to execute within that image. But once this image contains a proper operating system, you can define what it will do when it is executed directly.</p>
<p><button style="color:white;margin-top:5px" class="btn btn-primary btn-lg asciinema-button" id="How-to-create-an-image">Show Video Tutorial</button></p>
<div class="hidden" id="asciinema-How-to-create-an-image">
<asciinema-player src="assets/asciicast/create_new_image.js" poster="data:text/plain,How to create an image" title="How to create an image" author="[email protected]" cols="115" rows="25" speed="2.0" theme="asciinema">
</asciinema-player>
</div>
<h2 id="bootstrapping-a-singularity-image">Bootstrapping a Singularity Image</h2>
<p>The final step in creating a fully functional Singularity container is to execute the <code class="highlighter-rouge">bootstrap</code> command. This installs an operating system, apps, and creates an environment within the image.</p>
<p>To bootstrap an image, you first need a <a href="/bootstrap-image#the-bootstrap-definition-file">definition file</a>. This acts as a set of blueprints describing how to build the container. The Singularity repository contains an <code class="highlighter-rouge">examples</code> subdirectory with several definition files. Assuming that you <code class="highlighter-rouge">git cloned</code> the Singularity repository into your current working directory and you already executed the <code class="highlighter-rouge">create</code> command above, you could bootstrap your image like so. (The exact path to the definition file may vary depending on the version of Singularity you installed.)</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo singularity bootstrap container.img singularity/examples/ubuntu/Singularity
</code></pre>
</div>
<p>You will see a lot of standard output as Singularity downloads and installs all the pieces for Ubuntu into your image. After it completes, you will have a fully functional container!</p>
<p><button style="color:white;margin-top:5px" class="btn btn-primary btn-lg asciinema-button" id="How-to-bootstrap-an-image">Show Video Tutorial</button></p>
<div class="hidden" id="asciinema-How-to-bootstrap-an-image">
<asciinema-player src="assets/asciicast/bootstrap_new_image.js" poster="data:text/plain,How to bootstrap an image" title="How to bootstrap an image" author="[email protected]" cols="115" rows="25" speed="2.0" theme="asciinema">
</asciinema-player>
</div>
<p>What should you do next? How about learning how to interact with your container via the <a href="/docs-shell">shell</a>, <a href="/docs-exec">exec</a>, or <a href="/docs-run">run</a> commands. Or click <strong>next</strong> below to continue the tutorial.</p>
<!-- More navigation on the bottom -->
<div class="row" style="padding-top:30px; margin-bottom:10px"><div class="col-md-12">
<a href="#"><button style="width:20%; height: 70px; float:left" class="hidden previous-button btn btn-lg btn-default">Previous</button></a>
<a href="#"><button style="width:20%; height: 70px; float:right" class="hidden next-button btn btn-lg btn-default">Next</button></a>
</div></div>
<a style="margin-top:10px;margin-bottom:10px" target="_blank" href="https://github.com/singularityware/singularityware.github.io/blob/master/pages/_pages/docs/docs-quick-start-installation.md" class="btn btn-default btn-xs githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
<div class="tags">
</div>
</div>
<hr class="shaded"/>
<footer>
<div class="row">
<!-- Social Media links, etc -->
<div class="col-lg-6 footer">
<a class="no-after social-icon" href="https://twitter.com/SingularityApp">
<i class="fa fa-4x fa-twitter no-after"></i>
</a>
<a class="no-after social-icon" href="https://github.com/singularityware">
<i class="fa fa-4x fa-github no-after"></i>
</a>
</div>
<div class="col-lg-6 footer">
<p><img src="images/logo/logo.png" alt="Company logo" style="width:40px;padding-bottom:10px"/></p>
Site last generated: Jul 26, 2017 <br />
</div>
</div>
</footer>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
</body>
<!-- the google_analytics_id gets auto inserted from the config file -->
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create','UA-84672381-1','auto');ga('require','displayfeatures');ga('send','pageview');</script>
</html>