Dockerfiles
My Dockerfiles. Trusted Builds also available in the Docker registry
Each folders contains a README with more information about the respective Dockerfile.
The next sections of this README contain some useful tips that I found and kept here for quick reference.
Useful Commands
# Stop all containers
docker stop (docker ps -a -q)
# Remove all containers
docker rm (docker ps -a -q)
# Remove all images
docker rmi (docker images -a -q)
Docker on OSX
Since OSX isn't Linux and Docker is based on Linux Containers (LXC), the closest you can get is to use boot2docker, a Linux VM, to run a Docker daemon inside to which the Docker client on the OSX terminal can connect to build images and run containers.
Setup
# Install
brew install boot2docker
brew install docker
# Get patched iso for shared folders (see: [boot2docker/pull/284](https://github.com/boot2docker/boot2docker/pull/284))
curl https://dl.dropboxusercontent.com/u/12014139/boot2docker.iso --create-dirs -o ~/.boot2docker/boot2docker.iso
# Create boot2docker VM
boot2docker init
# Add shared folder to boot2docker
VBoxManage sharedfolder add boot2docker-vm -name home -hostpath $HOME
# Export environment variable with address for Docker client to connect
echo 'export DOCKER_HOST=tcp://localhost:4243' >> ~/.profile
# Start boot2docker VM
boot2docker up
# Mount shared folder inside VM (password: tcuser)
boot2docker ssh "sudo modprobe vboxsf && mkdir -p $HOME && sudo mount -t vboxsf home $HOME"
Workarounds
The following are temporary workaround to get shared folders between the host
and the Docker container working, and port forwarding (for example for web apps or ssh).
See the boot2docker repo for more info.
Shared folders
Because we used a patched iso, the -v parameter should just work:
docker run -v ~/share:/share ubuntu
See the Docker documentation for more info.
Forward Ports
The simplest is to just do:
# e.g. Port 8080
boot2docker ssh -L 8000:localhost:8000 # keep it open
See the boot2docker repo for more info.
