Skip to content

Instantly share code, notes, and snippets.

@fmoliveira
Created February 8, 2016 14:51
Show Gist options
  • Save fmoliveira/5ff536bc99c984fbf18c to your computer and use it in GitHub Desktop.
Save fmoliveira/5ff536bc99c984fbf18c to your computer and use it in GitHub Desktop.
Mounting docker.sock in a Docker container

There are situations you might want to start Docker containers inside a Docker container, but you need both containers to be siblings, that is, to run in the host system.

In fact it's very easy to achieve that. Just mount docker.sock, Docker binary and App Armor shared libraries and you're good to go.

#!/bin/sh
docker run \
-it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `which docker`:/usr/bin/docker \
-v /usr/lib/x86_64-linux-gnu/libapparmor.so.1:/usr/lib/x86_64-linux-gnu/libapparmor.so.1 \
-v /usr/lib/x86_64-linux-gnu/libapparmor.so.1.1.0:/usr/lib/x86_64-linux-gnu/libapparmor.so.1.1.0 \
ubuntu@latest \
bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment