Skip to content

Instantly share code, notes, and snippets.

@fike
Last active March 10, 2017 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fike/c9b7c2e572928209b5e8bf9585308a0a to your computer and use it in GitHub Desktop.
Save fike/c9b7c2e572928209b5e8bf9585308a0a to your computer and use it in GitHub Desktop.
centos_docker.sh
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum install docker-ce.x86_64
mkdir -p /etc/systemd/system/docker.service.d/
cat << EOF >> /etc/systemd/system/docker.service.d/environment.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock --cluster-advertise=eth0:2376 --cluster-store=consul://127.0.0.1:8500
EOF
systemctl daemon-reload
systemctl restart docker
docker run -d -p 8400:8400 -p 8500:8500 -p 53:53 -h consul-server --name consul progrium/consul -server -bootstrap
docker run -d \
--name=registrator \
--net=host \
--volume=/var/run/docker.sock:/tmp/docker.sock \
gliderlabs/registrator:latest \
consul://localhost:8500
docker network create --driver overlay foobar
docker run -it --net=foobar --name=bar centos ping foo
docker run -it --net=foobar --name=foo centos ping bar
docker run -d -P --name nginx --net=foobar nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment