Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Running alternative Docker daemon on the same host
#! /bin/bash
# References:
# - https://stackoverflow.com/questions/32334167/is-it-possible-to-start-multiple-docker-daemons-on-the-same-machine
# - https://docs.docker.com/engine/reference/commandline/dockerd/
# First you need to have Docker 18.09+ and the bridge-utils package installed.
ROOT=/opt/altdocker
: ${bridge=altdocker0}
: ${base=$ROOT/$bridge}
if ! ip link show $bridge > /dev/null 2>&1
then
brctl addbr $bridge
ip addr add ${net:-"10.9.0.1/24"} dev $bridge
ip link set dev $bridge up
fi
# NOTE: "--config-file" must be specified to avoid conflicts with system Docker.
dockerd \
--exec-root=$ROOT/docker/run \
--data-root=$ROOT/docker/data \
--config-file=$ROOT/docker/etc/daemon.json \
--storage-driver=overlay2 \
--bridge=altdocker0 \
--host=unix://$ROOT/docker.sock \
--pidfile=$ROOT/docker.pid
# To use this Docker daemon,
# DOCKER_HOST=unix:///opt/altdocker/docker.sock docker run --rm -it alpine:3.8 sh -c "hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.