Simple quick tips i've learned using Docker

Quick Tips for Docker

I originally started using Docker shortly after _0.6.0_ was released. A lot has changed since then and for the most part; all the better. But there are many things I wish someone had told me when I started using [Docker][docker].

  • Persistence Nothing removed unless you tell Docker to. + Volumes are fantastic; but unless you start your containers with the -rm flag your data should not disappear magically. You will have to _inspect_ the old _container_ that was running to determine where the root filesystem is, but it's there.

  • Building images can make a lot of containers that _can_ and _do_ waste a lot of space. + Using docker build -rm will save you a lot of disk space. + If the exit command does not exit succesfully the container; it will not be used as cache in the future. This can lead to wasting time building images as you have to re-download Java each time you build.

  • Networking You can accept the default setup where Docker creates docker0 or you can configure your own Bridge and configure docker to use that instead. + Modify $DOCKER_OPTS to look like: DOCKER_OPTS="-api-enable-cors=true -b=br0 -H=tcp://x.x.x.x:4243 -H=unix:///var/run/docker.sock"

  • Help Diagnose Problems If you get stuck with something; you can share your _image_ with peers to help you diagnose the problem. They can then either tell you what they did to fix your image or send you the fixed _image_.

more ...