158 lines
4.9 KiB
Markdown
158 lines
4.9 KiB
Markdown
# README #
|
|
|
|
Document
|
|
DOCKER_CMD
|
|
|
|
## TL;DR version ##
|
|
1. Run the dockers
|
|
|
|
./docker/run_dockers.bsh
|
|
|
|
2. ???
|
|
|
|
3. **Enjoy** all your new package files in
|
|
|
|
./docker/repos/
|
|
|
|
##Using the Dockers##
|
|
|
|
### Building Dockers (Optional) ###
|
|
|
|
```run_dockers.bsh``` now call build_dockers ```build_dockers.bsh```, but you
|
|
can still call the script manually to get it all out of the way once while you
|
|
go make that tea/coffee.
|
|
|
|
In order to use the docker **images**, they have to be built so that they are
|
|
ready to be used. For OSes like Debian, this is a fairly quick process.
|
|
However CentOS takes considerably longer time, since it has to build go, ruby,
|
|
or git from source, depending on the version. Fortunately, you can build the
|
|
docker images JUST once, and you won't have to build it again (unless something
|
|
significant changes, which should be fairly uncommon). This means all the
|
|
compiling, yum/apt-get/custom dependency compiling is done once and saved.
|
|
(This is done in CentOS by using the already existing ```./rpm/rpm_build.bsh```
|
|
script to bootstrap the image and saving the image.)
|
|
|
|
There is a script to take care of ALL of these details for you. Simply run
|
|
|
|
./docker/build_dockers.bsh
|
|
|
|
And all the git-lfs_* images will be built automatically. These are all a
|
|
developer would need to test the different OSes.
|
|
|
|
If you were more interested in creating all the special packages for CentOS
|
|
(For example, you may want to hand out the git rpm for CentOS 6, since only
|
|
git 1.7.1 is available, or else everyone will have to build git from source
|
|
just to use git-lfs on CentOS 6), then the git-lfs-full-build_* dockers are
|
|
useful. Instead of building everyone necessary into the image, these contain
|
|
bare CentOS image, so the ```./rpm/rpm_build.bsh``` script will build all of
|
|
its dependencies when you run the dockers, making the rpms available. These
|
|
images can be build by running
|
|
|
|
./docker/docker_build.bsh ./docker/git-lfs-full-build_*
|
|
|
|
In fact, any subset of images can be built only, by passing the list of of
|
|
directories as argument. (Each directory contains a Dockerfile, this is used to
|
|
tell the .bsh scripts which you want to work on AND names them in
|
|
```docker images``` based on the directory name.)
|
|
|
|
(To manually build a docker, run ```docker build -t $(basename ${DockerDir})
|
|
-f ${DockerDir}/Dockerfile ./docker```
|
|
|
|
### Running Dockers ###
|
|
|
|
After the docker images are build, a lot of arguments need to me added to get
|
|
the mount points right, etc... again, a convenient script is supplied to make
|
|
this all easy. By running
|
|
|
|
./docker/run_docker.bsh
|
|
|
|
All the git-lfs_* images build their packages and tranfer them to the
|
|
```./docker/repos``` directory.
|
|
|
|
|
|
Copies your current source
|
|
Cleans the copies, so all untracked files are deleted, but uncommited changes are kept
|
|
|
|
###Development with Dockers###
|
|
|
|
##Deploying/Building Repositories##
|
|
|
|
### Setting the website URL ###
|
|
|
|
### GPG signing ###
|
|
|
|
gpg --key-gen
|
|
|
|
public.key
|
|
|
|
signing.key
|
|
|
|
GPG agent ttl set to 5 hours, should be plenty to build everything.
|
|
|
|
### Testing the Repositories ###
|
|
|
|
./test_dockers.bsh
|
|
|
|
## Adding addition OSes ##
|
|
|
|
To add another operating system, simply follow the already existing pattern,
|
|
and all the script will them them up. A new Dockerfile should go in a directory
|
|
named
|
|
|
|
./docker/git-lfs_{OS NAME}_{OS VERSION}
|
|
|
|
where **{OS NAME}** and **{OS VERSION}** should not contain underscores (_).
|
|
Any files that need to be added to the docker image can be dropped in the
|
|
```./docker``` directory, since that is the root they are built against (not
|
|
the directory containing the Dockerfile)
|
|
|
|
The docker image should write it's repo files to /repo inside the docker, and
|
|
they will end up in
|
|
|
|
./docker/repos/{OS NAME}/{OS VERSION}/
|
|
|
|
## Docker Cheat sheet ##
|
|
|
|
http://docs.docker.com/ Install -> Docker Engine -> Installation on ...
|
|
|
|
* list running dockers
|
|
|
|
docker ps
|
|
|
|
* list stopped dockers
|
|
|
|
docker ps -a
|
|
|
|
* Remove all stopped dockers
|
|
|
|
docker rm $(docker ps --filter=status=exited -q)
|
|
|
|
1. How much space are all these Dockers taking up?
|
|
|
|
No idea. sudo du /var/lib/docker
|
|
|
|
|
|
# Troubleshooting #
|
|
|
|
1. I started one of the script, and am trying to stop it with Ctrl+C. It is
|
|
ignoring many Ctrl+C's
|
|
|
|
This happens a lot when calling programs like apt-get, yum, etc... From the
|
|
host, you can still use ps, pgrep, kill, pkill, etc... commands to kill the
|
|
PIDs in a docker.
|
|
|
|
2. How do I re-enter a docker after it failed/suceeded?
|
|
|
|
Dockers are immediately deleted upon exit. The best way to work in a docker
|
|
is to run bash. This will let you to run the main build command and then
|
|
continue.
|
|
|
|
3. That answer's not good enough. How do I resume a docker?
|
|
|
|
Well, first you have to remove the ```--rm``` flag. This will keep the
|
|
docker around after stopping. Be careful! They multiply like rabbits. Then
|
|
|
|
```docker commit {container name/id} {new_name}```
|
|
|
|
Then you can ```docker run``` that new image.
|
|
|