Small script to create and manage simple docker containers.
During development and testing, applications very often need a quick way to set up a temporal database o web server. This script quickly creates these test containers based on configuration templates.
Well, Docker's logo has a whale named Moby Dock, so I named the project with the first whale I could remember. Keiko was a male killer whale that was the main attraction of "Reino Aventura" (a Mexico City amusement park) and portrayed Willy in the 1993 film Free Willy.
- Clone or download the content of this repository into any directory.
- Add the directory to the
PATHenvironment variable, or create a soft link into any directory already in thePATH.
If the user is not in the docker group, you will need to run the script using sudo or something similar.
Here is an example of how to install Keiko in Debian 11. It shouldn't be too different from installing in other Linux flavors.
$ cd /opt
$ sudo git clone https://github.com/jcanop/keiko.git
$ sudo ln -s /opt/keiko/keiko.sh /usr/local/bin/keiko
Here is the list of the available commands. You can run these commands at the command line in this format:
$ keiko [command]
| Command | Description |
|---|---|
| build | Builds a docker image. |
| clear | Stop and remove all containers, and remove all images. |
| ls | List available images. |
| ps | List running containers. |
| run | Creates and runs a container. |
| stop | Stops all running containers. |
| version | Prints the current version. |
There are two required arguments: the name of the image and the container's name. There are also two optional arguments: the binding port and the mounting volume.
$ keiko run [image] [name] (arguments)
| Argument | Default | Description |
|---|---|---|
| image | Image to run. | |
| name | Container's name. | |
| -p | Container's exported port | Container's Binding port. |
| -v | Current directory | Mounting volume. |
$ keiko run nginx web -p 8080 -v $PWD/site
$ keiko run mariadb db
To create a new image for the script, you need to create a new configuration template at the configs directory located in the installation directory.
Variables for the configuration template.
| Argument | Description |
|---|---|
| image | Image's name at the docker's hub repository. |
| description | Description of the image. |
| dir | Volume mounting point. |
| port | Exposed port. |
| args | Optional arguments. |
image="jekyll/minimal"
description="Jekyll Server"
dir="/srv/jekyll"
port=4000
args="jekyll serve -d /dev/shm/site --safe --force_polling"