diff --git a/README.md b/README.md index a5b2724..89570ca 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,22 @@ # Docker Sandboxes The Easy Way -This repo provides a fast track to spinning up docker containers as -"servers". You can log into these and do most of the things you do an -a "real" server or VM. +Docker has become wildly successful for implementing all manner +of fast-boot/fast-destroy emphemeral computing. Normally, you +configure a container to do one important thing - run a web server, +host a Jenkins instance ... - and the just fire-and-forget afterwards. + +But you can also use docker to build general purpose sandboxes. To do +this, you need to make it easy to log into a running container just +like a "real" VM or server. This repo provides a fast track to doing +just that - starting sandboxes you can log into. # Things You Can Learn From This -* How to build a docker image from a "dockerfile" +* How to build a docker image from a dockerfile * How to tag docker images -* How to use `ansible` to create and destroy a docker network -* How to use `ansible` to create, restart, and destroy docker servers +* How to use ansible to create and destroy a docker network +* How to use ansible to create, restart, and destroy docker servers * How host and `ssh` keys are managed on a docker instance * How to enable `ssh` access to a docker instance * How to share files between docker containers or between the host and a container @@ -27,7 +33,7 @@ * You've got docker already running on your machine * You've made docker access available to your own login -* You've got `ansible` installed on your machine +* You've got ansible installed on your machine * `/shared` exists on your host machine with permissions `1777` @@ -38,7 +44,7 @@ * Configuring sandbox hostname resolution * Build a docker image from a dockerfile -* Use `ansible` to start a docker network and the sandboxes +* Use ansible to start a docker network and the sandboxes * Login to your running sandboxes @@ -113,6 +119,12 @@ However, it is also possible to login using name (`test`) and password (`test`). +In general, once you've properly set up your own `.ssh/config` and +installed keys, you'll do something like this: + + ssh dockersand8 + + Once you are logged in, you can promote yourself to `root` using the `sudo` command without any further password required. @@ -138,11 +150,12 @@ * Find where the docker network subnet is specified and change it to something else. Don't forget to update `/etc/hosts` accordingly. -* While in one sandbox, ssh into another. Notice that this just works. - That's because the images are built with the proper ssh keys in place - in the docker image. Thus, every container has them. Notice that - the name-to-IP association does *not* exist in the container's own - `/etc/hosts`. Do some research to figure out why it isn't needed. +* While in one sandbox, ssh into another. Notice that this just + works. That's because the images are built with the proper ssh keys + in place everywhere - user and host. Thus, every container has + them. Notice that the name-to-IP association does *not* exist in + the container's own `/etc/hosts`. Do some research to figure out + why it isn't needed. * The dockerfiles currently load a lot of software by default. Try factoring this out into separate ansible playbooks @@ -150,3 +163,8 @@ You'll have to parameterize it to account for the different software installation models and package names in the different distros. + +* You'll notice that there is no `dockersand0`. You can reasonably + guess that if such an endpoint existed, its IP would be one + digit lower than the IP for `dockersand1`. Try logging into + that IP and see what is there. You'll be surprised .. diff --git a/dockerfiles/common/etc/dockersand.hosts b/dockerfiles/common/etc/dockersand.hosts index 3ac1392..d3c89c9 100644 --- a/dockerfiles/common/etc/dockersand.hosts +++ b/dockerfiles/common/etc/dockersand.hosts @@ -5,7 +5,7 @@ 192.168.11.5 dockersand4 192.168.11.6 dockersand5 192.168.11.7 dockersand6 -192.168.11.8. dockersand7 -192.168.11.9. dockersand8 +192.168.11.8 dockersand7 +192.168.11.9 dockersand8 192.168.11.10 dockersand9 192.168.11.11 dockersand10