dock is an alternative way to use Docker (and very soon other container engines) without writing config files: cd into any directory, type dock
and you’re inside new or existing container with the directory mounted into it by default.
This toolset isn’t forcing anyone else on the team to use itself or even Docker.
It is written in Bash entirely and has minimum requirements.
While currently intended for Desktop use by developers, the hope is to
eventually allow it to be easily used as part of a deployment process and
production environments.
If you prefer cinematic experience, click on one of the videos below. They are not narrated,
and are perfectly watchable and self-explanatory.
Installation video demo. In truth it’s a two step process. Perhaps, this video is pointless. But then… the people of this world demandeth proof.
With dock you can easily:
- Create a container and mount any directory into it – or multiple
directories – with just single command:dock
.
It rarely requires any additional arguments on a day-to-day usage
(that’s from 1,5 years of the experience of using it myself). - Automatically connect to the container via ssh (or other means later).
If you just created the container, it will also do this step
automatically. - Have beautifully set up environment with zsh shell and Vim waiting
for you inside the default image based on Ubuntu 20.04.
You can, of course, customize it and install any shell, text editor and
other software. See the INSTALLATION section to download the image. -
Create images with environments specifically designed for your projects, which is what
containers are for. At the same time may you forget about Dockerfiles – not needed anymore.
dock was created with
the idea that Dockerfiles shall not be used.INCREMENTAL IMAGE UPDATES section in .documentation/IMAGES.txt
explains the reasoning and expands on that topic.
Others wouldn’t even need to know you’re using this tool, let alone
familiarize themselves with Docker or dock. It is designed to
be “exceptionally optional” and “personally useful”.
There are also a few more non-default images you might find useful in
your daily sessions as a developer, such as the ones that provide
VPN and TOR functionality.
Please also kindly read CONTRIBUTE,
ABOUT, DONATE, and
LICENCE pages for more information.
I believe that this software may be useful to people who
aren’t software engineers, but who know their way around command line –
a least a little bit and so it’d would be great if we could continue this work.
-
GOAL 1:
NO Dockerfiles or learning new DSL, or programming language, or some
other convoluted configuration options. Or even NO understanding
how Docker itself works. This tool is eventually intended to be
used with different containerization tools. -
GOAL 2:
ease of use of dock itself (less cli-options or configuration).
-
GOAL 3:
make code reasonably uncomplicated, while acknowledging the
ambiguity – which is necessary to achieve GOAL (2) – managing
it with as little complexity in code as possible. -
GOAL 4:
Make it last. Even if not a single line of code is added after
the official release, it will be useful for years to come. It’s
all POSIX-compliant and written in Bash, so not much can break.
The only serious dependency is Docker, but even that one can be
disregarded when GOAL 5 is achieved. -
GOAL 5:
not implemented
make this tool work with different container engines in such
a way, that the cli stays the same for the end user.
Support for engines likely to be added first: BSD jails & Podman.Right now Docker-specific code is not very well isolated and
rather scattered among various files, but there isn’t too many calls
to various docker commands, so, hopefully, it’ll be easy to identify
and separate them.
DEPENDENCIES
SOFT DEPENDENCIES
-
✱
Tilix terminal (try, it’s very cool).
If you’re using Tilix, containers will be properly highlighted
when you connect to them. Other terminal have different escape
codes for that and I haven’t adjusted for them all just yet. See
https://gnunn1.github.io/tilix-web/ -
✱
font-awesome
if you don’t have it, it’s no problem, but nice icons inside the
container PROMPT when you connect will be replaced with less nice icons,
that’s all. But remember, “font-awesome” needs to be installed on your
host machine, not inside the container.
STEPS TO INSTALL
-
1.
GET THE dock UTILITIES SET
Download the archive
with the stable version of the dock utilities set, which includes all submodules,
but no git-related files or other unnecessary artifacts:curl https://dock.orion3.space/releases/dock_stable.tgz -o dock_stable.tgz && tar xvzf dock_stable.tgz && rm dock_stable.tgz
OR
Clone the git repository, and place it anywhere on your file system,
then initialize and update all git submodules in it:git clone -b stable https://gitea.orion3.space/DOCK/dock.git && cd dock && git submodule init && git submodule update
-
2.
RUN THE INSTALLER SCRIPT
Navigate to the directory with project’s source code you’ve just obtained
and run this command:./install
It’ll ask you a few questions, but they’re simple.
You won’t need to edit any configuration files manually. The script will
download the default image for either directly from the official Docker Hub
or website, but it also will offer you to use a magnet link first too
[2] (you can, of course, say no).Please consider downloading it via BitTorrent and seeding. You can then
tell the script the downloaded image filename to use (it’ll ask).
You may not be able to run this default image under MacOSX, although
dock scripts themselves are fully compatible. The problem is that
MacOSX is not running on an amd64 architecture, so the default image may not be able to boot.
I don’t use MacOSX, nor intend to, but I’d like this to work on any major OS. As
far as I’m concerned, Docker has a tool called buildx
to help convert images for various architectures. If you’re on MacOSX and can help me do it, I’ll
happily publish the converted, dock-compatible base image of Ubuntu 20.04 that would
run on MacOSX.
dock
command from anywhere.Try it with the
dock -y
flag (dry run), which will print allthe variables and other debug information about creating or starting/connecting
to a container with relation to your current directory
- [1]
- [2]
-
[3]
While everyone hates tar, because it’s impossible
to remember the correct cli-options to it (see XKCD)
the download archive includes a utility called untar,
which does the job for you. Ironically, it’s trapped inside that very same
archive it could’ve extracted.But, on a more serious note, this tiny untar
script is part of a set of libraries under
./vendor/bashjazz
which I strongly recommend you explore. They are small to medium sized bash-scripts
(some executable, some source-able, some both) helping you in
everyday life (you can use zsh, or any other shell, of course –
they just require bash installed).
dock [IMAGE_NAME] [CONTAINER_NAME]
Here, with just one positional argument provided,
dock will be doing some guessing:
dock [IMAGE_NAME]
dock [CONTAINER_NAME]
And, finally, without any positional arguments dock will be basing
its guessing on default image you set in ~/.dockrc and your current directory:
dock
Both positional arguments are optional, however they’re not exactly
positional. If the second one isn’t provided, dock tries its best to guess
what’s going on. The simplified version looks like this when only the first
argument is supplied:
-
a.
Assume $1 (first argument to dock) is the name of an existing CONTAINER.
If it exists, launch it and connect via ssh.