2015-07-18 02:52:50 +00:00
|
|
|
# README #
|
|
|
|
|
|
|
|
## TL;DR version ##
|
2015-07-19 22:59:14 +00:00
|
|
|
1. Run the dockers
|
2015-07-18 02:52:50 +00:00
|
|
|
|
|
|
|
./docker/run_dockers.bsh
|
2015-07-19 22:59:14 +00:00
|
|
|
|
2015-07-23 05:38:43 +00:00
|
|
|
2. **Enjoy** all your new package files in
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-07-23 03:23:16 +00:00
|
|
|
./repos/
|
2015-07-31 21:47:18 +00:00
|
|
|
|
|
|
|
### Slightly longer version ###
|
|
|
|
|
|
|
|
1. Generate GPG keys for everything (See GPG Signing)
|
|
|
|
2. `export REPO_HOSTNAME=repo.something.com`
|
2015-12-06 17:31:59 +00:00
|
|
|
4. Generate git-lfs/repo packages and sign all packages
|
2015-07-31 21:47:18 +00:00
|
|
|
|
|
|
|
./docker/run_dockers.bsh
|
|
|
|
|
|
|
|
5. Host the `/repo` on the `REPO_HOSTNAME` server
|
|
|
|
6. Test the repos and git-lfs in a client environment
|
|
|
|
|
|
|
|
./docker/test_dockers.bsh
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-08-16 15:18:45 +00:00
|
|
|
## Using the Dockers ##
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
All docker commands need to either be run as root **or** as a user with docker
|
|
|
|
permissions. Adding your user name to the docker group (or setting up boot2docker
|
|
|
|
environment) is probably the easiest.
|
2015-07-23 03:23:16 +00:00
|
|
|
|
2015-08-16 15:18:45 +00:00
|
|
|
For Mac and Windows users, the git-lfs repo needs to be in your Users directory
|
|
|
|
or else boot2docker magic won't work. Alternatively, you could add addition
|
|
|
|
mount points like
|
|
|
|
[this](http://stackoverflow.com/questions/26639968/boot2docker-startup-script-to-mount-local-shared-folder-with-host)
|
|
|
|
|
2015-07-23 02:45:02 +00:00
|
|
|
### Running Dockers ###
|
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
In order to run the dockers, the docker has to be run with a
|
2015-07-23 02:45:02 +00:00
|
|
|
lot of arguments to get the mount points right, etc... A convenient script is
|
2015-07-23 05:38:43 +00:00
|
|
|
supplied to make this all easy. Simply run
|
2015-07-23 02:45:02 +00:00
|
|
|
|
|
|
|
./docker/run_docker.bsh
|
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
All the images are pulled automatically, and then run.
|
2015-07-23 02:45:02 +00:00
|
|
|
|
|
|
|
To only run certain docker images, supply them as arguments, e.g.
|
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
./docker/run_docker.bsh debian_7
|
|
|
|
./docker/run_docker.bsh centos_7 debian_8
|
|
|
|
./docker/run_docker.bsh centos_{5,6,7}
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
And only those images will be run.
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-08-16 15:18:45 +00:00
|
|
|
### Development in Dockers ###
|
2015-07-31 21:47:18 +00:00
|
|
|
|
|
|
|
Sometimes you don't want to just build git-lfs and destroy the container, you
|
|
|
|
want to get in there, run a lot of command, debug, develop, etc... To do this,
|
|
|
|
the best command to run is bash, and then you have an interactive shell to use
|
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
./docker/run_docker.bsh {image name(s)} -- bash
|
2015-07-31 21:47:18 +00:00
|
|
|
|
|
|
|
After listing the image(s) you want to run, add a double dash (--) and then any
|
|
|
|
command (and arguments) you want executed in the docker. Remember, the command
|
|
|
|
you are executing has to be in the docker image.
|
|
|
|
|
|
|
|
## Docker images ##
|
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
There are currently three type of docker images:
|
2015-07-31 21:47:18 +00:00
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
1. Building images: `{OS NAME}_{OS VERSION}` - These build
|
2015-07-31 21:47:18 +00:00
|
|
|
git-lfs and save the package/repository in the `/repo` direrctory. This image
|
|
|
|
also signs all rpms/debs if gpg signing is setup
|
2015-12-06 17:31:59 +00:00
|
|
|
2. Environment building images: `{OS_NAME}_{OS_VERSION}_env` -
|
2015-07-31 21:47:18 +00:00
|
|
|
These build or install the environment (dependencies) for building git-lfs. These
|
|
|
|
are mostly important for CentOS because without these, many dependencies have
|
|
|
|
to be built by a developer. These containers should create packages for these
|
|
|
|
dependencies and place them in `/repo`
|
2015-12-06 17:31:59 +00:00
|
|
|
3. Testing images: `{OS_NAME}_{OS_VERSION}_test` - These images
|
2015-07-31 21:47:18 +00:00
|
|
|
should install the repo and download the git-lfs packages and dependencies to test
|
|
|
|
that everything is working, including the GPG signatures. Unlike the first two types,
|
|
|
|
testing images are not guaranteed to work without GPG signatures. They should
|
|
|
|
also run the test and integration scripts after installing git-lfs to verify
|
|
|
|
everything is working in a **non-developer** setup. (With the exception that go
|
|
|
|
is needed to build the tests...)
|
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
This default behavior for `./docker/run_dockers.bsh`
|
|
|
|
is to run all of the _building images_. These
|
|
|
|
containers will use the currently checked-out version of git-lfs and copy it
|
2015-07-31 21:47:18 +00:00
|
|
|
into the docker, and run `git clean -xdf` to remove any non-tracked files,
|
|
|
|
(but non-committed changes are kept). git-lfs is built, and a packages/repo is
|
|
|
|
created for each container.
|
|
|
|
|
|
|
|
These are all a developer would need to test the different OSes. And create the
|
|
|
|
git-lfs rpm or deb packages in the `/repo` directory.
|
|
|
|
|
|
|
|
In order to distribute git-lfs **and** build dependencies, the dependencies that
|
2015-12-06 17:31:59 +00:00
|
|
|
that were built to create the docker images need to be saved too. Most of these
|
2015-07-31 21:47:18 +00:00
|
|
|
are downloaded by yum/apt-get and do not need to be saved, but a few are not.
|
|
|
|
In order to save the necessary dependencies, call `./docker/run_dockers.bsh` on
|
2015-12-06 17:31:59 +00:00
|
|
|
`{OS_NAME}_{OS_VERSION}_env` and the rpms
|
|
|
|
will be extracted from the images and saved in the `./repo` directory.
|
|
|
|
(This _can_ be done in one command)
|
2015-07-31 21:47:18 +00:00
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
./docker/run_dockers.bsh centos_6_env centos_6
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
This isn't all that important anymore, unless you want ruby2 and the gems used to
|
|
|
|
make the man pages for Centos 5/6 where ruby2 is not natively available. Calling
|
2015-07-31 21:47:18 +00:00
|
|
|
the environment building images only needs to be done once, they should remain in
|
|
|
|
the `./repo` directory afterwards.
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
### Run Docker Environment Variables ###
|
|
|
|
|
|
|
|
There are a few environment variables you can set to easily adjust the behavior
|
|
|
|
of the `run_docker.bsh` script.
|
|
|
|
|
|
|
|
`export` before calling `run_docker.bsh`
|
|
|
|
|
|
|
|
`REPO_HOSTNAME` - Override the hostname for all the repos generated/tested (see below)
|
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
`DOCKER_AUTOPULL` - Default 1. `run_docker.bsh` always pulls the latest version of
|
|
|
|
the lfs dockers. If set to 0, it will not check to see if a new pull is needed,
|
|
|
|
and you will always run off of your currently cached images docker images.
|
2015-07-31 21:47:18 +00:00
|
|
|
|
|
|
|
`AUTO_REMOVE` - Default 1. Docker containers are automatically deleted on
|
|
|
|
exit. If set to 0, the docker containers will not be automatically deleted upon
|
|
|
|
exit. This can be useful for a post mortem analysis (using other docker commands
|
|
|
|
not covered here). Just make sure you clean up the docker containers manually.
|
|
|
|
|
2015-08-16 15:18:45 +00:00
|
|
|
`DOCKER_OTHER_OPTIONS` - Any additional arguments you may want to pass to the
|
|
|
|
docker run command. This can be particularly useful when having to help docker
|
|
|
|
with dns, etc... For example `DOCKER_OTHER_OPTIONS="--dns 8.8.8.8"`
|
|
|
|
|
|
|
|
If for some reason on Windows, you need to add a -v mount, folder names need to
|
|
|
|
start with `//driveleter/dir...` instead of `/driveleter/dir...` to fool MINGW32
|
|
|
|
|
|
|
|
## Deploying/Building Repositories ##
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
When `./docker/run_dockers.bsh` is done building git-lfs and generating packages,
|
|
|
|
it automatically creates a repository for distribution too. Each distro gets a
|
|
|
|
repo generated in `./repos/{DISTRO_NAME}/{VERSION #}`. Just drop the repo
|
2015-07-23 05:38:43 +00:00
|
|
|
directory onto a webserver and you have a fully functioning Linux repo. (See
|
2015-07-23 02:45:02 +00:00
|
|
|
Testing the Repositories below for more detail)
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-07-23 02:45:02 +00:00
|
|
|
The two major packages included are:
|
2015-07-31 21:47:18 +00:00
|
|
|
`git-lfs-....*` - the git-lfs package
|
|
|
|
`git-lfs-repo-release....*` - A package to install the repo.
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-07-31 20:32:40 +00:00
|
|
|
When building, all **untracked** files are removed during RPM generation (except
|
|
|
|
any stray directories containing a .git folder will not be cleared. This
|
|
|
|
shouldn't be the case, unless you are temporarily storing another git repo in
|
|
|
|
the git repo. This is a safety mechanism in git, so just keep in mind if you
|
|
|
|
are producing packages.)
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-18 19:16:54 +00:00
|
|
|
### Setting the website URL ###
|
|
|
|
|
2015-07-23 02:45:02 +00:00
|
|
|
The git-lfs-repo-release must contain the URL where the repo is to be hosted.
|
2015-07-31 21:47:18 +00:00
|
|
|
The current default value is `git-lfs.github.com` but this can be overridden
|
|
|
|
using the `REPO_HOSTNAME` env var, e.g.
|
|
|
|
|
|
|
|
export REPO_HOSTNAME=www.notgithub.uk.co
|
|
|
|
./docker/run_dockers.bsh
|
|
|
|
|
|
|
|
Now all the `git-lfs-repo-release....*` files will point to that URL instead
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
_Hint_: `REPO_HOSTNAME` can also be `www.notgithub.uk.co:2213/not_root_dir`
|
|
|
|
|
|
|
|
### Testing the Repositories ###
|
|
|
|
|
|
|
|
To test that all the OSes can download the packages, install, and run the tests
|
|
|
|
again, run
|
|
|
|
|
|
|
|
./test_dockers.bsh
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
(which is basically just `./docker/run_dockers.bsh ./docker/git-lfs-test_*`)
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
Remember to set `REPO_HOSTNAME` if you changed it for `./docker/build_docker.bsh`
|
|
|
|
This can also be used to run a local test (on `localhost:{Port Number}`, for
|
|
|
|
example)
|
|
|
|
|
|
|
|
An easy way to test the repositories locally, is to run them on a simple webserver such as
|
|
|
|
|
|
|
|
cd ./repos
|
|
|
|
python -m SimpleHTTPServer {Port number}
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
cd ./repos
|
|
|
|
ruby -run -ehttpd . -p{Port Number}
|
|
|
|
|
|
|
|
## GPG signing ###
|
2015-07-18 19:16:54 +00:00
|
|
|
|
2015-07-20 05:40:24 +00:00
|
|
|
For private repo testing, GPG signing can be skipped. apt-get and yum can
|
2015-07-31 20:32:40 +00:00
|
|
|
install .deb/.rpm directly without gpg keys and everything will work (with
|
2015-07-31 21:47:18 +00:00
|
|
|
certain flags). This section is for distribution in a repo. Most if not all
|
2015-07-31 20:32:40 +00:00
|
|
|
this functionality is automatically disabled when there is no signing key
|
2015-07-31 21:47:18 +00:00
|
|
|
(`./docker/git-lfs_*.key`).
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 20:32:40 +00:00
|
|
|
In order to sign packages, you need to generate and place GPG keys in the right
|
|
|
|
place. The general procedure for this is
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 20:32:40 +00:00
|
|
|
gpg --gen-key
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 20:32:40 +00:00
|
|
|
1. 4 - RSA
|
2015-07-20 05:40:24 +00:00
|
|
|
2. 4096 bits
|
|
|
|
3. Some length of time or 0 for infinite
|
|
|
|
4. y for yes
|
|
|
|
5. Signer name (Will become part of the key and uid)
|
|
|
|
6. Email address (Will become part of the key and uid)
|
|
|
|
7. Comment (Will become part of the key)
|
|
|
|
8. O for Okay
|
2015-07-31 20:32:40 +00:00
|
|
|
9. Enter a secure password, make sure you will not forget it
|
2015-07-20 05:40:24 +00:00
|
|
|
10. Generate Entropy!
|
2015-07-31 21:47:18 +00:00
|
|
|
|
2015-12-06 21:37:31 +00:00
|
|
|
gpg --export-secret-key '<key ID>!' > filename.key
|
2015-07-31 21:47:18 +00:00
|
|
|
|
2015-08-05 19:49:45 +00:00
|
|
|
e.g. `gpg --export-secret-key '547CF247!' > ./docker/git-lfs_centos_7.key`
|
2015-07-31 21:47:18 +00:00
|
|
|
|
|
|
|
*NOTE*: the **!** is important in this command
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 20:32:40 +00:00
|
|
|
Keep in mind, .key files must NEVER be accidentally committed to the repo.
|
2015-07-18 19:16:54 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
_What if you don't have gpg handy?_ Just enter one of the dockers (-- bash) and
|
|
|
|
generate them in there, and save them in the /src dir to get them out of the docker.
|
2015-12-06 21:37:31 +00:00
|
|
|
Or `docker run -it --rm -v $(pwd):/key OS_NAME:OS_VERSION bash`, and generate in
|
|
|
|
that docker and save to the `/key` directory
|
2015-07-19 22:59:14 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
### GPG Agent ###
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
To prevent MANY passphrase entries at random times, a gpg-agent docker is used to
|
|
|
|
cache your signing key. This is done automatically for you, whenever you call
|
|
|
|
`./docker/run_dockers.bsh` on a building image (`git-lfs_*.dockerfile`). It can
|
|
|
|
be manually preloaded by calling `./docker/gpg-agent_preload.bsh`. It will ask
|
|
|
|
you for your passphrase, once for each unique key out of all the dockers. So if
|
|
|
|
you use the same key for every docker, it will only prompt once. If you have 5
|
|
|
|
different keys, you'll have prompts, with only the the key ID to tell you which
|
|
|
|
is which.
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
The gpg agent TTL is set to 1 year. If this is not acceptable for you, set the
|
|
|
|
`GPG_MAX_CACHE` and `GPG_DEFAULT_CACHE` environment variables (in seconds) before
|
|
|
|
starting the gpg-agent daemon.
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
`./docker/gpg-agent_start.bsh` starts the gpg-agent daemon. It is called
|
|
|
|
automatically by `./docker/gpg-agent_preload.bsh`
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
`./docker/gpg-agent_stop.bsh` stops the gpg-agent daemon. It is called
|
|
|
|
automatically by `./docker/gpg-agent_preload.bsh`
|
2015-07-23 02:45:02 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
`./docker/gpg-agent_preload.bsh` is called automatically by
|
|
|
|
`./docker/run_dockers.bsh` when running any of the signing dockers.
|
2015-07-23 05:38:43 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
`./docker/gpg-agent_preload.bsh -r` - Stops and restarts the gpg agent daemon.
|
|
|
|
This is useful for reloading keys when you update them in your host.
|
2015-07-23 05:38:43 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
### GPG capabilities by Distro ###
|
2015-07-19 22:59:14 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
Every distro has its own GPG signing capability. This is why every signing
|
|
|
|
docker (`git-lfs_*.dockerfile`) can have an associated key (`git-lfs_*.key`)
|
2015-07-19 07:35:13 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
Debian **will** work with 4096 bit RSA signing subkeys like [1] suggests, but will
|
|
|
|
also work with 4096 bit RSA signing keys.
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
CentOS will **not** work with subkeys[3]. CentOS 6 and 7 will work with 4096 bit
|
|
|
|
RSA signing keys
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
CentOS 5 will **not** work with v4 signatures. The rpms will be so unrecognizable
|
|
|
|
that it can't even be installed with --nogpgcheck. It should work with RSA on v3.
|
|
|
|
However, it does not. It builds v3 correctly, but for some reason the GPG check
|
|
|
|
fails for RSA. CentOS 5 will **not** work with 2048 bit DSA keys... I suspect
|
|
|
|
2048 is too big for it to fathom. CentOS 5 **will** work with 1024 bit DSA keys.
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
You can make a 4096 RSA key for Debian and CentOS 6/7 (4 for step 1 above, and
|
|
|
|
4096 for step 2) and a 1024 DSA key for CentOS 5 (3 for step 1 above, and 1024
|
2015-12-06 21:37:31 +00:00
|
|
|
for step 2. And be sure to make the key in a CentOS 5 docker.). And only have two
|
|
|
|
keys... Or optionally a 4096 RSA subkey for Debain
|
2015-07-31 21:47:18 +00:00
|
|
|
[1]. Or a key for each distro. Dealers choice. You should have least two since
|
|
|
|
1024 bit isn't that great and you are only using it for CentOS 5 because nothing
|
|
|
|
else works.
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
[1] https://www.digitalocean.com/community/tutorials/how-to-use-reprepro-for-a-secure-package-repository-on-ubuntu-14-04
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
[2] https://iuscommunity.org/pages/CreatingAGPGKeyandSigningRPMs.html#exporting-the-public-gpg-key
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
[3] http://www.redhat.com/archives/rpm-list/2006-November/msg00105.html
|
2015-07-20 05:40:24 +00:00
|
|
|
|
2015-07-19 07:35:13 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
## Adding additional OSes ##
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
To add another operating system, it needs to be added to the lfs_dockers
|
|
|
|
repo and uploaded to docker hub. Then all that is left is to add it to the
|
|
|
|
IMAGES list in `run_dockers.bsh` and `test_dockers.bsh`
|
2015-07-18 02:52:50 +00:00
|
|
|
|
2015-12-06 17:31:59 +00:00
|
|
|
Follow the already existing pattern `{OS NAME}_{OS VERSION #}` where
|
|
|
|
**{OS NAME}** and **{OS VERSION #}** should not contain underscores (\_).
|
2015-07-18 02:52:50 +00:00
|
|
|
|
|
|
|
## Docker Cheat sheet ##
|
|
|
|
|
2015-07-23 03:23:16 +00:00
|
|
|
Install https://docs.docker.com/installation/
|
2015-07-19 22:59:14 +00:00
|
|
|
|
|
|
|
* list running dockers
|
|
|
|
|
|
|
|
docker ps
|
|
|
|
|
2015-07-23 05:38:43 +00:00
|
|
|
* list stopped dockers too
|
2015-07-19 22:59:14 +00:00
|
|
|
|
|
|
|
docker ps -a
|
|
|
|
|
|
|
|
* Remove all stopped dockers
|
|
|
|
|
|
|
|
docker rm $(docker ps --filter=status=exited -q)
|
2015-07-23 03:23:16 +00:00
|
|
|
|
|
|
|
* List docker images
|
|
|
|
|
|
|
|
docker images
|
|
|
|
|
|
|
|
* Remove unused docker images
|
|
|
|
|
|
|
|
docker rmi $(docker images -a --filter=dangling=true -q)
|
|
|
|
|
|
|
|
* Run another command (like bash) in a running docker
|
|
|
|
|
2015-07-23 05:38:43 +00:00
|
|
|
docker exec -i {docker name} {command}
|
2015-07-19 22:59:14 +00:00
|
|
|
|
2015-07-31 21:47:18 +00:00
|
|
|
* Stopping a docker (signal 15 to the main pid)
|
|
|
|
|
|
|
|
docker stop {docker name}
|
|
|
|
|
|
|
|
* Killing a docker (signal 9 to the main pid)
|
|
|
|
|
|
|
|
docker kill {docker name}
|
2015-07-19 22:59:14 +00:00
|
|
|
|
|
|
|
# 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
|
2015-07-25 02:53:46 +00:00
|
|
|
PIDs in a docker. You can also use `docker ps` to find the container
|
|
|
|
name/id and then used `docker stop` (signal 15) or `docker kill`
|
2015-07-31 21:47:18 +00:00
|
|
|
(signal 9) to stop the docker. You can also use 'docker exec' to start another
|
|
|
|
bash or kill command inside that container
|
2015-07-19 22:59:14 +00:00
|
|
|
|
2015-07-23 05:38:43 +00:00
|
|
|
2. How do I re-enter a docker after it failed/succeeded?
|
2015-07-19 22:59:14 +00:00
|
|
|
|
|
|
|
Dockers are immediately deleted upon exit. The best way to work in a docker
|
2015-07-31 21:47:18 +00:00
|
|
|
is to run bash (See Development in Dockers). This will let you to run the
|
|
|
|
main build command and then continue.
|
2015-07-19 22:59:14 +00:00
|
|
|
|
|
|
|
3. That answer's not good enough. How do I resume a docker?
|
|
|
|
|
2015-07-25 02:53:46 +00:00
|
|
|
Well, first you have to set the environment variable `AUTO_REMOVE=0`
|
2015-07-23 02:45:02 +00:00
|
|
|
before running the image you want to resume. This will keep the docker
|
|
|
|
around after stopping. (Be careful! They multiply like rabbits.) Then
|
2015-07-19 22:59:14 +00:00
|
|
|
|
2015-07-23 05:38:43 +00:00
|
|
|
docker commit {container name/id} {new_name}
|
2015-07-19 22:59:14 +00:00
|
|
|
|
2015-08-05 19:49:45 +00:00
|
|
|
Then you can `docker run` that new image.
|