|
| 1 | +# DIP |
| 2 | + |
| 3 | +Docker Interaction Process |
| 4 | + |
| 5 | +CLI utility for straightforward provisioning and interacting with application configured by docker-compose. |
| 6 | + |
| 7 | +DIP also contains commands for running support containers such as ssh agent and dns server. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +```sh |
| 12 | +curl -L https://github.com/bibendi/dip/releases/download/0.1.0/dip-`uname -s`-`uname -m` > /usr/local/bin/dip |
| 13 | +chmod +x /usr/local/bin/dip |
| 14 | +``` |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +```sh |
| 19 | +dip --help |
| 20 | +dip SUBCOMMAND --help |
| 21 | +``` |
| 22 | + |
| 23 | +### dip compose |
| 24 | + |
| 25 | +Run docker-compose commands that is configured according with application dip.yml |
| 26 | + |
| 27 | +```sh |
| 28 | +dip compose COMMAND [OPTIONS] |
| 29 | +``` |
| 30 | + |
| 31 | +### dip ssh |
| 32 | + |
| 33 | +Runs ssh agent container base on https://github.com/whilp/ssh-agent with your ~/.ssh/id_rsa. |
| 34 | +It creates a named volume `ssh_data` with ssh socket. |
| 35 | +An applications docker-compose.yml should define environment variable `SSH_AUTH_SOCK=/ssh/auth/sock` and connect to external volume `ssh_data`. |
| 36 | + |
| 37 | +```sh |
| 38 | +dip ssh add |
| 39 | +``` |
| 40 | + |
| 41 | +docker-compose.yml |
| 42 | + |
| 43 | +```yml |
| 44 | +services: |
| 45 | + web: |
| 46 | + environment: |
| 47 | + - SSH_AUTH_SOCK=/ssh/auth/sock |
| 48 | + volumes: |
| 49 | + - ssh-data:/ssh:ro |
| 50 | + |
| 51 | +volumes: |
| 52 | + ssh-data: |
| 53 | + external: |
| 54 | + name: ssh_data |
| 55 | +``` |
| 56 | +
|
| 57 | +## dip dns |
| 58 | +
|
| 59 | +Runs DNS server container based on https://github.com/aacebedo/dnsdock |
| 60 | +
|
| 61 | +```sh |
| 62 | +dip dns up |
| 63 | +``` |
| 64 | + |
| 65 | +### Installation |
| 66 | + |
| 67 | +#### Ubuntu |
| 68 | + |
| 69 | +TODO |
| 70 | + |
| 71 | +#### Mac OS X |
| 72 | + |
| 73 | +First, let's start by configuring the default Docker service DNS server to IP where the DNS server will run (`172.17.0.1`). Currently, this requires SSH'ing into the VM and editing `/etc/default/docker` |
| 74 | + |
| 75 | +```sh |
| 76 | + |
| 77 | + |
| 78 | +vi /etc/default/docker |
| 79 | +# Add the DNS server static IP via `--bip` and `--dns` |
| 80 | +# Change DOCKER_ARGS to: |
| 81 | +DOCKER_ARGS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 -s btrfs --bip=172.17.0.1/24 --dns=172.17.0.1" |
| 82 | +# save :x |
| 83 | + |
| 84 | +exit |
| 85 | + |
| 86 | +dlite stop && dlite start |
| 87 | +``` |
| 88 | + |
| 89 | +Lastly, configure OSX so that all `.docker` requests are forwarded to Docker's DNS server. Since routing has already been taken care of, just create a custom resolver under `/etc/resolver/docker` with the following content: |
| 90 | + |
| 91 | +``` |
| 92 | +nameserver 172.17.0.1 |
| 93 | +``` |
| 94 | + |
| 95 | +Then restart OSX's own DNS server: |
| 96 | + |
| 97 | +```sh |
| 98 | +sudo killall -HUP mDNSResponder |
| 99 | +``` |
| 100 | + |
| 101 | +By default, Docker creates a virtual interface named `docker0` on the host machine that forwards packets between any other network interface. |
| 102 | + |
| 103 | +However, on OSX, this means you are not able to access the Docker network directly. To be able to do so, you need add a route and allow traffic from any host on the interface that connects to the VM. |
| 104 | + |
| 105 | +Run the following commands on your OSX machine: |
| 106 | + |
| 107 | +```sh |
| 108 | +sudo route -n add 172.17.0.0/8 local.docker |
| 109 | +DOCKER_INTERFACE=$(route get local.docker | grep interface: | cut -f 2 -d: | tr -d ' ') |
| 110 | +DOCKER_INTERFACE_MEMBERSHIP=$(ifconfig ${DOCKER_INTERFACE} | grep member: | cut -f 2 -d: | cut -c 2-4) |
| 111 | +sudo ifconfig "${DOCKER_INTERFACE}" -hostfilter "${DOCKER_INTERFACE_MEMBERSHIP}" |
| 112 | +``` |
| 113 | + |
| 114 | +Check: |
| 115 | + |
| 116 | +```sh |
| 117 | +ping dnsdock.docker |
| 118 | +``` |
| 119 | + |
| 120 | +# Docker |
| 121 | + |
| 122 | +## Installation |
| 123 | + |
| 124 | +### Ubuntu |
| 125 | + |
| 126 | +TODO |
| 127 | + |
| 128 | +### Mac OS X |
| 129 | + |
| 130 | +``` |
| 131 | +sudo brew install docker |
| 132 | +sudo brew switch docker 1.12.1 |
| 133 | +``` |
| 134 | + |
| 135 | +#### dlite |
| 136 | + |
| 137 | +Download https://github.com/nlf/dlite/releases/download/1.1.5/dlite |
| 138 | + |
| 139 | +```sh |
| 140 | +sudo dlite install -c 2 -m 4 -d 20 -S $HOME |
| 141 | +``` |
| 142 | + |
| 143 | +##### Simple |
| 144 | + |
| 145 | +- `dlite stop` |
| 146 | +- download `bzImage` and `rootfs.cpio.xz` https://github.com/bibendi/dhyve-os/releases/tag/2.3.1 |
| 147 | +- move in `~/.dlite/` |
| 148 | +- `dlite start` |
| 149 | + |
| 150 | +##### or Advanced (for other docker version) |
| 151 | + |
| 152 | +```sh |
| 153 | +git clone https://github.com/nlf/dhyve-os.git |
| 154 | +cd dhyve-os |
| 155 | +git checkout legacy |
| 156 | +vi Dockerfile |
| 157 | +# find the DOCKER_VERSION and replace with needed version |
| 158 | +make |
| 159 | +dlite stop |
| 160 | +cp output/{bzImage,rootfs.cpio.xz} ~/.dlite/ |
| 161 | +dlite start |
| 162 | +``` |
0 commit comments