4
4
1 . Run the dockers
5
5
6
6
./docker/run_dockers.bsh
7
-
7
+
8
8
2 . ** Enjoy** all your new package files in
9
9
10
10
./repos/
11
-
11
+
12
12
### Slightly longer version ###
13
13
14
14
1 . Generate GPG keys for everything (See GPG Signing)
15
15
2 . ` export REPO_HOSTNAME=repo.something.com `
16
16
4 . Generate git-lfs/repo packages and sign all packages
17
17
18
18
./docker/run_dockers.bsh
19
-
19
+
20
20
5 . Host the ` /repo ` on the ` REPO_HOSTNAME ` server
21
21
6 . Test the repos and git-lfs in a client environment
22
22
23
23
./docker/test_dockers.bsh
24
24
25
25
## Using the Dockers ##
26
26
27
- All docker commands need to either be run as root ** or** as a user with docker
28
- permissions. Adding your user name to the docker group (or setting up boot2docker
27
+ All docker commands need to either be run as root ** or** as a user with docker
28
+ permissions. Adding your user name to the docker group (or setting up boot2docker
29
29
environment) is probably the easiest.
30
30
31
- For Mac and Windows users, the git-lfs repo needs to be in your Users directory
31
+ For Mac and Windows users, the git-lfs repo needs to be in your Users directory
32
32
or else boot2docker magic won't work. Alternatively, you could add addition
33
- mount points like
33
+ mount points like
34
34
[ this] ( http://stackoverflow.com/questions/26639968/boot2docker-startup-script-to-mount-local-shared-folder-with-host )
35
35
36
36
### Running Dockers ###
37
37
38
38
In order to run the dockers, the docker has to be run with a
39
- lot of arguments to get the mount points right, etc... A convenient script is
39
+ lot of arguments to get the mount points right, etc... A convenient script is
40
40
supplied to make this all easy. Simply run
41
41
42
42
./docker/run_docker.bsh
43
-
43
+
44
44
All the images are pulled automatically, and then run.
45
45
46
46
To only run certain docker images, supply them as arguments, e.g.
@@ -54,12 +54,12 @@ And only those images will be run.
54
54
### Development in Dockers ###
55
55
56
56
Sometimes you don't want to just build git-lfs and destroy the container, you
57
- want to get in there, run a lot of command, debug, develop, etc... To do this,
57
+ want to get in there, run a lot of command, debug, develop, etc... To do this,
58
58
the best command to run is bash, and then you have an interactive shell to use
59
59
60
60
./docker/run_docker.bsh {image name(s)} -- bash
61
61
62
- After listing the image(s) you want to run, add a double dash (--) and then any
62
+ After listing the image(s) you want to run, add a double dash (--) and then any
63
63
command (and arguments) you want executed in the docker. Remember, the command
64
64
you are executing has to be in the docker image.
65
65
@@ -71,33 +71,33 @@ There are currently three type of docker images:
71
71
git-lfs and save the package/repository in the ` /repo ` direrctory. This image
72
72
also signs all rpms/debs if gpg signing is setup
73
73
2 . Environment building images: ` {OS_NAME}_{OS_VERSION}_env ` -
74
- These build or install the environment (dependencies) for building git-lfs. These
75
- are mostly important for CentOS because without these, many dependencies have
76
- to be built by a developer. These containers should create packages for these
74
+ These build or install the environment (dependencies) for building git-lfs. These
75
+ are mostly important for CentOS because without these, many dependencies have
76
+ to be built by a developer. These containers should create packages for these
77
77
dependencies and place them in ` /repo `
78
78
3 . Testing images: ` {OS_NAME}_{OS_VERSION}_test ` - These images
79
79
should install the repo and download the git-lfs packages and dependencies to test
80
80
that everything is working, including the GPG signatures. Unlike the first two types,
81
- testing images are not guaranteed to work without GPG signatures. They should
81
+ testing images are not guaranteed to work without GPG signatures. They should
82
82
also run the test and integration scripts after installing git-lfs to verify
83
83
everything is working in a ** non-developer** setup. (With the exception that go
84
84
is needed to build the tests...)
85
85
86
86
This default behavior for ` ./docker/run_dockers.bsh `
87
87
is to run all of the _ building images_ . These
88
- containers will use the currently checked-out version of git-lfs and copy it
89
- into the docker, and run ` git clean -xdf ` to remove any non-tracked files,
90
- (but non-committed changes are kept). git-lfs is built, and a packages/repo is
88
+ containers will use the currently checked-out version of git-lfs and copy it
89
+ into the docker, and run ` git clean -xdf ` to remove any non-tracked files,
90
+ (but non-committed changes are kept). git-lfs is built, and a packages/repo is
91
91
created for each container.
92
92
93
93
These are all a developer would need to test the different OSes. And create the
94
- git-lfs rpm or deb packages in the ` /repo ` directory.
94
+ git-lfs rpm or deb packages in the ` /repo ` directory.
95
95
96
- In order to distribute git-lfs ** and** build dependencies, the dependencies that
96
+ In order to distribute git-lfs ** and** build dependencies, the dependencies that
97
97
that were built to create the docker images need to be saved too. Most of these
98
98
are downloaded by yum/apt-get and do not need to be saved, but a few are not.
99
- In order to save the necessary dependencies, call ` ./docker/run_dockers.bsh ` on
100
- ` {OS_NAME}_{OS_VERSION}_env ` and the rpms
99
+ In order to save the necessary dependencies, call ` ./docker/run_dockers.bsh ` on
100
+ ` {OS_NAME}_{OS_VERSION}_env ` and the rpms
101
101
will be extracted from the images and saved in the ` ./repo ` directory.
102
102
(This _ can_ be done in one command)
103
103
@@ -121,8 +121,8 @@ of the `run_docker.bsh` script.
121
121
the lfs dockers. If set to 0, it will not check to see if a new pull is needed,
122
122
and you will always run off of your currently cached images docker images.
123
123
124
- ` AUTO_REMOVE ` - Default 1. Docker containers are automatically deleted on
125
- exit. If set to 0, the docker containers will not be automatically deleted upon
124
+ ` AUTO_REMOVE ` - Default 1. Docker containers are automatically deleted on
125
+ exit. If set to 0, the docker containers will not be automatically deleted upon
126
126
exit. This can be useful for a post mortem analysis (using other docker commands
127
127
not covered here). Just make sure you clean up the docker containers manually.
128
128
@@ -146,8 +146,8 @@ The two major packages included are:
146
146
` git-lfs-repo-release....* ` - A package to install the repo.
147
147
148
148
When building, all ** untracked** files are removed during RPM generation (except
149
- any stray directories containing a .git folder will not be cleared. This
150
- shouldn't be the case, unless you are temporarily storing another git repo in
149
+ any stray directories containing a .git folder will not be cleared. This
150
+ shouldn't be the case, unless you are temporarily storing another git repo in
151
151
the git repo. This is a safety mechanism in git, so just keep in mind if you
152
152
are producing packages.)
153
153
@@ -157,9 +157,9 @@ The git-lfs-repo-release must contain the URL where the repo is to be hosted.
157
157
The current default value is ` git-lfs.github.com ` but this can be overridden
158
158
using the ` REPO_HOSTNAME ` env var, e.g.
159
159
160
- export REPO_HOSTNAME=www.notgithub.uk.co
160
+ export REPO_HOSTNAME=www.notgithub.uk.co
161
161
./docker/run_dockers.bsh
162
-
162
+
163
163
Now all the ` git-lfs-repo-release....* ` files will point to that URL instead
164
164
165
165
_ Hint_ : ` REPO_HOSTNAME ` can also be ` www.notgithub.uk.co:2213/not_root_dir `
@@ -170,7 +170,7 @@ To test that all the OSes can download the packages, install, and run the tests
170
170
again, run
171
171
172
172
./test_dockers.bsh
173
-
173
+
174
174
(which is basically just ` ./docker/run_dockers.bsh ./docker/git-lfs-test_* ` )
175
175
176
176
Remember to set ` REPO_HOSTNAME ` if you changed it for ` ./docker/build_docker.bsh `
189
189
190
190
## GPG signing ###
191
191
192
- For private repo testing, GPG signing can be skipped. apt-get and yum can
192
+ For private repo testing, GPG signing can be skipped. apt-get and yum can
193
193
install .deb/.rpm directly without gpg keys and everything will work (with
194
- certain flags). This section is for distribution in a repo. Most if not all
195
- this functionality is automatically disabled when there is no signing key
194
+ certain flags). This section is for distribution in a repo. Most if not all
195
+ this functionality is automatically disabled when there is no signing key
196
196
(` ./docker/git-lfs_*.key ` ).
197
197
198
198
In order to sign packages, you need to generate and place GPG keys in the right
@@ -210,11 +210,11 @@ place. The general procedure for this is
210
210
8. O for Okay
211
211
9. Enter a secure password, make sure you will not forget it
212
212
10. Generate Entropy!
213
-
213
+
214
214
gpg --export-secret-key '<key ID>!' > filename.key
215
-
215
+
216
216
e.g. ` gpg --export-secret-key '547CF247!' > ./docker/git-lfs_centos_7.key `
217
-
217
+
218
218
* NOTE* : the ** !** is important in this command
219
219
220
220
Keep in mind, .key files must NEVER be accidentally committed to the repo.
@@ -229,37 +229,37 @@ that docker and save to the `/key` directory
229
229
To prevent MANY passphrase entries at random times, a gpg-agent docker is used to
230
230
cache your signing key. This is done automatically for you, whenever you call
231
231
` ./docker/run_dockers.bsh ` on a building image (` git-lfs_*.dockerfile ` ). It can
232
- be manually preloaded by calling ` ./docker/gpg-agent_preload.bsh ` . It will ask
232
+ be manually preloaded by calling ` ./docker/gpg-agent_preload.bsh ` . It will ask
233
233
you for your passphrase, once for each unique key out of all the dockers. So if
234
234
you use the same key for every docker, it will only prompt once. If you have 5
235
235
different keys, you'll have prompts, with only the key ID to tell you which
236
236
is which.
237
237
238
- The gpg agent TTL is set to 1 year. If this is not acceptable for you, set the
238
+ The gpg agent TTL is set to 1 year. If this is not acceptable for you, set the
239
239
` GPG_MAX_CACHE ` and ` GPG_DEFAULT_CACHE ` environment variables (in seconds) before
240
240
starting the gpg-agent daemon.
241
241
242
- ` ./docker/gpg-agent_start.bsh ` starts the gpg-agent daemon. It is called
242
+ ` ./docker/gpg-agent_start.bsh ` starts the gpg-agent daemon. It is called
243
243
automatically by ` ./docker/gpg-agent_preload.bsh `
244
244
245
- ` ./docker/gpg-agent_stop.bsh ` stops the gpg-agent daemon. It is called
245
+ ` ./docker/gpg-agent_stop.bsh ` stops the gpg-agent daemon. It is called
246
246
automatically by ` ./docker/gpg-agent_preload.bsh `
247
247
248
- ` ./docker/gpg-agent_preload.bsh ` is called automatically by
249
- ` ./docker/run_dockers.bsh ` when running any of the signing dockers.
248
+ ` ./docker/gpg-agent_preload.bsh ` is called automatically by
249
+ ` ./docker/run_dockers.bsh ` when running any of the signing dockers.
250
250
251
251
` ./docker/gpg-agent_preload.bsh -r ` - Stops and restarts the gpg agent daemon.
252
252
This is useful for reloading keys when you update them in your host.
253
253
254
254
### GPG capabilities by Distro ###
255
255
256
- Every distro has its own GPG signing capability. This is why every signing
256
+ Every distro has its own GPG signing capability. This is why every signing
257
257
docker (` git-lfs_*.dockerfile ` ) can have an associated key (` git-lfs_*.key ` )
258
258
259
259
Debian ** will** work with 4096 bit RSA signing subkeys like [ 1] suggests, but will
260
260
also work with 4096 bit RSA signing keys.
261
261
262
- CentOS will ** not** work with subkeys[ 3] . CentOS 6 and 7 will work with 4096 bit
262
+ CentOS will ** not** work with subkeys[ 3] . CentOS 6 and 7 will work with 4096 bit
263
263
RSA signing keys
264
264
265
265
You can make a 4096 RSA key for Debian and CentOS 6/7 (4 for step 1 above, and
@@ -275,11 +275,11 @@ You can make a 4096 RSA key for Debian and CentOS 6/7 (4 for step 1 above, and
275
275
276
276
## Adding additional OSes ##
277
277
278
- To add another operating system, it needs to be added to the lfs_dockers
279
- repo and uploaded to docker hub. Then all that is left is to add it to the
278
+ To add another operating system, it needs to be added to the lfs_dockers
279
+ repo and uploaded to docker hub. Then all that is left is to add it to the
280
280
IMAGES list in ` run_dockers.bsh ` and ` test_dockers.bsh `
281
281
282
- Follow the already existing pattern ` {OS NAME}_{OS VERSION #} ` where
282
+ Follow the already existing pattern ` {OS NAME}_{OS VERSION #} ` where
283
283
** {OS NAME}** and ** {OS VERSION #}** should not contain underscores (\_ ).
284
284
285
285
## Docker Cheat sheet ##
@@ -289,23 +289,23 @@ Install https://docs.docker.com/installation/
289
289
* list running dockers
290
290
291
291
docker ps
292
-
292
+
293
293
* list stopped dockers too
294
294
295
295
docker ps -a
296
-
296
+
297
297
* Remove all stopped dockers
298
298
299
299
docker rm $(docker ps --filter=status=exited -q)
300
-
300
+
301
301
* List docker images
302
302
303
303
docker images
304
304
305
305
* Remove unused docker images
306
306
307
307
docker rmi $(docker images -a --filter=dangling=true -q)
308
-
308
+
309
309
* Run another command (like bash) in a running docker
310
310
311
311
docker exec -i {docker name} {command}
@@ -329,19 +329,19 @@ ignoring many Ctrl+C's
329
329
name/id and then used `docker stop` (signal 15) or `docker kill`
330
330
(signal 9) to stop the docker. You can also use 'docker exec' to start another
331
331
bash or kill command inside that container
332
-
332
+
333
333
2 . How do I re-enter a docker after it failed/succeeded?
334
334
335
335
Dockers are immediately deleted upon exit. The best way to work in a docker
336
- is to run bash (See Development in Dockers). This will let you to run the
336
+ is to run bash (See Development in Dockers). This will let you to run the
337
337
main build command and then continue.
338
-
338
+
339
339
3 . That answer's not good enough. How do I resume a docker?
340
340
341
- Well, first you have to set the environment variable ` AUTO_REMOVE=0 `
342
- before running the image you want to resume. This will keep the docker
341
+ Well, first you have to set the environment variable ` AUTO_REMOVE=0 `
342
+ before running the image you want to resume. This will keep the docker
343
343
around after stopping. (Be careful! They multiply like rabbits.) Then
344
-
344
+
345
345
docker commit {container name/id} {new_name}
346
-
346
+
347
347
Then you can ` docker run ` that new image.
0 commit comments