Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pateketrueke/undock

Dind for the lulz
https://github.com/pateketrueke/undock

Last synced: 10 days ago
JSON representation

Dind for the lulz

Awesome Lists containing this project

README

        

# Dind for the lulz.

Useful single-shot command for Docker-in-Docker containers.

It will run `$HOME/.docker/Dockerfile` with some folders mounted:

- `/var/run/docker.sock`
- `$HOME/.bash_history`
- `$HOME/.gitconfig`
- `$HOME/.ssh`

See included [Dockerfile](Dockerfile) as starting-point for your own setup.

Also you can check the published [Dockerfile I'm using at Docker hub](https://hub.docker.com/r/pateketrueke/undock/).

## Usage

Install it globally with `npm i -g undock` or just use `npx`, e.g.

```
$ undock [NAME] [TARGET] [PROJECT] [NETWORK] [...] [-- COMMAND]
```

## Options

- `-b, --build` — Force image build before attaching
- `-p, --ports` — Exposed ports from the attached container
- `NAME` — Container name for the mounted image (default: none)
- `TARGET` — Build target from the Dockerfile (default: `develop`)
- `PROJECT` — Project name for the built image (default: `basename $PWD`)
- `NETWORK` — Networking group used for linking containers (default: `default`)
- `-- COMMAND` — Additional command to execute (default: `/bin/bash`)

## Networking

Undock will setup the network for you based on given arguments.

However, if you can't see other containers remember connect them, e.g.

```bash
# start two containers in separated shells
$ undock web -p 80:4000 -- npm start
$ undock user -- npm start

# create a shared network and connect containers
$ docker network create -d bridge undock
$ docker network connect undock web
$ docker network connect undock user
```